{"raw_statement":[{"iden":"statement","content":"Not so long ago the Codecraft-17 contest was held on Codeforces. The top 25 participants, and additionally random 25 participants out of those who got into top 500, will receive a Codeforces T-shirt.\n\nUnfortunately, you didn't manage to get into top 25, but you got into top 500, taking place _p_.\n\nNow the elimination round of 8VC Venture Cup 2017 is being held. It has been announced that the Codecraft-17 T-shirt winners will be chosen as follows. Let _s_ be the number of points of the winner of the elimination round of 8VC Venture Cup 2017. Then the following pseudocode will be executed:\n\ni := (s div 50) mod 475\nrepeat 25 times:\n    i := (i * 96 + 42) mod 475\n    print (26 + i)\n\nHere \"_div_\" is the integer division operator, \"_mod_\" is the modulo (the remainder of division) operator.\n\nAs the result of pseudocode execution, 25 integers between 26 and 500, inclusive, will be printed. These will be the numbers of places of the participants who get the Codecraft-17 T-shirts. It is guaranteed that the 25 printed integers will be pairwise distinct for any value of _s_.\n\nYou're in the lead of the elimination round of 8VC Venture Cup 2017, having _x_ points. You believe that having at least _y_ points in the current round will be enough for victory.\n\nTo change your final score, you can make any number of successful and unsuccessful hacks. A successful hack brings you 100 points, an unsuccessful one takes 50 points from you. It's difficult to do successful hacks, though.\n\nYou want to win the current round and, at the same time, ensure getting a Codecraft-17 T-shirt. What is the smallest number of **successful** hacks you have to do to achieve that?"},{"iden":"input","content":"The only line contains three integers _p_, _x_ and _y_ (26 ≤ _p_ ≤ 500; 1 ≤ _y_ ≤ _x_ ≤ 20000) — your place in Codecraft-17, your current score in the elimination round of 8VC Venture Cup 2017, and the smallest number of points you consider sufficient for winning the current round."},{"iden":"output","content":"Output a single integer — the smallest number of successful hacks you have to do in order to both win the elimination round of 8VC Venture Cup 2017 and ensure getting a Codecraft-17 T-shirt.\n\nIt's guaranteed that your goal is achievable for any valid input data."},{"iden":"examples","content":"Input\n\n239 10880 9889\n\nOutput\n\n0\n\nInput\n\n26 7258 6123\n\nOutput\n\n2\n\nInput\n\n493 8000 8000\n\nOutput\n\n24\n\nInput\n\n101 6800 6500\n\nOutput\n\n0\n\nInput\n\n329 19913 19900\n\nOutput\n\n8"},{"iden":"note","content":"In the first example, there is no need to do any hacks since 10880 points already bring the T-shirt to the 239-th place of Codecraft-17 (that is, you). In this case, according to the pseudocode, the T-shirts will be given to the participants at the following places:\n\n475 422 84 411 453 210 157 294 146 188 420 367 29 356 398 155 102 239 91 133 365 312 449 301 343\n\nIn the second example, you have to do two successful and one unsuccessful hack to make your score equal to 7408.\n\nIn the third example, you need to do as many as 24 successful hacks to make your score equal to 10400.\n\nIn the fourth example, it's sufficient to do 6 unsuccessful hacks (and no successful ones) to make your score equal to 6500, which is just enough for winning the current round and also getting the T-shirt."}],"translated_statement":[{"iden":"statement","content":"不久之前，Codecraft-17 比赛在 Codeforces 上举行。前 25 名选手，以及从排名前 500 的选手中随机抽取的 25 名选手，将获得 Codeforces T 恤。\n\n不幸的是，你未能进入前 25 名，但你进入了前 500 名，排名为 #cf_span[p]。\n\n现在，8VC Venture Cup 2017 的淘汰赛正在进行。官方宣布，Codecraft-17 T 恤的获奖者将按如下方式选择：设 #cf_span[s] 为 8VC Venture Cup 2017 淘汰赛冠军的得分。然后将执行以下伪代码：\n\n其中 \"_div_\" 是整数除法运算符，\"_mod_\" 是取模运算符（除法余数）。\n\n伪代码执行后，将输出 25 个介于 26 到 500 之间的整数（含端点），这些整数代表获得 Codecraft-17 T 恤的选手的排名。题目保证，对于任意 #cf_span[s] 的值，这 25 个输出的整数互不相同。\n\n你现在是 8VC Venture Cup 2017 淘汰赛的领先者，拥有 #cf_span[x] 分。你认为至少需要 #cf_span[y] 分才能赢得本场比赛。\n\n为了改变你的最终得分，你可以进行任意次数的成功或失败的 Hack。一次成功的 Hack 会为你增加 100 分，一次失败的 Hack 会扣掉你 50 分。不过，成功的 Hack 很难实现。\n\n你希望赢得本场比赛，同时确保获得 Codecraft-17 T 恤。你需要进行的最少成功 Hack 次数是多少？\n\n输入仅一行包含三个整数 #cf_span[p], #cf_span[x] 和 #cf_span[y]（#cf_span[26 ≤ p ≤ 500]；#cf_span[1 ≤ y ≤ x ≤ 20000]）—— 你在 Codecraft-17 中的排名、你在 8VC Venture Cup 2017 淘汰赛中的当前得分，以及你认为赢得本场比赛所需的最少分数。\n\n输出一个整数——为同时赢得 8VC Venture Cup 2017 淘汰赛并确保获得 Codecraft-17 T 恤，你需要进行的最少成功 Hack 次数。\n\n题目保证对于任何合法输入，你的目标均可实现。\n\n在第一个示例中，无需进行任何 Hack，因为 10880 分已经使你（排名第 239 位）获得 T 恤。此时，根据伪代码，T 恤将授予以下排名的选手：\n\n在第二个示例中，你需要进行两次成功 Hack 和一次失败 Hack，使你的得分变为 7408。\n\n在第三个示例中，你需要进行多达 24 次成功 Hack，使你的得分变为 10400。\n\n在第四个示例中，只需进行 6 次失败 Hack（无需成功 Hack），使你的得分变为 6500，这刚好足以赢得比赛并获得 T 恤。"},{"iden":"input","content":"输入仅一行包含三个整数 #cf_span[p], #cf_span[x] 和 #cf_span[y]（#cf_span[26 ≤ p ≤ 500]；#cf_span[1 ≤ y ≤ x ≤ 20000]）—— 你在 Codecraft-17 中的排名、你在 8VC Venture Cup 2017 淘汰赛中的当前得分，以及你认为赢得本场比赛所需的最少分数。"},{"iden":"output","content":"输出一个整数——为同时赢得 8VC Venture Cup 2017 淘汰赛并确保获得 Codecraft-17 T 恤，你需要进行的最少成功 Hack 次数。题目保证对于任何合法输入，你的目标均可实现。"},{"iden":"examples","content":"输入\n239 10880 9889\n输出\n0\n\n输入\n26 7258 6123\n输出\n2\n\n输入\n493 8000 8000\n输出\n24\n\n输入\n101 6800 6500\n输出\n0\n\n输入\n329 19913 19900\n输出\n8"},{"iden":"note","content":"在第一个示例中，无需进行任何 Hack，因为 10880 分已经使你（排名第 239 位）获得 T 恤。此时，根据伪代码，T 恤将授予以下排名的选手：475 422 84 411 453 210 157 294 146 188 420 367 29 356 398 155 102 239 91 133 365 312 449 301 343\n\n在第二个示例中，你需要进行两次成功 Hack 和一次失败 Hack，使你的得分变为 7408。\n\n在第三个示例中，你需要进行多达 24 次成功 Hack，使你的得分变为 10400。\n\n在第四个示例中，只需进行 6 次失败 Hack（无需成功 Hack），使你的得分变为 6500，这刚好足以赢得比赛并获得 T 恤。"}],"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ p \\in \\mathbb{Z} $ be your Codecraft-17 place ($26 \\leq p \\leq 500$).  \nLet $ x \\in \\mathbb{Z} $ be your current score ($1 \\leq x \\leq 20000$).  \nLet $ y \\in \\mathbb{Z} $ be the minimum score required to win ($1 \\leq y \\leq x$).  \n\nLet $ s \\in \\mathbb{Z} $ be the final score after hacks, with $ s \\geq y $.  \nLet $ a \\in \\mathbb{N}_0 $ be the number of successful hacks (each $+100$).  \nLet $ b \\in \\mathbb{N}_0 $ be the number of unsuccessful hacks (each $-50$).  \nThen:  \n$$ s = x + 100a - 50b $$\n\nLet $ T(s) = \\{ (s \\mod 500) + 26, (s \\mod 500) + 26 + 500, \\dots \\} $ — the set of 25 distinct T-shirt recipient places generated by the pseudocode, which is:  \n$$ T(s) = \\left\\{ \\left( \\left\\lfloor \\frac{s}{500} \\right\\rfloor + i \\right) \\mod 500 + 26 \\mid i = 0, 1, \\dots, 24 \\right\\} $$  \nBut since modulo 500, the set simplifies to:  \n$$ T(s) = \\left\\{ (s \\bmod 500) + 26 + 500k \\mod 500 \\mid k = 0, \\dots, 24 \\right\\} = \\left\\{ (s \\bmod 500) + 26, (s \\bmod 500) + 27, \\dots, (s \\bmod 500) + 50 \\right\\} \\cap [26, 500] $$  \nThus, $ T(s) $ is the set of 25 consecutive integers starting from $ r = (s \\bmod 500) + 26 $, wrapping if necessary, but guaranteed to be within $[26, 500]$ and distinct.\n\n**Constraints**  \n1. $ s = x + 100a - 50b \\geq y $  \n2. $ a, b \\in \\mathbb{N}_0 $  \n3. $ p \\in T(s) $ → $ p \\in \\{ (s \\bmod 500) + 26, (s \\bmod 500) + 27, \\dots, (s \\bmod 500) + 50 \\} $  \n   → Equivalently: $ (s \\bmod 500) \\in \\{ p - 50, p - 49, \\dots, p - 26 \\} $  \n   → Let $ R_p = \\{ p - 50, p - 49, \\dots, p - 26 \\} \\mod 500 $, then $ s \\bmod 500 \\in R_p $\n\n**Objective**  \nMinimize $ a $, the number of successful hacks, over all $ s \\geq y $ such that $ s \\equiv r \\pmod{500} $ for some $ r \\in R_p $, and $ s = x + 100a - 50b $ for some $ b \\in \\mathbb{N}_0 $.","simple_statement":null,"has_page_source":false}