# 51Nod 1048 1383 整数分解为2的幂

7=1+1+1+1+1+1+1
=1+1+1+1+1+2
=1+1+1+2+2
=1+2+2+2
=1+1+1+4
=1+2+4

 1 import java.util.*;
2 import java.math.*;
3
4 public class Main {
5     public static void main(String[] args) {
6         Scanner in = new Scanner(System.in);
7
8         BigInteger N = in.nextBigInteger();
9
10         BigInteger F[][] = new BigInteger[125][125];
11         BigInteger G[][] = new BigInteger[125][125];
12
13         for (int i = 0; i <= 120; ++i)
14             for (int j = 0; j <= 120; ++j) {
15                 F[i][j] = BigInteger.ZERO;
16                 G[i][j] = BigInteger.ZERO;
17             }
18
19         F[0][0] = BigInteger.ONE;
20
21         for (int i = 1; i <= 120; ++i) {
22             F[i][i] = BigInteger.ONE;
23
24             for (int j = 0; j < i; ++j)
25                 for (int k = 0; k <= j; ++k)
26                     F[i][j] = F[i][j].add(F[i - 1][k].multiply(F[i - k - 1][j - k]));
27         }
28
29         int tot = 0;
30
32
33         for (int i = 0; i <= 120; ++i) {
34             if (N.mod(TWO).toString().charAt(0) == '1') {
35                 if (++tot == 1) {
36                     for (int j = 0; j <= i; ++j)
37                         G[tot][j] = F[i][j];
38                 }
39                 else {
40                     for (int j = 0; j <= i; ++j)
41                         for (int k = 0; k <= j; ++k)
42                             G[tot][j] = G[tot][j].add(G[tot - 1][k].multiply(F[i - k][j - k]));
43                 }
44             }
45
46             N = N.divide(TWO);
47         }
48
49         BigInteger ANS = BigInteger.ZERO;
50
51         for (int i = 0; i <= 120; ++i)
56 }