#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned long long ull; int main() { ull p; scanf("%llu", &p); ull dp1[p][9*p+1], dp2[2][p][9*p+1]; memset(dp1, 0, sizeof(dp1)); memset(dp2, 0, sizeof(dp2)); for (int i = 0; i < 10; i++) { if (i == 3) continue; dp1[0][i] = 1; dp2[0][0][i] = 1; } dp2[1][0][3] = 1; for (int i = 1; i < p; i++) { for (int j = 0; j < 9*p+1; j++) { for (int k = 0; k < 10 && j+k < 9*p+1; k++) { if (k == 3) continue; dp1[i][j+k] += dp1[i-1][j]; dp2[1][i][j+k] += dp2[1][i-1][j]; dp2[0][i][j+k] += dp2[0][i-1][j]; } dp2[1][i][j+3] += dp2[1][i-1][j]+dp2[0][i-1][j]; } } ull sum = 0; for (int i = 3; i < 9*p+1; i+=3) { sum += dp1[p-1][i]; } for (int i = 0; i < 9*p+1; i++) { sum += dp2[1][p-1][i]; } printf("%llu\n", sum); }