{"problem":{"name":"D. Roman Digits","description":{"content":"Let's introduce a number system which is based on a roman digits. There are digits _I_, _V_, _X_, _L_ which correspond to the numbers $1$, $5$, $10$ and $50$ respectively. The use of other roman digit","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF998D"},"statements":[{"statement_type":"Markdown","content":"Let's introduce a number system which is based on a roman digits. There are digits _I_, _V_, _X_, _L_ which correspond to the numbers $1$, $5$, $10$ and $50$ respectively. The use of other roman digits is not allowed.\n\nNumbers in this system are written as a sequence of one or more digits. We define the value of the sequence simply as the sum of digits in it.\n\nFor example, the number _XXXV_ evaluates to $35$ and the number _IXI_ — to $12$.\n\nPay attention to the difference to the traditional roman system — in our system any sequence of digits is valid, moreover the order of digits doesn't matter, for example _IX_ means $11$, not $9$.\n\nOne can notice that this system is ambiguous, and some numbers can be written in many different ways. Your goal is to determine how many distinct integers can be represented by **exactly** $n$ roman digits _I_, _V_, _X_, _L_.\n\n## Input\n\nThe only line of the input file contains a single integer $n$ ($1 \\le n \\le 10^9$) — the number of roman digits to use.\n\n## Output\n\nOutput a single integer — the number of distinct integers which can be represented using $n$ roman digits _exactly_.\n\n[samples]\n\n## Note\n\nIn the first sample there are exactly $4$ integers which can be represented — _I_, _V_, _X_ and _L_.\n\nIn the second sample it is possible to represent integers $2$ (_II_), $6$ (_VI_), $10$ (_VV_), $11$ (_XI_), $15$ (_XV_), $20$ (_XX_), $51$ (_IL_), $55$ (_VL_), $60$ (_XL_) and $100$ (_LL_).","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"让我们引入一种基于罗马数字的数制。其中数字 _I_、_V_、_X_、_L_ 分别对应数值 $1$、$5$、$10$ 和 $50$。不允许使用其他罗马数字。\n\n在此系统中，数字由一个或多个数字组成的序列表示。我们定义该序列的值为其所有数字的数值之和。\n\n例如，序列 _XXXV_ 的值为 $35$，序列 _IXI_ 的值为 $12$。\n\n请注意，这与传统罗马数字系统不同——在本系统中，任何数字序列都是合法的，且数字的顺序无关紧要。例如，_IX_ 表示 $11$，而非 $9$。\n\n可以注意到，该系统存在歧义，某些数字可以用多种不同方式表示。你的目标是确定恰好使用 $n$ 个罗马数字 _I_、_V_、_X_、_L_ 时，能够表示多少个不同的整数。\n\n输入文件仅包含一行，一个整数 $n$（$1 lt.eq n lt.eq 10^9$）——表示要使用的罗马数字个数。\n\n请输出一个整数——恰好使用 $n$ 个罗马数字能表示的不同整数的个数。\n\n在第一个样例中，恰好有 $4$ 个整数可以表示——_I_、_V_、_X_ 和 _L_。\n\n在第二个样例中，可以表示的整数有：$2$（_II_）、$6$（_VI_）、$10$（_VV_）、$11$（_XI_）、$15$（_XV_）、$20$（_XX_）、$51$（_IL_）、$55$（_VL_）、$60$（_XL_）和 $100$（_LL_）。\n\n## Input\n\n输入文件仅包含一行，一个整数 $n$（$1 lt.eq n lt.eq 10^9$）——表示要使用的罗马数字个数。\n\n## Output\n\n请输出一个整数——恰好使用 $n$ 个罗马数字能表示的不同整数的个数。\n\n[samples]\n\n## Note\n\n在第一个样例中，恰好有 $4$ 个整数可以表示——_I_、_V_、_X_ 和 _L_。在第二个样例中，可以表示的整数有：$2$（_II_）、$6$（_VI_）、$10$（_VV_）、$11$（_XI_）、$15$（_XV_）、$20$（_XX_）、$51$（_IL_）、$55$（_VL_）、$60$（_XL_）和 $100$（_LL_）。","is_translate":true,"language":"Chinese"},{"statement_type":"Markdown","content":"**Definitions**  \nLet the digit values be:  \n- $ d_I = 1 $,  \n- $ d_V = 5 $,  \n- $ d_X = 10 $,  \n- $ d_L = 50 $.  \n\nLet $ n \\in \\mathbb{Z}^+ $ be the total number of digits used, with $ 1 \\leq n \\leq 10^9 $.  \n\nLet $ a, b, c, d \\in \\mathbb{Z}_{\\geq 0} $ denote the counts of digits I, V, X, L respectively, such that:  \n$$\na + b + c + d = n\n$$\n\nThe value of a sequence is:  \n$$\nv = 1 \\cdot a + 5 \\cdot b + 10 \\cdot c + 50 \\cdot d\n$$\n\n**Objective**  \nCompute the number of **distinct** values of $ v $ over all non-negative integer solutions $ (a, b, c, d) $ to $ a + b + c + d = n $.\n\nThat is, find the cardinality of the set:  \n$$\n\\left\\{ a + 5b + 10c + 50d \\,\\middle|\\, a,b,c,d \\in \\mathbb{Z}_{\\geq 0},\\ a + b + c + d = n \\right\\}\n$$","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF998D","tags":["brute force","combinatorics","greedy"],"sample_group":[["1","4"],["2","10"],["10","244"]],"created_at":"2026-03-03 11:00:39"}}