Problem:


Sum of 4 Integers

Write a program which reads an integer n  and identifies the number of combinations of a, b, c and d (0 ≤ a, b, c, d ≤ 9) which meet the following equality:

a + b + c + d = n

For example, for n = 35, we have 4 different combinations of (a, b, c, d): (8, 9, 9, 9), (9, 8, 9, 9), (9, 9, 8, 9), and (9, 9, 9, 8).

Input

The input consists of several datasets. Each dataset consists of n (1 ≤ n ≤ 50) in a line. The number of datasets is less than or equal to 50.

Output

Print the number of combination in a line.

Sample Input

35
1

Output for the Sample Input

4
4



Sample input:
35
1


Sample output:
4
4

Submission status: Runtime Error

Solution code:
import sys

a=[]

for i in sys.stdin:
	a.append(i)

for i in a:
	count=0
	for j in range(10):
		if j<=i and i-j<=27:
			for k in range(10):
				if k<=i-j and i-j-k<=18:
					if i-j-k<=9:
						count+=i-j-k+1
					else:
						count+=19-i+j+k
	print count

Submission status: Runtime Error

Solution code:
import sys

a = []
for line in sys.stdin:
    a.append(line)

for i in a:
	count=0
	for j in range(10):
		if j<=i and i-j<=27:
			for k in range(10):
				if k<=i-j and i-j-k<=18:
					if i-j-k<=9:
						count+=i-j-k+1
					else:
						count+=19-i+j+k
	print count

Submission status: Runtime Error

Solution code:
import sys
c = [0 for i in range(37)]
for i in range(10):
    for j in range(10):
        for k in range(10):
            for l in range(10):
                c[i+j+k+l] += 1
for line in sys.stdin:
    print(c[int(line)])

Submission status: Runtime Error

Solution code:
import sys
c = [0 for i in range(37)]
for i in range(10):
    for j in range(10):
        for k in range(10):
            for l in range(10):
                t = i + j + k + l
                c[t] += 1
for line in sys.stdin:
    print(c[int(line)])

Submission status: Runtime Error

Solution code:
import sys
c = [0 for i in range(37)]
for i in range(10):
    for j in range(10):
        for k in range(10):
            for l in range(10):
                c[i+j+k+l] += 1
for line in sys.stdin:
    n = int(line)
    print(c[n])

Submission status: Runtime Error

Solution code:
import sys
import math

def case(a,b):
	return math.factorial(a+b)/(math.factorial(a)*math.factorial(b))

while True:
	try:
		if n >= 37:
			print('0')
		elif n >= 10 and n <= 36:
			print(case(n,4)-case(n-10,3))
		else:
			print(case(n,4))		
	except EOFError:
		break

Submission status: Runtime Error

Solution code:
import sys
for e in sys.stdin:
 e=int(e);x=range(10);ff=0
ff+=1 for a in x for b in x for c in x for d in x if a+b+c+d==e
print (ff)

Submission status: Runtime Error

Solution code:
import sys
a=[0]*51
for i in range(51):
 a[i]=sum([1 for a in x for b in x for c in x for d in x if a+b+c+d==e]))
for e in sys.stdin:
 print(a[int(e)])

Submission status: Runtime Error

Solution code:
for line in sys.stdin:
    ans = 0
    n = int(line)
    for a in range(10):
        for b in range(10):
            for c in range(10):
                if 0 <= n-a-b-c <= 9:
                    ans += 1
    print(ans)

Submission status: Runtime Error

Solution code:
ans = []
for line in sys.stdin:
    answ = 0
    n = int(line)
    for a in range(10):
        for b in range(10):
            for c in range(10):
                if 0 <= n-a-b-c <= 9:
                    answ += 1
    ans.append(answ)
for i in ans:
    print(i)

Submission status: Runtime Error

Solution code:
ans = []
for line in sys.stdin:
    answ = 0
    try:
        n = int(line)
    except:
        break
    for a in range(10):
        for b in range(10):
            for c in range(10):
                if 0 <= n-a-b-c <= 9:
                    answ += 1
    ans.append(answ)
print(*ans,sep="\n")

Submission status: Runtime Error

