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

Solution (Python):
try:
    while True:
        
        num = int(input())
        kei = 0
        
        for num1 in range(0,10):
            for num2 in range(0,10):
                for num3 in range(0,10):
                    for num4 in range(0,10):
                        
                        if num1 + num2 + num3 + num4 == num:kei += 1
                        else:pass
        
        print(kei)

except EOFError:
    pass

Solution (Python):
for line in open(0).readlines():
    N = int(line)
    lim = min(9, N)
    ans = 0
    if 0 <= N <= 36:
        for a in range(0, lim+1):
            for b in range(0, lim+1):
                for c in range(0, lim+1):
                    d = N - a - b - c
                    if 0 <= d <= lim:
                        ans += 1
    print(ans)

Solution (Python):

while True:
    try:
        count=0
        num = int(input())
        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 ==num:
                            count+=1
        print(count)
    except EOFError:
        break

Solution (Python):
while 1:
  try:
    n = int(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 == n:
              count += 1
    print(count)
  except EOFError:
    break

Solution (Python):
while True:
    try:
        cnt =0
        a = int(input())
        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 == a:
                            cnt += 1
        print(cnt)
    except:
        break

Solution (Python):
while True:
    try:
        count = 0
        n = int(input())
        for a in range(10):
            for b in range(10):
                for c in range(10):
                    d = n - a - b - c
                    if (d >= 0 and d <= 9):
                        count += 1
        print(count)
    except EOFError:
        break

Solution (Python):
import itertools

try:
    while True:
        n = int(input())
        
        count = 0
        for a, b, c, d in itertools.product(range(10), repeat=4):
            if a + b + c + d == n:
                count += 1

        print(count)

except Exception as _:
    pass

Solution (Python):
while True:
    try:
        i = 0
        a = list(map(int,input().split()))
        for x in range(10):
            for y in range(10):
                for z in range(10):
                    for s in range(10):
                        if a[0]==(x+y+z+s):
                            i = i+1
                        else:
                            pass
        print(i)
    except EOFError:
        break

Solution (Python):
output = 0
try:
    while True:
        n = int(input())
        a = 0
        while a < 10 :
            b = 0
            while b < 10 :
                c = 0
                while c < 10 :
                    d = 0
                    while d < 10 :
                        if a + b + c + d == n :
                            output += 1
                        d += 1
                    c += 1
                b += 1
            a += 1
        print(output)
        output = 0
except EOFError:
    pass

Solution (Python):
while 1:
    try:
        n = int(input())
    except:break
    ans = 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 i + j + k + l == n:
                        ans += 1

    print(ans)

Solution (Python):
import sys
for line in sys.stdin:
    n = int(line)
    cnt = 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 == n:
                        cnt += 1;
    print(cnt)

Solution (Python):
import sys; print("\n".join(str(sum(1 for n in [int(in_n)] for a in range(10) for b in range(a, a+10) for c in range(b, b+10) for d in range(c, c+10) if d == n)) for in_n in sys.stdin))

Solution (Python):
while True :
    try :
        n = int(input())
        
    except :
        break
    
    S = [(0, 0, 0, 0) for i in range(10000)]
    s = 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 == n) :
                        S[s] = (a, b, c, d)
                        s += 1
                    else :
                        pass
        
    S = set(S)
        
    print(len(S) - 1)

Solution (Python):
from itertools import product

while True:
    try:
        total = int(input())
        c = 0
        for t in product(range(10),repeat=4):
            if total == sum(t):
                c += 1
        print(c)

    except:
        break

Solution (Python):
while True:
    try:
        n = int(input())
        num = 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 == n):
                            num += 1
        print(num)
    except EOFError:
        break

Solution (Python):
while 1:
    try:
        count = 0
        n = int(input())
        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:
                            count += 1
        print(count)
    except:
        break

Solution (Python):
import sys
try:
    while True:
        n = int(input())
        
        res = 0
        
        for i in range(10):
            for j in range(10):
                for k in range(10):
                    for m in range(10):
                        if i + j + k + m == n:
                            res += 1
        
        print(res)
