maxx = 99

a = [1] * maxx
for i in xrange(1, maxx, 3):
  a[i] = ((i - 1) / 3 + 1) * 2

a.reverse()


x = [0, 1]
n = 0
for i in a:
  x[n % 2] += i * x[(n + 1) % 2]
  n += 1

x[n % 2] += 2 * x[(n + 1) % 2]

def sum(x):
  out = 0
  while x != 0:
    out += x %10
    x /= 10
  return out

print sum(x[n % 2])