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 in JAVA (judge verdict: Wrong Answer)

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;


public class Main {
	private	static	BufferedReader br = null;

	static {
		br = new BufferedReader(new InputStreamReader(System.in));
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		String line = null;

		while((line = parseNum()) != null) {
			int nCnt = calc(line);
			System.out.println(nCnt);
		}
	}

	private static String parseNum() {
		String	strNum = null;

		try {
			String line = br.readLine();
			if (line != null) {
				if (!line.isEmpty()) {
					strNum = line;
				}
			}
		}
		catch (IOException e) {}

		return strNum;
	}

	private static int calc(String str) {
		int	nCnt = 0;
		try {
			int	nNum = Integer.parseInt(str);

			if (nNum <= 36) {
				for(int n1 = 0; n1 < 10; n1++) {
					if (n1 > nNum) {
						break;
					}
					for(int n2 = n1; n2 < 10; n2++) {
						if (n1 + n2 > nNum) {
							break;
						}
						for(int n3 = n2; n3 < 10; n3++) {
							if (n1 + n2 + n3 > nNum) {
								break;
							}
							for(int n4 = n3; n4 < 10; n4++) {
								if (n1 + n2 + n3 + n4 == nNum) {
									nCnt += getCnt(n1, n2, n3, n4);
								}
								else if (n1 + n2 + n3 + n4 > nNum) {
									break;
								}
							}
						}
					}
				}
			}
		}
		catch (NumberFormatException e) {}

		return nCnt;
	}

	private static int getCnt(int n1, int n2, int n3, int n4) {
		int		nCnt = 0;
		int		nM   = 1;
		int[]	aNum = new int[4];

		aNum[0] = n1;
		aNum[1] = n2;
		aNum[2] = n3;
		aNum[3] = n4;
		Arrays.sort(aNum);

		for(int nLoop = aNum.length - 1; nLoop > 0; nLoop--) {
			nM += (aNum[nLoop] != aNum[nLoop-1]) ? 0 : 1;
		}
		nCnt = fact(aNum.length) / (fact(nM) * fact(aNum.length - nM));

		return nCnt;
	}

	private static int fact(int x) {
		int nFact = 1;

		for (int nLoop = 1; nLoop <= x; nLoop++) {
			nFact = nFact * nLoop;
		}

		return nFact;
	}
}