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.

Numbers 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.

For example, the number XXXV evaluates to $35$ and the number IXI — to $12$.

Pay 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$.

One 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.


-----Input-----

The only line of the input file contains a single integer $n$ ($1 \le n \le 10^9$) — the number of roman digits to use.


-----Output-----

Output a single integer — the number of distinct integers which can be represented using $n$ roman digits exactly.


-----Examples-----
Input
1

Output
4

Input
2

Output
10

Input
10

Output
244



-----Note-----

In the first sample there are exactly $4$ integers which can be represented — I, V, X and L.

In 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).

Difficulty: HARD

Solutions:
n = int(input())
m = min([n, 100])
result = 50 * (n - m) + m - n + 1
my_set = set()
for i in range(m + 1):
	for j in range(i, m + 1):
		for k in range(j, m + 1):
			tmp = 50 * i + 10 * (j - i) + 5 * (k - j) + (m - k)
			my_set.add(tmp)
result += len(my_set) - 1
print(result)


n = int(input())
ans = 0
precomp = [0, 4, 10, 20, 35, 56, 83, 116, 155, 198, 244]
if n <= 10:
	print(precomp[n])
	exit()
for i in range(9):
	ans += n - i + 1
for i in range(1, 9):
	for j in range(5):
		ans += n - i - j + 1
print(ans)


n = int(input().strip())

def C(n, r):
	c = 1
	for i in range(r):
		c = c * (n - i)
	for i in range(r):
		c = c // (i + 1)
	return c

def calc(n, r):
	if n < 0:
		return 0
	return C(n + r - 1, r - 1)
ans = 0
for i in range(5):
	ans += calc(n - i, 2)
for i in range(4):
	ans += calc(n - i, 2)
for i in range(5):
	for j in range(4):
		ans -= calc(n - i - j, 1)
for i in range(5):
	for j in range(8):
		ans += calc(n - i - j - 1, 2)
print(ans)


n = int(input())
rec = [0, 4, 10, 20, 35, 56, 83, 116, 155, 198, 244, 292, 341]
ans = 0
if n <= 12:
	ans = rec[n]
else:
	ans = (n - 12) * 49 + rec[12]
print(ans)


from collections import defaultdict
n = int(input())
if n > 11:
	print(292 + 49 * (n - 11))
else:
	d = defaultdict(list)
	for L in range(n + 1):
		for X in range(n + 1 - L):
			for V in range(n + 1 - X - L):
				I = n - X - V - L
				s = L * 50 + X * 10 + V * 5 + I
				d[s].append((L, X, V, I))
	print(len(d))


n = int(input())
a = [0, 4, 10, 20, 35, 56, 83, 116, 155, 198, 244, 292]
if n < len(a):
	print(a[n])
else:
	print(a[11] + 49 * (n - 11))


n = int(input())
ans = 0
i = 0
while i <= 8 and i <= n:
	j = 0
	while j <= (8 if i == 0 else 4) and j + i <= n:
		ans += n - i - j + 1
		j = j + 1
	i = i + 1
print(ans)


non_representable = {1: 46, 2: 89, 3: 128, 4: 162, 5: 190, 6: 212, 7: 228, 8: 238, 9: 244, 10: 247}
n = int(input())
print(49 * n + 1 - non_representable.get(n, 248))


def main():
	(a, b, c, res, nxt) = (-1, -1, 0, [1], [True])
	while b - a < c - b:
		(cur, nxt) = (nxt, [False] * (len(nxt) + 50))
		for p in (1, 5, 10, 50):
			for (i, f) in enumerate(cur):
				if f:
					nxt[i + p] = True
		(a, b, c) = (b, c, sum(nxt))
		res.append(c)
	n = int(input())
	print(res[n] if len(res) > n else c + (c - b) * (n - len(res) + 1))

def __starting_point():
	main()
__starting_point()


ans = [1, 4, 10, 20, 35, 56, 83, 116, 155, 198, 244, 292, 341, 390, 439]
n = int(input())
if n < 12:
	print(ans[n])
else:
	print(292 + (n - 11) * 49)


