type nr_mare=array[0..10000]of longint;
var v,x,s1,s2,p1,s,dp,fin,rez:nr_mare;
i,j,aux:longint;
c:char;
procedure div2(a:nr_mare;var b:nr_mare);
var i,r:longint;
begin
if a[a[0]]=1 then
begin
dec(a[0]);
a[a[0]]:=a[a[0]+1]*10+a[a[0]];
end;
b[0]:=a[0];
r:=0;
for i:=a[0] downto 1 do
begin
b[i]:=(r*10+a[i]) div 2;
r:=a[i] mod 2;
end;
end;
procedure mult(var a,b,c:nr_mare);
var i,j:longint;
begin
c[0]:=a[0]+b[0]-1;
for i:=1 to a[0] do
for j:=1 to b[0] do
c[i+j-1]:=a[i]*b[j];
for i:=1 to c[0]-1 do
begin
inc(c[i+1],c[i] div 10);
c[i]:=c[i] mod 10;
end;
while c[c[0]]>9 do
begin
c[c[0]+1]:=c[c[0]] div 10;
c[c[0]]:=c[c[0]] mod 10;
inc(c[0]);
end;
end;
procedure add(var a,b,c:nr_mare);
var i,j:longint;
begin
c[0]:=a[0];
if b[0]>c[0] then
c[0]:=b[0];
for i:=1 to c[0] do
c[i]:=a[i]+b[i];
for i:=1 to c[0]-1 do
begin
inc(c[i+1],c[i] div 10);
c[i]:=c[i] mod 10;
end;
while c[c[0]]>9 do
begin
c[c[0]+1]:=c[c[0]] div 10;
c[c[0]]:=c[c[0]] mod 10;
inc(c[0]);
end;
end;
procedure scade(var a,b,c:nr_mare);
var i,j:longint;
begin
c[0]:=a[0];
if b[0]>c[0] then
c[0]:=b[0];
for i:=1 to c[0] do
begin
if a[i]>=b[i] then
c[i]:=a[i]-b[i]
else
begin
c[i]:=a[i]+10-b[i];
j:=i+1;
while a[j]=0 do
begin
a[j]:=9;
inc(j);
end;
dec(a[j]);
end;
end;
while c[c[0]]=0 do
dec(c[0]);
end;
begin
assign(input,'sarpe.in');reset(input);
assign(output,'sarpe.out');rewrite(output);
while not eoln do
begin
read(c);
inc(v[0]);
v[v[0]]:=ord(c)-48;
end;
{if (v[0]=0)and(v[1]=2) then
begin
writeln(8);
close(output);
halt;
end;
///////////////////////////////////
for i:=1 to v[0] div 2 do
begin
aux:=v[i];
v[i]:=v[v[0]-i+1];
v[v[0]-i+1]:=aux;
end;
div2(v,x);
i:=1;
while x[i]=9 do
begin
x[i]:=0;
inc(i);
end;
inc(x[i]);
if x[x[0]+1]>0 then
inc(x[0]);
///////////////////////////////////
p1:=v;
i:=1;
while p1[i]=9 do
begin
p1[i]:=0;
inc(i);
end;
inc(p1[i]);
if p1[p1[0]+1]>0 then
inc(p1[0]);
mult(v,p1,s1);
p1:=x;
i:=1;
while p1[i]=9 do
begin
p1[i]:=0;
inc(i);
end;
inc(p1[i]);
if p1[p1[0]+1]>0 then
inc(p1[0]);
mult(x,p1,s2);
scade(s1,s2,s);
dp[0]:=1;
dp[1]:=2;
mult(s,dp,rez);
if v[1] mod 2=1 then
dp[1]:=2
else
dp[1]:=4;
fillchar(s,sizeof(s),0);
mult(x,dp,s);
add(rez,s,fin);}
mult(v,v,x);
s1[0]:=2;
s1[1]:=1;
s1[2]:=1;
mult(v,s1,s);
add(x,s,rez);
div2(rez,fin);
s2[0]:=1;
s2[1]:=5;
fillchar(rez,sizeof(rez),0);
scade(fin,s2,rez);
for i:=rez[0] downto 1 do
write(rez[i]);
close(input);close(output);
end.