using System;
using System.Collections.Generic;
class Program
{
static string InputPattern = "Input1";
static List<string> GetInputList()
{
var WillReturn = new List<string>();
if (InputPattern == "Input1") {
WillReturn.Add("1");
//3
//1以上10以下で、3の倍数および3の付く数は、3, 6, 9の3個です。
}
else if (InputPattern == "Input2") {
WillReturn.Add("2");
//45
//1以上100以下で、3の倍数および3の付く数は、
// 3, 6, 9,12,13,15,18,21,23,24,
//27,30,31,32,33,34,35,36,37,38,
//39,42,43,45,48,51,53,54,57,60,
//63,66,69,72,73,75,78,81,83,84,
//87,90,93,96,99の45個です。
}
else if (InputPattern == "Input3") {
WillReturn.Add("19");
//9099432188218005273
}
else {
string wkStr;
while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
}
return WillReturn;
}
static void Main()
{
List<string> InputList = GetInputList();
int P = int.Parse(InputList[0]);
//場合の数[3を法とした余り,3の有無]なDP表
long[,] PrevDP = new long[3, 2];
PrevDP[0, 0] = 1;
for (int I = 1; I <= P; I++) {
long[,] CurrDP = new long[3, 2];
for (int J = 0; J <= PrevDP.GetUpperBound(0); J++) {
for (int K = 0; K <= PrevDP.GetUpperBound(1); K++) {
if (PrevDP[J, K] == 0) continue;
for (int NewNum = 0; NewNum <= 9; NewNum++) {
int NewJ = (J + NewNum) % 3;
int NewK = K;
if (NewNum == 3) NewK = 1;
CurrDP[NewJ, NewK] += PrevDP[J, K];
}
}
}
PrevDP = CurrDP;
}
long Answer = 0;
for (int I = 0; I <= PrevDP.GetUpperBound(0); I++) {
for (int J = 0; J <= PrevDP.GetUpperBound(1); J++) {
if (I == 0 || J == 1) Answer += PrevDP[I, J];
}
}
Answer--; //0の分
Console.WriteLine(Answer);
}
}