a = [0, 4, 10, 20, 35, 56, 83, 116, 155, 198, 244]
n = int(input())
if n <= 10:
	print(a[n])
else:
	print(49 * n - 247)


numset = set()

def num(now, n):
	if n == 1:
		numset.add(now + 1)
		numset.add(now + 5)
		numset.add(now + 10)
		numset.add(now + 50)
	else:
		num(now + 1, n - 1)
		num(now + 5, n - 1)
		num(now + 10, n - 1)
		num(now + 50, n - 1)
n = int(input())
if n < 11:
	num(0, n)
	print(len(numset))
else:
	print(292 + 49 * (n - 11))


from itertools import combinations_with_replacement
l = []
for n in range(1, 20):
	st = set()
	for cmb in combinations_with_replacement((1, 5, 10, 50), n):
		st.add(sum(cmb))
	l.append(len(st))
n = int(input())
if n <= len(l):
	print(l[n - 1])
else:
	print(n * 49 - 247)


def f(n):
	if n < 0:
		return 0
	val = (n + 3) * (n + 2) * (n + 1) // 6
	return val

def g(n):
	return f(n) - f(n - 6) - 2 * f(n - 9) + f(n - 10) + f(n - 14)
n = int(input())
print(g(n))


from __future__ import print_function
import sys
import math
import os.path
import random
from copy import deepcopy
from functools import reduce
from collections import Counter, ChainMap, defaultdict
from itertools import cycle, chain
from queue import Queue, PriorityQueue
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, nlargest, nsmallest
import bisect
from statistics import mean, mode, median, median_low, median_high
sys.setrecursionlimit(10 ** 9)

def log(*args, **kwargs):
	print(*args, file=sys.stderr, **kwargs)

def ni():
	return map(int, input().split())

def nio(offset):
	return map(lambda x: int(x) + offset, input().split())

def nia():
	return list(map(int, input().split()))

def toString(aList, sep=' '):
	return sep.join((str(x) for x in aList))

def toMapInvertIndex(aList):
	return {k: v for (v, k) in enumerate(aList)}

def sortId(arr):
	return sorted(range(arr), key=lambda k: arr[k])
(n,) = ni()
s = [0, 4, 10, 20, 35, 56, 83, 116, 155, 198, 244, 292, 341, 390, 439, 488, 537, 586, 635, 684, 733, 782, 831, 880, 29, 978, 1027, 1076, 1125, 1174, 1223]
if n < len(s):
	print(s[n])
else:
	print(s[30] + 49 * (n - 30))


n = int(input())
ans = 0
minv = [int(1000000000.0)] * 200000
minv[0] = 0
for i in range(49):
	for j in range(49):
		minv[(4 * i + 9 * j) % 49] = min(minv[(4 * i + 9 * j) % 49], i + j)
for i in range(49):
	if n >= minv[i]:
		ans += n - minv[i] + 1
print(ans)


def answer(n):
	sums = set()
	for d1 in range(n + 1):
		for d5 in range(n + 1 - d1):
			for d10 in range(n + 1 - d1 - d5):
				d50 = n - d1 - d5 - d10
				sums.add(d1 * 1 + d5 * 5 + d10 * 10 + d50 * 50)
	return len(sums)
answers = [answer(x) for x in range(31)]
n = int(input())
if n < len(answers):
	answer = answers[n]
else:
	growth = answers[30] - answers[29]
	answer = answers[29] + (n - 29) * growth
print(answer)


from sys import stdin, stdout

def count(n):
	d = {}
	cnt = 0
	cur = 0
	for i in range(n + 1):
		for j in range(n - i + 1):
			for z in range(n - j - i + 1):
				v = i * 1 + j * 5 + z * 10 + (n - i - j - z) * 50
				if not v in d:
					d[v] = 1
					cur += 1
				else:
					d[v] += 1
	return cur
n = int(stdin.readline())
if n >= 20:
	upp = count(20) + 49 * (n - 20)
else:
	upp = count(n)
print(upp)


n = int(input())
add = [1, 5, 10, 50]
sumMap = {}