except Exception:
    sys.exit()

Solution (Python):
a = [0 for i in range(51)]
for i in range(10):
  for j in range(10):
    for k in range(10):
      for l in range(10):
        a[i + j + k + l] += 1
while True:
  try:
    n = int(input())
    print(a[n])
    
  except EOFError:
    break

Solution (Python):
e=[0]*51
for a in range(10):
  for b in range(10):
    for c in range(10):
      for d in range(10):
        e[sum([a,b,c,d])]+=1
while 1:
  try:
    print(e[int(input())])
  except:
    break

Solution (Python):
ans = [0 for i in range(51)]
for i in range(10):
    for j in range(10):
        for k in range(10):
            for l in range(10):
                ans[i+j+k+l] += 1


     
while True:
    try:
        print(ans[int(input())])
    except EOFError:
        break

Solution (Python):
while True:
  try:
    n = int(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==n:
              count += 1
    print(count)
  except EOFError:
    break

Solution (Python):
import sys
r = range(10)
for l in sys.stdin: print(len([[a,b,c,d]for a in r for b in r for c in r for d in r if a+b+c+d==int(l)]))

Solution (Python):
import itertools
try:
    while(True):
        n = int(input())
        cnt = 0
        rng = range(10)
        for i,j,k,l in itertools.product(rng,rng,rng,rng):
            if i + j + k + l == n:
                cnt = cnt + 1
        print(cnt)
except:
    pass

Solution (Python):

while True:
 try:
   n = int(input())
   ans =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==n:
             ans=ans+1
   print(ans)
 except:
   break

Solution (Python):
while True:
  try:
    n = int(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 == n:
              count += 1
    print(count)
  except EOFError:
    break

Solution (Python):
while True:
  try:
    n = int(input())
    ans =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==n:
              ans=ans+1
    print(ans)
  except:
    break

Solution (Python):
while True:
    try:
        n=int(input())
    except:
        break
    cnt=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:
                        cnt+=1
    print(cnt)

Solution (Python):
import itertools
import sys
com = [0] * 51
r10 = range(10)
for a,b,c,d in itertools.product(r10,r10,r10,r10):
    com[a+b+c+d] += 1
for line in sys.stdin.readlines():
    print(com[int(line)])

Solution (Python):
import sys

if __name__ == '__main__':

	for n in sys.stdin:
		cnt = 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 == int(n):
							cnt +=1

		print(cnt)

Solution (Python):
a = [0 for i in range(51)]
for i in range(10):
  for j in range(10):
    for k in range(10):
      for l in range(10):
        a[i + j + k + l] += 1
while True:
  try:
    n = int(input())
    print(a[n])
   
  except EOFError:
    break

Solution (Python):
while True:
    try:
        n = int(input())
        counter = 0

        for o in range(10):
            for p in range(10):
                for q in range(10):
                    for r in range(10):
                        if (o + p + q + r) == n:
                            counter = counter + 1

        print(counter)
    except:
        break

Solution (Python):
while True:
  try:
    n=int(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=count+1
    print(count)
    
  except EOFError:
    break

Solution (Python):
while True:
    try:
        inVal = int(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 == inVal:
                            count = count + 1
        print(count)
    except EOFError:
        break

Solution (Python):
import sys
for line in sys.stdin:
	n = int(line)
	cnt = 0
	for i in range(0, 10):
		for j in range(0, 10):
			for k in range(0, 10):
				for p in range(0, 10):
					if i+j+k+p == n:
						cnt += 1
						break
				if i+j+k == n: break
			if i+j == n: break
		if i == n: break
	print cnt

Solution (Python):
def wa(n):
    count=0
    for i in range(10):
        for j in range(10):
            for k in range(10):
                for l in range(10):
                    if n==i+j+k+l:
                        count +=1
                    elif n<i+j+k+l:
                        break
    return count
while True:
    try:
        n=int(input())
        print(wa(n))
    except:break

Solution (Python):
while True:
  counter = 0
  try:
    n = int(input())
  except EOFError:
    break
  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:
            counter += 1
  print(counter)

Solution (Python):
while 1:
    try:
        n=int(input())
        i=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==n:i+=1
        print(i)
    except:break

Solution (Python):
def calc(n, x):
    
    if n == 1:
        if x <= 9:
            return 1
        else:
            return 0
    else:
        num = 0
        for i in range(10):
            if x-i < 0:
                continue
            num += calc(n-1, x-i)
        return num


while True:
    try:
        print(calc(4, int(input())))
    except:
        exit(0)

Solution (Python):
try:
    while True:
        n=int(input())
        cnt=0
        for a,b,c,d in [(a,b,c,d) 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:
                cnt+=1
        print(cnt)
except EOFError:
    pass

Solution (Python):
if __name__ == '__main__':
    while True:
        try:
            n = int(input())
            counter = 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 == n:
                                counter += 1
            print(counter)
        except EOFError:
            break

Solution (Python):
import sys
  
n = [0]*51
for i in range(10):
    for j in range(10):
        for k in range(10):
            for l in range(10):
                n[i+j+k+l] += 1

for i in sys.stdin:
    print(n[int(i)])

Solution (Python):
def count(a):
	count = 0
	if a<=36:
		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==a:
							count +=1
	print(count)
while True:
	try:
		a=int(input())
		count(a)
	except EOFError:
		break

Solution (Python):
while True:
	try:
		n = int(input())
	except EOFError:
		break
	if n>36:
		print(0)
		continue
	ret=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==n:
						ret+=1
	print(ret)

Solution (Python):
while True:
  try:
    sum = int(input())
    result = 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 == sum:
              result+=1
    print(result)
  except EOFError:
    break

Solution (Python):
import sys
for line in sys.stdin:
    n = int(line)
    cnt = 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 == n:
                        cnt += 1;
    print(cnt)

Solution (Python):
import sys

def comb(n):
    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
                        continue
    return count


while True:
    line = sys.stdin.readline()
    if not line: break
    n = int(line.rstrip('\r\n'))
    print(comb(n))

Solution (Python):
def count(n):
    cnt = 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 == n:
                        cnt += 1
    print(cnt)

while True:
    try:
        n = int(input())
        count(n)
    except EOFError:
        break

Solution (Python):
while(1):
    try:
        n = int(input())
    except:
        break

    cnt = 0
    for a in range(10):
        for b in range(10):
            for c in range(10):
                d = n - a - b - c
                if 0 <= d < 10:
                    cnt += 1
    print(cnt)

Solution (Python):
import itertools

while True:
    try:
        n = int(input())
        ans = 0
        for val in itertools.product(range(10), repeat=4):
            if sum(val) == n:
                ans += 1
        print(ans)
    except:
        break

Solution (Python):
while(True):
    try:
        N = int(input())
        m = 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:
                            m += 1
        print(m)
    except:
        break

Solution (Python):
ans = []

while True :
    try :
        N = int(input())
        used = []

        cnt = 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 == N :
                            cnt += 1

        print(cnt)

    except :
        break

Solution (Python):
while True:
  try:
    n = int(input())
    results = []
    for i in range(10):
      for j in range(10):
        for k in range(10):
          for l in range(10):
            results.append( n == sum([i, j, k, l]) )
    print(len(list(filter(lambda x:x==True, results))))
  except:
    break

Solution (Python):
import sys

for line in sys.stdin:
    n = int(line)
    count = 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 i + j + k + l == n:
                        count += 1
    print(count)

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

Solution (Python):
ss = int(input())
r = 10
while 1:
	cnt = 0
	for a in range(r):
		for b in range(r):
			for c in range(r):
				for d in range(r):
					if a+b+c+d==ss: cnt+=1
	print(cnt)
	try: ss = int(input())
	except EOFError: break

Solution (Python):
while True:
	try:
		n = int(raw_input())
		judge = 0
		for i in range(10):
			for j in range(10):
				for k in range(10):
					if -1 < n - i - j - k < 10:
						judge += 1
		print judge
	except EOFError:
		break