program major;
const sys=100000000;
type dat=record
    v:array[1..1000] of longint;
    c:integer;
    end;

var a_old,b_old,c_old,a_new,b_new,c_new,a1,b1,c1,temp1,temp2:dat;
    n,i,j:longint;

procedure plus(var a,b,c:dat);
var x,i:longint;
begin
i:=1;
x:=0;
fillchar(c,sizeof(c),0);
while (i<=a.c) or (i<=b.c) do
      begin
      c.c:=i;
      c.v[i]:=(x+a.v[i]+b.v[i]) mod sys;
      x:=(x+a.v[i]+b.v[i]) div sys;
      i:=i+1;
      end;
if x>0
   then begin
        c.c:=c.c+1;
        c.v[c.c]:=x;
        end;
end;

procedure print(var a:dat);
var i,j,x:longint;
begin
write(a.v[a.c]);
for j:=a.c-1 downto 1 do
    begin
    x:=sys div 10;
    while (x>a.v[j]) and(x>0) do
          begin
          write(0);
          x:=x div 10;
          end;
    if a.v[j]>0
       then write(a.v[j]);
    end;
writeln;
end;

begin
readln(n);
a_old.c:=1;
a_old.v[1]:=3;
b_old.c:=1;
b_old.v[1]:=2;
c_old.c:=1;
c_old.v[1]:=1;
a_new.c:=1;
a_new.v[1]:=22;
b_new.c:=1;
b_new.v[1]:=10;
c_new.c:=1;
c_new.v[1]:=8;
for i:=3 to n do
    begin
    plus(b_new,b_new,temp1);
    plus(temp1,a_old,temp2);
    plus(temp2,a_new,temp1);
    plus(temp1,c_old,c1);

    plus(a_new,a_new,temp1);
    plus(temp1,a_old,temp2);
    plus(temp2,b_new,temp1);
    plus(temp1,b_old,temp2);
    plus(temp2,c_new,b1);

    plus(a_old,a_old,temp1);
    plus(temp1,a_old,temp2);
    plus(temp2,b_new,temp1);
    plus(temp1,b_new,temp2);
    plus(temp2,b1,temp1);
    plus(temp1,a_new,temp2);
    plus(temp2,b_new,temp1);
    plus(temp1,c_old,temp2);
    plus(temp2,b_old,a1);

    a_old:=a_new;
    b_old:=b_new;
    c_old:=c_new;
    a_new:=a1;
    b_new:=b1;
    c_new:=c1;
    end;
case  n of
   1: writeln(3);
   2: writeln(22);
   else print(a1);
   end;
end.