def dfs(k, s):
	if k == 0:
		t = 0
		for x in s:
			t += x
		if not t in sumMap:
			sumMap[t] = 1
		return
	for x in add:
		if len(s) > 0 and x >= s[-1]:
			dfs(k - 1, s + [x])
		elif len(s) == 0:
			dfs(k - 1, s + [x])
if n < 12:
	dfs(n, [])
	print(len(sumMap))
else:
	dfs(12, [])
	base = len(sumMap)
	print(base + (n - 12) * 49)


from collections import defaultdict

class DisjointRangeUnion:

	def __init__(self):
		self.ranges = list()

	def add(self, begin, end):
		new_ranges = list()
		for (b, e) in self.ranges:
			if begin <= e and b <= end:
				begin = min(b, begin)
				end = max(e, end)
			else:
				new_ranges.append((b, e))
		new_ranges.append((begin, end))
		self.ranges = new_ranges

	def count(self):
		return sum((e - b for (b, e) in self.ranges))

	def __repr__(self):
		return repr(self.ranges)

def test_dru():
	dru = DisjointRangeUnion()
	dru.add(0, 5)
	assert dru.count() == 5, dru
	dru.add(3, 8)
	assert dru.count() == 8, dru
	dru.add(20, 23)
	assert dru.count() == 8 + 3, dru
	dru.add(8, 20)
	assert dru.count() == 23, dru

def main():
	n = int(input())
	remainders = defaultdict(DisjointRangeUnion)
	for a in range(min(9, n + 1)):
		for b in range(min(49, n - a + 1)):
			value = 4 * a + 9 * b
			(begin, rem) = divmod(value, 49)
			end = begin + (n - a - b)
			remainders[rem].add(begin, end + 1)
	print(sum((ranges.count() for ranges in remainders.values())))
main()


n = int(input())
s = set()
x = [1, 5, 10, 50]
l = list()

def dfs(a, b, c):
	if a == n:
		s.add(b)
		return
	while c < len(x):
		dfs(a + 1, b + x[c], c)
		c += 1
if n <= 10:
	dfs(0, 0, 0)
	print(len(s))
	return
else:
	print(244 + 49 * (n - 10) - 1)


import operator as op
from functools import reduce

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom
N = int(input())
ans = 0
for b in range(9):
	for c in range(9):
		if b + c > N or (b >= 5 and c >= 1):
			continue
		ans += ncr(N - b - c + 1, 1)
print(ans)


n = int(input())
N = 30
S = [set() for i in range(N)]
for i in range(N):
	for v in range(N):
		for x in range(N):
			for l in range(N):
				cnt = i + v + x + l
				if cnt < N:
					val = i + 5 * v + 10 * x + 50 * l
					S[cnt].add(val)
if n < 30:
	print(len(S[n]))
	exit(0)
ans = 0
for x in range(5):
	for v in range(1, 9):
		ans += n - x - v + 1
for x in range(9):
	ans += n - x + 1
print(ans)


arr = []
for i in range(1, 15):
	dict1 = {}
	for j in range(0, i + 1):
		for k in range(0, i + 1):
			for l in range(0, i + 1):
				if j + k + l <= i:
					z = j * 50 + k * 10 + l * 5 + (i - j - k - l)
					dict1[z] = 1
	arr.append(len(dict1))
n = int(input())
if n < 15:
	print(arr[n - 1])
else:
	print(arr[-1] + (n - 14) * 49)


def solve(n):
	s = set()
	for i in range(0, n + 1):
		for v in range(0, n - i + 1):
			for x in range(0, n - i - v + 1):
				l = n - i - v - x
				s.add(i + v * 5 + x * 10 + l * 50)
	return len(s)
n = int(input())
if n < 11:
	print(solve(n))
else:
	print(49 * n - 247)


n = int(input())
l = [int(1e+20) for i in range(49)]
r = [int(-1e+20) for i in range(49)]
ans = 0
for i in range(49):
	for j in range(49):
		t = (i * 10 + j * 5 + (n - i - j)) % 49
		l[t] = min(l[t], i * 10 + j * 5 + (n - i - j))
		r[t] = max(r[t], i * 10 + j * 5 + (n - i - j) * 50)
