# pans-q11
# Sections 11-16, Q.11. p.55-56, p.257

a = [1, 3, 4, 27]   # or replace 4 by 9
m = sum(a)
c = [0]*(m+1)
for x0 in range(3):
  for x1 in range(3):
    for x2 in range(3):
      for x3 in range(3):
        sum =  a[0]*(x0-1) + a[1]*(x1-1) + \
               a[2]*(x2-1) + a[3]*(x3-1)
        if sum >= 0:
          c[sum] += 1
print(*c, sep='')
