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 C# (judge verdict: Wrong Answer)

using System;
using System.Collections.Generic;
using System.Linq;

class SumOf4Integers 
{
    static void Main()
    {
        var q =
            from n in GetProblems().Select( int.Parse )
            select CountCombination( n ) + "\n";
        Console.WriteLine( new string( q.SelectMany( _ => _ ).ToArray() ) );
    }

    static IEnumerable<string> GetProblems()
    {
        var buffer = "";
        while ( !string.IsNullOrEmpty( buffer = Console.ReadLine() ) )
            yield return buffer;
    }

    static int CountCombination(int n)
    {
        if ( n > 36 )
            return 0;
        if ( n > 18 )
            n = 36 - n;

        int d, r;
        d = Math.DivRem( n, 9, out r );
        var abcd = Enumerable.Repeat( 9, d )
            .Concat( Enumerable.Repeat( 0, 4 - d ) )
            .ToArray();
        abcd[d] = r;

        int index, c = 0;
        while ( true )
        {
            var numbers = new int[10];
            foreach ( var v in abcd ) 
                ++numbers[v];

            c += CountPermutation( numbers );

            for ( index = 4; --index > 0 && abcd[index - 1] < abcd[index] + 2; );
            if ( index < 1 )
                return c;
            --abcd[index - 1];
            ++abcd[index];
        }
    }

    static readonly int[] factorials = new[] { 1, 1, 2, 6, 24 };
    static int CountPermutation(IEnumerable<int> multiplicities)
    {
        int p = factorials[4];
        return multiplicities
            .Select( m => p /= factorials[m] )
            .Last();
    }
}