for i in range(49):
	ans += max(r[i] - l[i], -49) // 49 + 1
print(ans)


n = int(input())
if n < 20:
	q = []
	i = 0
	while i <= n:
		j = 0
		while j <= n - i:
			k = 0
			while k <= n - i - j:
				t = n - i - j - k
				q.append(i * 1 + j * 5 + k * 10 + t * 50)
				k = k + 1
			j = j + 1
		i = i + 1
	print(len(set(q)))
else:
	an = int((n + 1) * (n + 2) * (n + 3) // 6)
	st = int(856)
	diff = int(182)
	t = int(21)
	cnt = int(t + n - 20 - t + 1)
	su = int((diff + diff + t * (cnt - 1)) * cnt // 2 + (n - 20) * (n - 20 + 1) * (n - 20 + 2) // 6)
	st = st + su
	print(an - st)


def mi():
	return map(int, input().split())
n = list(mi())[0]
a = [4, 10, 20, 35, 56, 83, 116, 155, 198, 244, 292, 341]
if n >= 13:
	print((n - 11) * 49 + a[10])
else:
	print(a[n - 1])


def ceildiv(a, b):
	return -(-a // b)

def test_ceildiv():
	assert ceildiv(6, 3) == 2
	assert ceildiv(7, 3) == 3
	assert ceildiv(5, 3) == 2

def brute_force(n, m):
	numbers = set()
	max_c = min(n, m // 49)
	for c in range(max_c + 1):
		_49c = 49 * c
		max_b = min(n - c, (m - _49c) // 9, 48)
		for b in range(max_b + 1):
			_9b_49c = 9 * b + _49c
			max_a = min(n - b - c, (m - _9b_49c) // 4, 8)
			for a in range(max_a + 1):
				numbers.add(4 * a + _9b_49c)
	assert 0 in numbers
	for x in (4, 9, 49):
		if m // x <= n:
			assert m - m % 49 in numbers
	return len(numbers)

def brute_force_range(n, l, u):
	numbers = set()
	min_c = max(0, ceildiv(l - 9 * n, 40))
	max_c = min(n, u // 49)
	for c in range(min_c, max_c + 1):
		_49c = 49 * c
		min_b = max(0, ceildiv(l - 4 * n - 45 * c, 5))
		max_b = min(n - c, (u - _49c) // 9, 48)
		for b in range(min_b, max_b + 1):
			_9b_49c = 9 * b + _49c
			min_a = max(0, ceildiv(l - _9b_49c, 4))
			max_a = min(n - b - c, (u - _9b_49c) // 4, 8)
			for a in range(min_a, max_a + 1):
				numbers.add(4 * a + _9b_49c)
	if numbers:
		assert min(numbers) >= l
		assert max(numbers) <= u
	return len(numbers)

def test_brute_force_range():
	for (u, l) in ((60, 80), (104, 599), (200, 777)):
		for n in (10, 13, 15, 17, 20):
			assert brute_force_range(n, u, l) == brute_force(n, l) - brute_force(n, u - 1)
X = 12
Y = 24

def solid_interval(n):
	assert n >= X
	return (Y, 49 * (n - X) + Y + 49)

def test_solid_interval():
	for n in (X, X + 1, 100, 200, 300, 1000, 5000):
		(begin, end) = solid_interval(n)
		assert brute_force_range(n, begin, end - 1) == end - begin

def main():
	n = int(input())
	if n < X:
		result = brute_force(n, 49 * n)
	else:
		(begin, end) = solid_interval(n)
		assert begin < end < 49 * n
		result = sum((brute_force_range(n, 0, begin - 1), end - begin, brute_force_range(n, end, 49 * n)))
	print(result)
main()


n = int(input())
N = [0, 4, 10, 20, 35, 56, 83, 116, 155, 198, 244, 292, 341]
if n < 13:
	print(N[n])
else:
	print(N[12] + 49 * (n - 12))


from itertools import combinations, permutations
from collections import defaultdict

def zeror():
	return 0

def solution(n):
	sol = []
	for i in range(n + 1):
		for v in range(n + 1):
			for x in range(n + 1):
				for l in range(n + 1):
					if i + v + x + l == n:
						sol.append(i + v * 5 + x * 10 + l * 50)
	return len(set(sol))

def main():
	n = int(input())
	if n <= 11:
		print(solution(n))
	else:
		print(solution(11) + (n - 11) * 49)
main()


def foo(n):
	return (n + 3) * (n + 2) * (n + 1) // 6
n = int(input())
ans = foo(n)
if n >= 6:
	ans -= foo(n - 6)
if n >= 9:
	ans -= foo(n - 9) * 2
if n >= 10:
	ans += foo(n - 10)
if n >= 14:
	ans += foo(n - 14)
print(ans)


def c(n):
	ans = 0
	if n > 15:
		ans += 49 * (n - 15)
		n = 15
	l = set()
	for i in range(max(n + 1, 441)):
		for j in range(max(n - i + 1, 196)):
			for k in range(n - i - j + 1):
				l.add(i * 4 + j * 9 + k * 49)
	return ans + len(l)
n = int(input())
print(c(n))


n = int(input())
if n > 20:
	print(733 + (n - 20) * 49)
else:
	s = set()
	for i in range(n + 1):
		for v in range(n - i + 1):
			for x in range(n - i - v + 1):
				l = n - i - v - x
				s.add(i + 5 * v + 10 * x + 50 * l)
	print(len(s))


import sys
n = int(input())
res = 0
for V in range(1, min(n, 8) + 1):
	for X in range(min(n - V, 4) + 1):
		res += n + 1 - V - X
for X in range(min(n, 8) + 1):
	res += n + 1 - X
print(res)


n = int(input())
a = [0, 4, 10, 20, 35, 56, 83, 116, 155, 198, 244, 292]
print(max(49 * n - 247, a[n % 12]))


n = int(input())
ans = 0
for i in range(9):
	for j in range(49):

		def check(y, x):
			for i in range(49):
				for j in range(9):
					if i == x and j == y:
						continue
					t = (x - i) * 9 + (y - j) * 4
					if t >= 0 and t % 49 == 0:
						return False
			return True
		if n - i - j >= 0 and check(i, j):
			ans += n - i - j + 1
print(ans)


n = int(input().strip())
R1 = [4, 9, 49]

def get_after_slow(k, T=0):
	dp = [k + 1 for _ in range(49 * k + 1)]
	dp[0] = 0
	for i in range(1, 49 * k + 1):
		for R in R1:
			if i >= R:
				dp[i] = min(dp[i], dp[i - R] + 1)
	return len(dp) - T - dp[T:].count(k + 1)

def get_fast(k):
	if k <= 20:
		return get_after_slow(k)
	else:
		return (k - 19) * 49 - 12 + get_after_slow(20, 49)
print(get_fast(n))


import sys
input = sys.stdin.readline
n = int(input())
dp = [0] * 150
s = set([0])
for i in range(150):
	dp[i] = len(s)
	s2 = set(s)
	for j in s:
		s2.add(j + 4)
		s2.add(j + 9)
		s2.add(j + 49)
	s = s2
if 0:
	for i in range(100):
		if dp[i + 49] - dp[i] != 2401:
			print(i)
if n < 150:
	print(dp[n])
else:
	stuff = n // 49
	while n - stuff * 49 + 49 < 150:
		stuff -= 1
	print(dp[n - stuff * 49] + 2401 * stuff)


from sys import setrecursionlimit
setrecursionlimit(10 ** 9)
n = int(input())
s = set()
arr = [1, 5, 10, 50]

def comb(num, digit):
	global n
	if digit == n:
		s.add(num)
	else:
		for i in range(4):
			comb(num + arr[i], digit + 1)
if n <= 12:
	comb(0, 0)
	print(len(s))
else:
	print(49 * n - 247)


n = int(input())
l = [1, 3, 6, 10, 15, 21, 27, 33, 39, 43, 46, 48]
if n < 12:
	print(sum(l[:n + 1]))
else:
	print(sum(l) + 49 * (n - 11))


(lst, m) = ([0, 4, 10, 20, 35, 56, 83, 116, 155, 198, 244], 292)
n = int(input())
if n <= 10:
	print(lst[n])
else:
	print(m + (n - 11) * 49)


n = int(input())
ans = 0
for v in range(0, 9):
	for x in range(0, 49):
		if n < v + x:
			continue
		wrong = 0
		for vv in range(0, 9):
			for xx in range(0, 49):
				if n < vv + xx or (vv == v and x == xx):
					continue
				if (v * 4 + x * 9) % 49 == (vv * 4 + xx * 9) % 49 and (v * 4 + x * 9 > vv * 4 + xx * 9 or (v * 4 + x * 9 == vv * 4 + xx * 9 and v > vv)):
					wrong = 1
		if wrong == 0:
			ans += n - v - x + 1
print(ans)


from itertools import combinations_with_replacement as cwr

def compute_lt12(n):
	chars = 'IVXL'
	nums = [1, 5, 10, 50]
	num_map = {c: n for (c, n) in zip(chars, nums)}
	sum_set = set()
	for comb in cwr(chars, n):
		sum_set.add(sum((num_map[c] for c in comb)))
	return len(sum_set)

def main():
	n = int(input())
	if n < 12:
		print(compute_lt12(n))
	else:
		print(292 + 49 * (n - 11))
main()


a = [4, 10, 20, 35, 56, 83, 116, 155, 198, 244, 292]
digits = input()

def result(digits):
	if int(digits) <= 11:
		return a[int(digits) - 1]
	return a[10] + (int(digits) - 11) * 49
print(result(digits))


n = int(input())
ans = [1, 4, 10, 20, 35, 56, 83, 116, 155, 198, 244, 292, 341]
if n <= 12:
	print(ans[n])
else:
	print(49 * n - 247)


import itertools
STC = [[0, 4, 0, 5], [1, 0, 8, 0], [1, 0, 0, 5]]

def ch(N, K):
	ans = 1
	for k in range(K):
		ans *= N - k
	for k in range(K):
		ans //= k + 1
	return ans
N = int(input())
ans = ch(N + 3, 3)
sgn = -1
for s in range(1, len(STC) + 1):
	for cb in itertools.combinations(STC, s):
		aq = [0, 0, 0, 0]
		for c in cb:
			for i in range(4):
				aq[i] = max(aq[i], c[i])
		tot = sum(aq)
		if N >= tot:
			ans += sgn * ch(N - tot + 3, 3)
	sgn *= -1
print(ans)


n = int(input())
ans = 0
kol = 0
ma = 0
if n > 20:
	ma = (n - 10) * 50
	mi = n - 10 + 10 * 50
	ans = ma - mi + 1
	kol = n - 20
	n = 20
a = set()
for i in range(n + 1):
	for j in range(n - i + 1):
		for u in range(n - i - j + 1):
			z = n - i - j - u
			ch = i + j * 5 + u * 10 + z * 50 + kol * 50
			if ch not in a and ch > ma:
				ans += 1
				a.add(ch)
if ma != 0:
	for i in range(n + 1):
		for j in range(n - i + 1):
			for u in range(n - i - j + 1):
				z = n - i - j - u
				ch = i + j * 5 + u * 10 + z * 50 + kol
				if ch not in a and ch < mi:
					ans += 1
					a.add(ch)
print(ans)


def check(n, b, c):
	for tb in range(0, 9):
		for tc in range(0, min(n - tb + 1, 9)):
			s1 = 9 * b + 4 * c
			s2 = 9 * tb + 4 * tc
			if s1 > s2 and (s1 - s2) % 49 == 0:
				return False
	return True

def main():
	n = int(input())
	ans = 0
	for b in range(0, min(n + 1, 9)):
		for c in range(0, min(n - b + 1, 9)):
			if check(n, b, c):
				ans += n - b - c + 1
	print(ans)
exit(main())


n = int(input())
if n < 12:
	print([1, 4, 10, 20, 35, 56, 83, 116, 155, 198, 244, 292][n])
else:
	print(n * 50 - n - 247)