Solution code:
import itertools
while True:
	try: n=int(input())
	except EOEError: break
	ans=0
	for (i,j,k) in itertools.product(range(10),range(10),range(10)):
		ans+=(0<=n-(i+j+k)<=9)
	print(ans)

Submission status: Runtime Error

Solution code:
lst=[0 for i in range(50)]
for a in range(10):
    for b in range(10):
        for c in range(10):
            for d in range(10):
                lst[a+b+c+d] += 1
while i:
    try:
        print(lst[int(input())])
    except:
        break

Submission status: Runtime Error

Solution code:
import sys
[print([670, 660, 633, 592, 540, 480, 415, 348, 282, 220, 165, 120, 84, 56, 35, 20, 10, 4, 1][abs(18 - int(e))]) for e in sys.stdin]

Submission status: Runtime Error

Solution code:
while 1:
    n = int(raw_input())
    cnt = 0;
    for i in range(0, 10):
        for j in range(0, 10):
            for k in range(0, 10):
                for l in range(0, 10):
                    if n == i+j+k+l: cnt+=1
    print cnt

Submission status: Runtime Error

Solution code:
def keta_sum(n):
	a = int(n*0.001)
	b = int(n*0.01) % 10
	c = int(n*0.1) % 10
	d = n % 10
	return a+b+c+d

while 2>1:
	n_try = int(raw_input())
	count = 0
	for n in range(10000):
		if n_try == keta_sum(n):
			count += 1
	print count

Submission status: Runtime Error

Solution code:


while True:
    try:
        x = int(raw_input())
        
        
        count = 0
        for a in range(10):
            for b in range(10):
                for c in range(10):
                    for d in range(10):
                        if a+b+c+d == x :
                            count += 1
        
        print count

    except ValueError:
        break

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python
# coding: utf-8


def count_pattern(i):
    n = 0
    for a in xrange(10):
        for b in xrange(10):
            for c in xrange(10):
                for d in xrange(10):
                    if (a + b + c + d) == i:
                        n += 1
    return n


def main():
    while 1:
        s = raw_input()
        if s == "":
            return
        print count_pattern(int(s))


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import itertools

while True:
    n = int(raw_input())
    c = 0
    for a in itertools.product(range(10), repeat=4):
        if sum(a) == n:
            c += 1
    print c

Submission status: Runtime Error

Solution code:
while 1:
	try:
		n = input()
		x = 0
		if n < 37:
			for a in range(10):
				for b in range(10):
					for c in range(10):
						for d in range(10):
							if a + b + c + d == n:
								c += 1
			print c
		except EOFError:
			break

Submission status: Runtime Error

Solution code:
while 1:
	try:
		n = input()
		x = 0
		if n < 37:
			for a in range(10):
				for b in range(10):
					for c in range(10):
						for d in range(10):
							if a + b + c + d == n:
								x += 1
			print x
		except EOFError:
			break

Submission status: Runtime Error

Solution code:
while True:
    try:
        n = int(raw_input())
        count = 0
        for i in range(10):
           for j in range(10):
                for k in range(10):
                    for l in range(10):
                         if i+j+k+l == n:
                         count += 1
        print count
    except:
        break

Submission status: Runtime Error

Solution code:
import sys
for n in sys.stdin: print len([None for a in range(10) for b in range(10) for c in range(10) for d in range(10) if a+b+c+d == N])

Submission status: Runtime Error

Solution code:
import itertools
s,ans=range(0,10),0
chk=list(itertools.combinations_with_replacement(s,4))
for j in sys.stdin:
    for k in chk:
        if sum(k)==int(j):
            ans+=1
    print ans

Submission status: Runtime Error

Solution code:
import itertools
s=range(0,10)
chk=list(itertools.product(s,repeat=4))
for j in sys.stdin:
    ans=0
    for k in chk:
        if sum(k)==int(j):
            ans+=1
    print ans

Submission status: Runtime Error

Solution code:
while True:
	ans = 0
	n = int(raw_input())
	for i in xrange(10):
		for j in xrange(10):
			for k in xrange(10):
				for l in xrange(10):
					if i+j+k+l == n:
						ans += 1
	print ans