Title: Sum of 4 Integers

Write a program that takes an integer 'n' as input and identifies the number of combinations of 'a, b, c, and d' (where 0 <= a, b, c, d <= 9) that satisfy the equation: a + b + c + d = n.

For example, if n = 35, there are 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 contains a value of n (1 <= n <= 50) on a separate line. The number of datasets is less than or equal to 50.

Output:
Print the number of combinations for each dataset on a separate line.

Sample Input:
35
1

Output for the Sample Input:
4
4

# Buggy version:
while(True):
    a = 0
    n = int(input())

    if n > 36:
        print(0)
        continue
    elif n==36:
        print(1)
        continue
    b = n
    for i in range(10):
        if n-i==0:
            a=a+1
            #print("(%d,0,0,0)"%(i))
            break
        for j in range(10):
            if n-i-j==0:
                a=a+1
                #print("(%d,%d,0,0)"%(i,j))
                break
            for k in range(10):
                b = n-i-j-k
                if b>=0 and b<=9:
                    a=a+1
                    #print("(%d,%d,%d,%d)"%(i,j,k,b))
                    continue
                elif b > 9:
                    continue
                else:
                    break
                    
    
    print(a)
return 0

# Fixed version:
while(True):
    a = 0
    try:
        n = input()
    except EOFError:
        break

    n=int(n)

    if n > 36:
        print(0)
        continue
    elif n==36:
        print(1)
        continue
    b = n
    for i in range(10):
        if n-i==0:
            a=a+1
            #print("(%d,0,0,0)"%(i))
            break
        for j in range(10):
            if n-i-j==0:
                a=a+1
                #print("(%d,%d,0,0)"%(i,j))
                break
            for k in range(10):
                b = n-i-j-k
                if b>=0 and b<=9:
                    a=a+1
                    #print("(%d,%d,%d,%d)"%(i,j,k,b))
                    continue
                elif b > 9:
                    continue
                else:
                    break


    print(a)

# Buggy version:

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

# Fixed version:

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

# Buggy version:
import itertools
def combination(n):
 m=0
 for i in itertools.product(range(10),repeat=4):
  (a,b,c,d)=i
  if a+b+c+d==n:
   m+=1
 return m

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

# Fixed version:
import itertools
def combination(n):
 m=0
 for i in itertools.product(range(10),repeat=4):
  (a,b,c,d)=i
  if a+b+c+d==n:
   m+=1
 return m

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

# Buggy version:

memo=[[-1]*51 for i in range(5)]
def rec(i,n):
    if memo[i][n]!=-1:
        return memo[i][n]
    memo[i][n]=0
    if i==4:
        return 1 if n==0 else 0
    for m in range(10):
        memo[i][n]+=rec(i+1,n-m)
    return memo[i][n]
    
while True:
    try:
        n=int(input())
        print(rec(0,n))
    except:
        break

# Fixed version:
memo=[[-1]*51 for i in range(5)]
def rec(i,n):
    if memo[i][n]!=-1:
        return memo[i][n]
    r=0
    if i==4:
        return 1 if n==0 else 0
    for m in range(10):
        r+=rec(i+1,n-m)
    memo[i][n]=r
    return r
     
while True:
    try:
        n=int(input())
        print(rec(0,n))
    except:
        break

# Buggy version:
import sys
values = []
for line in sys.stdin:
    values.append(int(line))
ans = [1 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]
print(ans.count(1))

# Fixed version:
import sys
values = []
for line in sys.stdin:
    values.append(int(line))
    
for v in values:
    ans = [1 for i in range(10) for j in range(10) for k in range(10) for l in range(10) if v == i + j + k + l]
    print(ans.count(1))

# Buggy version:
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)])


# Fixed version:
import sys
a=[0]*51;x=range(10)
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==i])
for e in sys.stdin:
 print(a[int(e)])

# Buggy version:
ans=[0]*51
for a in range(10):
	for b in range(10):
		for c in range(10):
			for d in range(10):
				ans[sum([a,b,c,d])] += 1 
while True:
	try:print(sum[int(imput())])
	except:break


# Fixed version:
ans=[0]*51
for a in range(10):
	for b in range(10):
		for c in range(10):
			for d in range(10):
				ans[sum([a,b,c,d])] += 1 
while True:
	try:print(ans[int(input())])
	except:break

# Buggy version:
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


# Fixed version:
lst=[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):
                lst[a+b+c+d] += 1
while 1:
    try:
        print(lst[int(input())])
    except:
        break

# Buggy version:
from itertools import product

while True:
    try:
        n = int(input)
    except:
        break
    count = sum(a + b + c + d == n for a, b, c, d in product(range(10), repeat=4))
    print(count)

# Fixed version:
from itertools import product

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

    count = sum(a+b+c+d == n for a, b, c, d in product(range(10), repeat=4))
    print(count)