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 Ruby (judge verdict: Accepted)

@ptn = 0

# n:検索対象, previn:呼出元メソッドで選出された数値, sum:合計値, d:探索深さ
def sum4Integers(n, previn=0, sum=0, d=1, hist=[])
  (previn..9).each do |i|
    #p "n:#{n}, previn:#{previn}, sum:#{sum}, d:#{d}, i:#{i}, #{hist}"
    return if sum > n || i > n # 合計値or候補番号が検索対象値を上回ったら検索打ち切り
    if d != 4 then
      sum4Integers(n, i, sum+i, d+1, hist+[i])
    elsif (d == 4) && (sum+i == n) then     
      hist += [i]
      facttimes = 1
      hist.uniq.each do |num|
        facttimes *= fact(hist.count(num))
      end
      @ptn += fact(4)/facttimes
      return
    end
  end
end

# 階乗計算
def fact(n)
  n == 1 ? 1 : n*fact(n-1)
end

while n = gets
  n = n.chomp.to_i
  @ptn = 0
  sum4Integers(n)
  p @ptn
end