program hh4;

uses math;

const fi='';//'hh4.inp';
      fo='';//'hh4.out';
      maxn=60;

var n,code,i,j:longint;
    Res:int64;
    f:array[0..maxn,-20..20] of int64;
    a,b:array[0..maxn]of longint;
    s:String;
    ok:boolean;
    f1,f2:text;

BEGIN
   assign(f1,fi);reset(f1);
   assign(F2,fo);rewrite(f2);
  readln(f1,s);
  n:=length(s);

  for i:=1 to n do
  val(s[i],a[i],code);

  for i:=0 to  9 do
  f[1][i]:=1;

  for i:=2 to length(s) do
     begin
        for j:=0 to 9 do
          f[i][j] := f[i-1][2*j+1 -a[i]] + f[i-1][2*j - a[i]]
          +f[i-1][2*j-1-a[i]];
     end;

  Res:=0;  b[1]:=a[1];
  for i:=0 to 9 do
  Res:=res + f[n][i];

  ok:=true;
  for i:=2 to n do
    begin
      b[i]:=(b[i-1] + a[i]);
      if abs(b[i] - 2*a[i])>1 then ok:=false;
      b[i]:=a[i];
    end;

  if ok then dec(res);

  writeln(f2,res);
  close(f1);close(f2);
END.

program zH;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var s:string;
    pok,i,j,k:longint;
    f:array[-100..100,-100..100]of int64;
    ans,n:int64;

begin
  //reset(input,'input.txt');
  //rewrite(output,'output.txt');
  readln(s);
  n:=length(s);
  for i:=0 to 9 do
    f[1,i]:=1;
  for i:=2 to n do
  begin
    k:=strtoint(s[i]);
    for j:=0 to 9 do
    begin
      f[i,j]:=f[i-1,2*j-k]+f[i-1,2*j-1-k]+f[i-1,2*j+1-k];
    end;
  end;
  ans:=0;
  pok:=1;
  for i:=2 to n do
  begin
    if not((strtoint(s[i])+strtoint(s[i-1])=2*strtoint(s[i]))or(strtoint(s[i])+strtoint(s[i-1])=2*strtoint(s[i])+1)or(strtoint(s[i])+strtoint(s[i-1])=2*strtoint(s[i])-1)) then pok:=0;
  end;
  ans:=ans-pok;
  for i:=0 to 9 do
    ans:=ans+f[n,i];
  writeln(ans);
end.

const
                fi='';
                fo='';
                maxn=50;
var
                f1,f2   :text;
                f       :array[0..maxn,0..9] of int64;
                a       :array[0..maxn] of longint;
                n       :longint;
                res     :int64;

procedure mof;
 begin
  assign(f1,fi);
   reset(f1);
  assign(f2,fo);
   rewrite(f2);
 end;

procedure dongf;
 begin
  close(f1);
  close(f2);
 end;

procedure nhap;
var s:string;i,m:longint;
 begin
     readln(f1,s);
     n:=length(S);
     for i:=1 to n do
        val(s[i],a[i],m);
 end;

procedure work;
 var i,j,t:longint; ok:boolean;

  begin
  fillchar(f,sizeof(f),0);

  for i:=0 to 9 do
   f[1,i]:=1;

   for i:=2 to n do
    for j:=0 to 9 do
     begin

      t:=2*j-a[i]-1;

      if (t>=0) and (t<=9) then
         f[i,j]:=f[i,j]+f[i-1,t];

      t:=2*j-a[i]+1;

      if (t>=0) and (t<=9) then
       f[i,j]:=f[i,j]+f[i-1,t];

      t:=2*j-a[i];
      if (t>=0) and (t<=9) then
       f[i,j]:=f[i,j]+f[i-1,t];

     end;

   ok:=true;
   for i:=2 to n do
    begin
     j:=a[i-1]+a[i];
     if (j div 2<>a[i]) and ((j-1) div 2<>a[i]) and ((j+1) div 2<>a[i]) then
      begin
      ok:=false;
      break;
      end;
    end;

     res:=0;
     for i:=0 to 9 do
      res:=res+f[n,i];
      if ok then dec(res);
  end;

 begin
 mof;
 nhap;
 work;
 writeln(f2,res);
 dongf;
 end.

var ss:int64;
ok:boolean;
code:integer;
a:array[0..1000,0..100]of int64;
t:array[0..1000]of longint;
i,j,n,l:longint;
s:string;
 begin
  readln(s);
  n:=length(s);
  for i:=1 to n do
    val(s[i],t[i],code);

  for j:=0 to 9 do
    a[1,j]:=1;

  for i:=2 to n do
    begin
     for j:=0 to 9 do
       begin
        a[i,j]:=0;
        for l:=0 to 9 do
          if ((l+t[i])div 2=j)or(((l+t[i])mod 2<>0)and(j=(l+t[i])div 2+1)) then a[i,j]:=a[i,j]+a[i-1,l];
       end;
    end;
  ss:=0;
  for l:=0 to 9 do
    ss:=ss+a[n,l];

  ok:=true;
  for i:=2 to n do
    if (t[i]<>t[i-1]-1)and(t[i]<>t[i-1])and(t[i]<>t[i-1]+1) then ok:=false;
  if ok then ss:=ss-1;
  writeln(ss);
 end.

{$APPTYPE CONSOLE}
{$R-,Q-}
var
 s1: string;
 i,j,n,qq,q : longint;
 f,f2 : array [0..9] of int64;
 ans,ans1 : int64;
 a,b : array [0..100000] of int64;
procedure rec(s : string);
var
 i : longint;
begin
 i:=length(s);
 if s=s1 then
  exit;
 if i=length(s1) then
  begin
   inc(n);
   exit;
  end;
 if ((ord(s1[i+1])-48)+(ord(s[i])-48)) mod 2 = 1 then
  rec(s+chr(((ord(s1[i+1])-48)+(ord(s[i])-48)) div 2 +49));
 rec(s+chr(((ord(s1[i+1])-48)+(ord(s[i])-48)) div 2 +48));
end;
begin
 {for q:=0 to 9 do
 for qq:=0 to 9 do
  begin
   if (qq>0) or (q>0) then
    begin
     close(input);
     close(output);
    end;
 rewrite(output,'input.txt');
 write(q,qq);
 close(output);  }
 {reset(input,'input.txt');
 rewrite(output,'output.txt');}
 readln(s1);
 if (length(s1)=1)then
  begin
   write(9);
   halt;
  end;
 {n:=0;
 for I:=0 to 9 do
  rec(chr(i+48));
 ans1:=n;
 writeln(n);   }
 n:=length(s1);
 for i:=1 to n do
  a[i]:=ord(s1[i])-ord('0');
 for i:=0 to 9 do
  f[i]:=1;
 for I:=2 to n do
  begin
   f2:=f;
   for j:=0 to 9 do
    f[j]:=0;
   for j:=0 to 9 do
    begin
     if (j+a[i]) mod 2 = 1 then
      f[(j+a[i]+1) div 2]:=f[(j+a[i]+1) div 2]+f2[j];
     f[(j+a[i]) div 2]:=f[(j+a[i]) div 2]+f2[j];
    end;
  end;
 ans:=0;
 for i:=0 to 9 do
  ans:=ans+f[i];
 b[1]:=a[1];
 i:=2;
 for i:=2 to n do
  begin
   if (((b[i-1]+a[i]) div 2)<>a[i]) and (((b[i-1]+a[i]+1) div 2)<>a[i]) then
    break;
   b[i]:=a[i];
  end;
 if i>n then
  dec(ans);
 writeln(ans);
{ if ans1<>ans then
  break;
 end;  }
end.

var S:string;
    LS,i,xy,j,x:longint;
    k:int64;
    A:array[1..50] of integer;
    B:array[0..9,1..50] of int64;
    T:boolean;

Begin

 read(S);

 LS:=Length(S);
 for i:=1 to LS do A[i]:=ord(S[i])-48;

 FillChar(B,SizeOf(B),0);
 for i:=0 to 9 do B[i,1]:=1;

 for i:=2 to LS do
   for j:=0 to 9 do
    begin
     xy:=A[i]+j;
     if xy and 1=0
       then B[xy shr 1   ,i]:=B[xy shr 1  ,i]+B[j,i-1]
       else begin
             B[xy shr 1+1,i]:=B[xy shr 1+1,i]+B[j,i-1];
             B[xy shr 1  ,i]:=B[xy shr 1  ,i]+B[j,i-1];
            end;
    end;
 for i:=0 to 9 do
   inc(k,B[i,LS]);

 x:=A[1]; T:=True;
 for i:=2 to LS do
  begin
   if (x+A[i]) and 1=0
     then begin
           x:=(x+A[i]) shr 1;
           if x<>A[i]
             then T:=False;
          end
     else if ((x+A[i]) shr 1=A[i]) or ((x+A[i]) shr 1+1=A[i])
             then if (x+A[i]) shr 1=A[i]
                    then x:=(x+A[i]) shr 1
                    else x:=(x+A[i]) shr 1+1
             else T:=False;
  end;
 if T
   then writeln(k-1)
   else writeln(k  );

End.

program Project1;

{$APPTYPE CONSOLE}
{$M 16777216}
uses
  SysUtils;
var st,ans,rem,q,remn,n,m,t,k,cnt,e,currc,currb,b,c:int64;
flag:boolean;
i,j:integer;
sn:string;
dp:array[0..111,0..111] of int64;
a:array[1..11111111] of string;

const constchr:array [0..9] of char=('0','1','2','3','4','5','6','7','8','9');

function makestring(x:integer):char;
begin
makestring:=constchr[x];
end;

procedure dfs(x:char;pos:int64);
var num,d:int64;
begin
//writeln('EXEC DFS(',n,',',pos,')');
d:=ord(x)-ord('0');
if pos=length(sn) then
   inc(cnt)
else
begin
num:=ord(sn[pos+1])-ord('0');

dfs(makestring((num+d) div 2),pos+1);

if (num+d) mod 2 = 1 then
dfs(makestring((num+d) div 2 + 1),pos+1);
end;

end;

var chr:char;
begin
 readln(sn);
 //sn:=0;
{ st:=0;
 while st<>0 do
   begin
   st:=st div 10;
   s[i]:=st mod 10;
   end;   }

cnt:=0;

ans:=0;

//  for Int := 1 to cnt do
 //  writeln(a[int]);

 flag:=true;
 for I := 2 to length(sn) do
 if ord(sn[i])-ord(sn[i-1])>1 then flag:=false;

if flag then ans:=1;

for I := 0 to 9 do
  dp[i,1]:=1;

for I := 2 to length(sn) do
  for j := 0 to 9 do
  begin
  if (2*j-ord(sn[i])+ord('0')>=0)  and (2*j-ord(sn[i])+ord('0')<=9) then
  dp[j,i]:=dp[j,i]+dp[2*j-ord(sn[i])+ord('0'),i-1];

  if (2*j-ord(sn[i])+ord('0')>=-1) and (2*j-ord(sn[i])+ord('0')<=8) then
  dp[j,i]:=dp[j,i]+dp[2*j-ord(sn[i])+ord('0')+1,i-1];

  if (2*j-ord(sn[i])+ord('0')>=1) and (2*j-ord(sn[i])+ord('0')<=10) then
  dp[j,i]:=dp[j,i]+dp[2*j-ord(sn[i])+ord('0')-1,i-1];

  end;

for I := 0 to 9 do
cnt:=cnt+dp[i,length(sn)];

//for chr := '0' to '9' do
//dfs(chr,1);

//  000000000000000000000000000000000000000000000000000000000000
  {
 for I := 1 to cnt do
 for J := i+1 to cnt do
   if a[i]>a[j] then
   begin
   t:=a[i];a[i]:=a[j];a[j]:=t;
   end;
  }

//  for Int := 1 to cnt do
//   writeln(a[int]);
{
 i:=1;
 for I := 1 to cnt do
  if a[i]<>-1 then
   begin
   j:=i+1;
    while a[i]=a[j] do
    begin
    a[j]:=-1;
    inc(j);
    end;

   end;
}
//   ans:=0;
   //for I := 1 to cnt do

 writeln(cnt-ans);
//while True do

 end.

{$APPTYPE CONSOLE}

var s:string;
k:int64;
i,q,q1,pr,pr1,j:integer;
a:array[1..53,0..9] of int64;
begin
 {reset(input,'input.txt');
 rewrite(output,'output.txt');}
 readln(s);
 for i := 0 to 9 do
 a[1,i]:=1;

  for i := 2 to length(s) do
   begin
      val(s[i],q,pr);
      for j:=0 to 9 do
       if (q+j) mod 2=0  then a[i,(q+j) div 2]:=a[i-1,j]+a[i,(q+j) div 2]
                         else
                            begin
                              a[i,(q+j) div 2]:=a[i-1,j]+a[i,(q+j) div 2];
                              a[i,(q+j) div 2+1]:=a[i-1,j]+a[i,(q+j) div 2+1];
                            end;
   end;
            k:=0;
            pr1:=0;
          for i:=0 to 9 do k:=k+a[length(s),i];
   val(s[1],q1,pr);
   for i:= 2 to length(s) do
           begin
            val(s[i],q,pr);
            if (q+q1) mod  2 =0 then begin if ((q+q1) div  2)<>q then pr1:=1; end
                                else if (((q+q1) div  2)<>q) and (((q+q1+1) div  2)<>q) then pr1:=1;
              q1:=q;
           end;

if pr1=0 then dec(k);
 writeln(k);

{close(input);
close(output);                 }
end.

{$R+,S+,Q+,I+,O-}
{R-,S-,Q-,I-,O+}
var
  n,i,d,p: longint;
  ok: boolean;
  s: ansistring;
  ans: int64;
  f: array [0..1010,0..10] of int64;
begin
//  assign(input,'in'); reset(input);
//  assign(output,'out'); rewrite(output);
  readln(s);
  n:=length(s);
  fillchar(f,sizeof(f),0);
  for d:=0 to 9 do f[1,d]:=1;
  for i:=1 to n-1 do
    for d:=0 to 9 do
    begin
      p:=d+Ord(s[i+1])-48;
      inc(f[i+1,p shr 1],f[i,d]);
      if p and 1 = 1 then inc(f[i+1,(p+1) shr 1],f[i,d]);
    end;
  ans:=0;
  for d:=0 to 9 do inc(ans,f[n,d]);
  ok:=True;
  for i:=2 to length(s) do
    if abs(Ord(s[i])-Ord(s[i-1])) > 1 then ok:=False;
  if ok then dec(ans);
  writeln(ans);
  close(input);
  close(output);
end.

var
 s:string;
 a,b:array[1..111]of longint;
 ff,jj,n,i,j:longint;
 f:array[1..111,-10..19]of extended;
 ans:extended;
begin
 readln(s);
 n:=length(s);
 ans:=0;
 for i:=1 to n do a[i]:=ord(s[i])-48;

 for i:=0 to 9 do f[1,i]:=1;

 for i:=1 to n-1 do for j:=0 to 9 do
 begin
  jj:=(a[i+1]+j)div 2;
  f[i+1,jj]:=f[i+1,jj]+f[i,j];
  if (a[i+1]+j)mod 2=1 then f[i+1,jj+1]:=f[i+1,jj+1]+f[i,j];
 end;
 b[1]:=a[1];
 ff:=1;
 for i:=2 to n do
 begin
  if (a[i]+b[i-1])div 2=a[i] then b[i]:=a[i] else
  if ((a[i]+b[i-1])mod 2=1)and(((a[i]+b[i-1])div 2)+1=a[i])then b[i]:=a[i] else
  begin
   ff:=0;
   break;
  end;
 end;
 ans:=ans-ff;
 for i:=0 to 9 do ans:=ans+f[n,i];
 writeln(ans:0:0);
end.

program solution;

{$APPTYPE CONSOLE}
{MODE DELPHI}
{$MAXSTACKSIZE 1000000000}
{O-,R+,Q+}
{$O+,R-,Q-}

uses
  SysUtils,
  Math;

var
  n, i : integer;
  ans : int64;
  s : string;
  a : array[0..51] of integer;
  d : array[0..51, 0..10] of int64;

procedure gets(var s : string);
var c : char;
begin
  s := '';
  read(c);
  while not (c in ['0'..'9']) do
    read(c);
  while c in ['0'..'9'] do begin
    s := s + c;
    read(c);
  end;
end;

procedure solve(b1 : integer);
var i, j, z : integer;
begin
  for i := 1 to n do
    for j := 0 to 9 do
      d[i, j] := 0;
  d[1, b1] := 1;
  for i := 2 to n do
    for j := 0 to 9 do begin
      z := j + a[i];
      d[i, z div 2] := d[i, z div 2] + d[i - 1, j];
      if z mod 2 = 1 then
        d[i, z div 2 + 1] := d[i, z div 2 + 1] + d[i - 1, j];
    end;
  for i := 0 to 9 do
    ans := ans + d[n, i];
end;

function good() : boolean;
var i, j : integer;
begin
  result := true;
  for i := 2 to n do begin
    j := a[i - 1] + a[i];
    if j mod 2 = 0 then begin
      if a[i] <> j div 2 then begin
        result := false;
        exit;
      end;
    end
    else begin
      if (a[i] <> j div 2) and (a[i] <> j div 2 + 1) then begin
        result := false;
        exit;
      end;
    end;
  end;
end;

begin
  //assign(input, 'input.txt'); reset(input);
  //assign(output, 'output.txt'); rewrite(output);
  gets(s);
  n := length(s);
  for i := 1 to n do
    a[i] := ord(s[i]) - ord('0');
  ans := 0;
  for i := 0 to 9 do
    solve(i);
  if good() then
    ans := ans - 1;
  writeln(ans);
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var i, j, n : longint;
    res : int64;
    a : array[1..50] of longint;
    b, b2 : array[0..9] of int64;
    s : string;
begin
 //  reset(input,'input.txt');
 //  rewrite(output,'output.txt');

   readln(s);
   s := trim(s);
   n := length(s);
   for i := 1 to n do
     a[i] := ord(s[i]) - ord('0');

   for i := 0 to 9 do
     b[i] := 1;

   for i := 2 to n do
   begin
      fillchar(b2, sizeof(b2), 0);
      for j := 0 to 9 do
      begin
        b2[(a[i] + j) div 2] := b2[(a[i] + j) div 2] + b[j];
        if ((a[i] + j) div 2) <> ((a[i] + j + 1) div 2) then
          b2[(a[i] + j + 1) div 2] := b2[(a[i] + j + 1) div 2] + b[j];
      end;
      b := b2;
   end;

   res := 0;
   for i := 0 to 9 do
     res := res + b[i];
   res := res - 1;
   for i := 2 to n do
     if ((a[i] + a[i - 1]) div 2 <> a[i]) and ((a[i] + a[i - 1] + 1) div 2 <> a[i]) then
     begin
       res := res + 1;
       break;
     end;
   write(res);
 //  close(input);
 //  close(output);
end.

program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
  a:array[1..60]of integer;
  y:array[1..60,1..60,0..9]of integer;
  n,i,k:integer;
  q:int64;
  c:char;
  b:boolean;
function rec(m,t,c:integer):int64;
var
  k:integer;
begin
if y[m,t,c]>0 then
  result:=y[m,t,c] else
begin
  if m>t then
    result:=1 else
  begin
    result:=0;
    k:=(a[m]+c) div 2;
    if (a[m]+c) mod 2=1 then
     begin
      if (a[m+1]+k)=(a[m+1]+k+1) then
        result:=rec(m+1,t,k)*2 else
      result:=rec(m+1,t,k)+rec(m+1,t,k+1);
     end else
    result:=rec(m+1,t,k);
  end;
  y[m,t,c]:=result;
end;
end;
begin
  n:=0;
  while not eof do
    begin
      read(c);
      if (c>='0')and(c<='9') then
        begin
          n:=n+1;
          a[n]:=ord(c)-ord('0');
        end;
    end;
  q:=0;
  for i := 0 to 9 do
    q:=q+rec(2,n,i);
  b:=true;
  for I := 2 to n do
      if abs((a[i]+a[i-1]) div 2-a[i])>1 then
        begin
          b:=false;
          break;
        end;
  if b then
    q:=q-1;

  writeln(q);
end.

var
   sum: int64;
   i,j,k:longint;
   s:string;
   b:boolean;
   arr:array [0..9,1..50] of int64;
Begin
     readln(s);
     for i:=0 to 9 do  arr[i,1]:=1;
     for j:=2 to length(s) do
         begin
               for k:=0 to 9 do
                   begin
                        if (k+ord(s[j])-48) mod 2 = 0 then
                           Begin
                                 arr[(k+ord(s[j])-48 )div 2,j]:=arr[k,j-1]+arr[(k+ord(s[j])-48 )div 2,j];
                           end
                        else
                           Begin
                                 arr[(k+ord(s[j])-48 )div 2,j]:=arr[k,j-1]+arr[(k+ord(s[j])-48 )div 2,j];
                                  arr[(k+ord(s[j])-48 )div 2 +1,j]:=arr[k,j-1]+arr[(k+ord(s[j])-48 )div 2 +1,j];
                           end;

                   end;
         end;
     sum:=0;
     for i:=0 to 9 do
             sum:=arr[i,length(s)]+sum;
     b:=true;
     for i:=1 to length(s)-1 do
         Begin
              if (ord(s[i])+ord(s[i+1])-48*2) mod 2 = 0 then
                 Begin
                   if ((ord(s[i])+ord(s[i+1])-48*2) div 2) <> (ord(s[i+1])-48) then b:=false;
                 end
              else
                 if not (((ord(s[i])+ord(s[i+1])-48*2) div 2 +1 = ord(s[i+1])-48) or ((ord(s[i])+ord(s[i+1])-48*2) div 2= ord(s[i+1])-48)) then b:=false;

         End;
     if b then dec(sum);
     writeln(sum);
End.

var  ss:ansistring;
     answer:int64; i,j,n,s:longint;
     a:array[0..100]of longint;
     dp:array[0..50,0..10]of int64;

function can:boolean;
var j:longint; x,x1,x2:longint;
begin
  x:=a[1];

  for j:=2 to n do
    begin
     s:=x+a[j];
     x1:=s div 2;
     x2:=s div 2 + s mod 2;

     if (x1<>a[j])and(x2<>a[j]) then exit(false);

     x:=a[j];
    end;

  can:=true;
end;

 begin
   readln(ss);
   n:=length(ss);
   for i:=1 to n do
    a[i]:=ord(ss[i])-48;

   for i:=0 to 9 do
    dp[1,i]:=1;

   for i:=1 to n-1 do
     for j:=0 to 9 do
      if dp[i,j]>0 then
       begin
         s:=j+a[i+1];

         if s mod 2=0 then dp[i+1,s div 2]:=dp[i+1,s div 2]+dp[i,j]
         else
          begin
           inc(dp[i+1,s div 2],dp[i,j]);
           inc(dp[i+1,s div 2+1],dp[i,j]);
          end;
       end;

   answer:=0;
   for j:=0 to 9 do
    answer:=answer+dp[n,j];

   if can then answer:=answer-1;

   writeln(answer);
 end.

program Progs;

{$APPTYPE CONSOLE}

uses SysUtils, Math;

type
  Int32 = Integer;
  TCounts = array[1..50] of array[0..9] of Int64;

function CheckDigits(const S: string): Boolean;
var
  I: Int32;
  LPrev: Int32;
  LCurr: Int32;
begin
  Result := True;
  for I := 2 to Length(S) do
  begin
    LPrev := Ord(S[I - 1]);
    LCurr := Ord(S[I]);
    if ((LPrev + LCurr) shr 1 <> LCurr) and
      ((LPrev + LCurr + 1) shr 1 <> LCurr) then
    begin
      Result := False;
      Break;
    end;
  end;
end;

var
  S: string;
  I, J, N: Int32;
  Counts: TCounts;
  CurrDigit: Int32;
  Result: Int64;

begin
  Readln(S);
  N := Length(S);

  for I := 0 to 9 do
  begin
    Counts[1][I] := 1;
    for J := 2 to N do
      Counts[J][I] := 0;
  end;

  for I := 2 to N do
  begin
    for J := 0 to 9 do
    begin
      CurrDigit := Ord(S[I]) - Ord('0');
      Counts[I][(CurrDigit + J) shr 1] := Counts[I][(CurrDigit + J) shr 1] + Counts[I - 1][J];
      if (CurrDigit and 1) <> (J and 1) then
        Counts[I][(CurrDigit + J) shr 1 + 1] := Counts[I][(CurrDigit + J) shr 1 + 1] + Counts[I - 1][J];
    end;
  end;

  Result := 0;
  for I := 0 to 9 do
    Inc(Result, Counts[N][I]);

  if CheckDigits(S) then
    Dec(Result);

  Writeln(Result);
end.

const
    fi='';
    fo='';
var
    f:text;
    St:string;
    A:array[1..100,-20..20] of int64;
    res:int64;
procedure nhap;
begin
    assign(f,fi);
    reset(f);
    readln(f,St);
    close(F);
end;
procedure xuat;
begin
    assign(f,fo);
    rewrite(F);
    writeln(f,res);
    close(F);
end;
procedure process;
var i,t,h,j:longint;xet:boolean;
begin
    fillchar(A,sizeof(A),0);
    for i:=0 to 9 do A[1,i]:=1;
    xet:=true;
    for i:=2 to length(St) do
     begin
        t:=ord(St[i])-48;
        for j:=0 to 9 do
         begin
            A[i,j]:=A[i-1,2*j-t]+A[i-1,2*j-t+1]+A[i-1,2*j-t-1];
            h:=ord(St[i-1])-48;
            if j=t then
            begin
            if (h=2*j-t-1) or ((h=2*j-t) or (h=2*j-t+1)) then
             begin
            if A[i-1,h]=0 then xet:=false;
             end
            else xet:=false;
            end;
         end;
     end;
    res:=0;
    for i:=0 to 9 do res:=res+A[length(St),i];
    if xet then res:=res-1;
end;
begin
    nhap;
    process;
    xuat;
end.

program h;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  s:string;
  i,j,n,z,ii:longint;
  r,d:int64;
  a:array[1..1000] of int64;
  b:array[0..100,0..10000] of int64;

begin
  readln(s);
  for i:=1 to length(s) do a[i]:=(ord(s[i])-ord('0'));
  fillchar(b,sizeof(b),0);
  n:=length(s);
  r:=0;
  for z:=0 to 9 do begin
  fillchar(b,sizeof(b),0);
  b[1,z]:=1;
  for i:=2 to n do
    begin
      for j:=0 to 9 do
        if b[i-1,j]<>0 then
          begin
            d:=a[i]+j;
            if d mod 2=0 then inc(b[i,d div 2],b[i-1,j]) else
              begin inc(b[i,d div 2],b[i-1,j]);
               inc(b[i,d div 2+1],b[i-1,j]); end;
          end;
    end;

  for i:=0 to 9 do
    r:=r+b[n,i];
    end;
  ii:=0;
  for i:=1 to n-1 do if abs(a[i]-a[i+1])>1 then ii:=1;
  if ii=0 then dec(r);
  writeln(r);
end.

Const
        fi = '';
        fo = '';
        MaxN = 55;

Type    Arr1 = Array[0..MaxN+1,0..10] Of Qword;
        Arr2 = Array[0..MaxN+1] Of Longint;

Var     f : Arr1;
        a : Arr2;
        s : String;
        n, i, j : Longint;
        kq : Qword;

Function check(x : qword) : boolean;
 Var    y, i : longint;
 Begin
        y := a[1];
        for i := 2 to n do
        begin
                y := y+a[i];
                if (y div 2 = a[i]) or (y div 2+1 = a[i]) then
                        y := a[i]
                else    exit(false);
        end;
        exit(true);
 End;

Begin
        assign(input,fi); reset(input);
        readln(s);
        close(input);
        /////////
        n := length(s);
        for j := 0 to 9 do
                f[n,j] := 1;
        for i := 1 to length(s) do
                a[i] := ord(s[i])-48;
        //////////
        for i := n-1 downto 1 do
        for j := 0 to 9 do
        begin
                f[i,j] := f[i,j] + f[i+1,(j+a[i+1])div 2];
                if odd(j+a[i+1]) then
                        f[i,j] := f[i,j] + f[i+1,(j+a[i+1])div 2+1];
        end;
        kq := 0;
        for j := 0 to 9 do
                kq := kq + f[1,j];
        if check(kq) then dec(kq);
        writeln(kq);
End.

var  a:array[0..60,0..9]of int64;
     b:array[0..60]of longint;
     n:longint;
     s:string;
     res:int64;

procedure xuly;
var  i,j,k:longint;
begin
     n:=length(s);
     for i:=1 to n do b[i]:=ord(s[i])-48;

     for i:=0 to 9 do a[1,i]:=1;

     for i:=2 to n do
     for j:=0 to 9 do
     begin
          k:=j+b[i];
          inc(a[i,k div 2],a[i-1,j]);
          if k mod 2=1 then inc(a[i,(k+1) div 2],a[i-1,j]);
     end;
end;

procedure tinhkq;
var  i,k:longint;
     kt:boolean;
begin
     res:=0;
     for i:=0 to 9 do inc(res,a[n,i]);

     for i:=2 to n do
     begin
          k:=b[i]+b[i-1];
          if ((k div 2) <> b[i]) and (((k+1) div 2)<> b[i]) then exit;
     end;

     dec(res);
end;

begin
     readln(s);
     if length(s)=1 then
     begin
          writeln(9);
          halt;
     end;
     xuly;
     tinhkq;
     writeln(res);
end.

var  a:array[0..59,0..9]of int64;
     b:array[0..59]of longint;
     n:longint;
     s:string;
     res:int64;

procedure xuly;
var  i,j,k:longint;
begin
     n:=length(s);
     for i:=1 to n do b[i]:=ord(s[i])-48;

     for i:=0 to 9 do a[1,i]:=1;

     for i:=2 to n do
     for j:=0 to 9 do
     begin
          k:=j+b[i];
          inc(a[i,k div 2],a[i-1,j]);
          if k mod 2=1 then inc(a[i,(k+1) div 2],a[i-1,j]);
     end;
end;

procedure tinhkq;
var  i,k:longint;
     kt:boolean;
begin
     res:=0;
     for i:=0 to 9 do inc(res,a[n,i]);

     for i:=2 to n do
     begin
          k:=b[i]+b[i-1];
          if ((k div 2) <> b[i]) and (((k+1) div 2)<> b[i]) then exit;
     end;

     dec(res);
end;

begin
     readln(s);
     if length(s)=1 then
     begin
          writeln(9);
          halt;
     end;
     xuly;
     tinhkq;
     writeln(res);
end.

const fi='';//44h.inp';
      fo='';//44h.out';
      maxn=55;
var s:string;
    f1:array[0..maxn,0..9] of int64;
    n:longint;
    f:text;

procedure nhap;
begin
     assign(f,fi); reset(f);
     readln(f,s);
     n:=length(s);
     close(F);
end;

procedure work;
var i,j,k,t:longint;
begin
     for i:=0 to 9 do f1[1,i]:=1;
     for i:=2 to n do
     begin
          t:=ord(s[i])-48;
          for j:=0 to 9 do
               for k:=0 to 9 do
                    if (k+t=2*j-1) or (k+t=2*j+1) or (k+t=2*j) then
                         f1[i,j]:=f1[i,j]+f1[i-1,k];
     end;
end;

function tinh:longint;
var i,j,t,k:longint;
begin
          t:=ord(s[1])-48;
          for i:=2 to n do
          begin
               k:=ord(s[i])-48;
               if (t+k<>2*k-1) and (t+k<>2*k) and (t+k<>2*k+1) then
                    exit(0);
               t:=k;
          end;
     exit(1);
end;

procedure inkq;
var i:longint; res:int64;
begin
     assign(f,fo); rewrite(f);
     res:=0;
     for i:=0 to 9 do
          res:=res+f1[n,i];
     res:=res-tinh;
     writeln(f,res);
     close(f);
end;

begin
     nhap;
     work;
     inkq;
end.

const r=ord('0');
var d:array [1..50,0..9] of qword;
    i,j,l,ri,k,x:word;
    s:ansistring;
    f:boolean;
    su:qword;
begin
   read(s);
   fillchar(d,sizeof(d),0);
   for i:=0 to 9 do d[1,i]:=1;
   for i:=2 to length(s) do begin
      x:=ord(s[i])-r;
      ri:=(x+9) div 2+(x+9) mod 2;
      l:=x div 2;
      k:=0;
      su:=x div 2;
      for j:=l to ri do begin
         while (k<10) and ((su=j) or (su+(x+k) mod 2=j)) do begin
            inc(d[i,j],d[i-1,k]);
            inc(k);
            su:=(x+k) div 2
         end;
         dec(k);
         su:=(x+k) div 2
      end
   end;
   su:=0;
   for i:=0 to 9 do inc(su,d[length(s),i]);
   x:=ord(s[1])-r;
   f:=true;
   for i:=2 to length(s) do begin
      ri:=ord(s[i])-r;
      l:=(ri+x) div 2;
      if (l+1<ri) or (l-1>ri) then begin
         f:=false;
         break
      end;
      x:=ri
   end;
   if f then dec(su);
   writeln(su)
end.

Var s:string;
    a:array[0..60]of longint;
    b,c:array[0..20]of int64;
    ans:int64;
    n,i,j,u,x:longint;
    p:integer;
    ok:boolean;
  Begin
    Readln(s);
    n:=length(s);
    ans:=0;
    for i:=1 to n do
      val(s[i],a[i],p);
    for i:=0 to 9 do
      begin
        fillchar(b,sizeof(b),0);
        b[i]:=1;
        for j:=2 to n do
          begin
            for u:=0 to 9 do
              begin
                if (a[j]+u)mod 2=0 then c[(a[j]+u)div 2]:=c[(a[j]+u)div 2]+b[u]
                else begin
                       x:=a[j]+u;
                       c[x div 2]:=c[x div 2]+b[u];
                       c[x div 2+1]:=c[x div 2+1]+b[u];
                     end;
              end;
            for u:=0 to 9 do
              b[u]:=c[u];
            fillchar(c,sizeof(c),0);
          end;
        for u:=0 to 9 do
          ans:=ans+b[u];
      end;
   ok:=true;
    for i:=2 to n do
      begin
        x:=a[i]+a[i-1];
        if (x div 2<>a[i])and(x div 2+x mod 2<>a[i]) then ok:=false;
      end;
    if ok then ans:=ans-1;
    Writeln(ans);
  End.

var a:array[1..1000] of longint;
    f:array[1..1000,0..9] of int64;
    fl,i,j,n,m,x,y:longint;
    ans:int64;
    ch:char;
     begin
      read(ch);
      while ch in ['0'..'9'] do
       begin
        inc(n);
        a[n]:=ord(ch)-ord('0');
        read(ch);
       end;
     for i:=0 to 9 do f[1][i]:=1;
     for i:=1 to n-1 do
     for j:=0 to 9 do
     if f[i][j]>0 then begin
      x:=(j+a[i+1]) div 2;
      y:=(j+a[i+1]+1) div 2;
      f[i+1][x]:=f[i+1][x]+f[i][j];
      if x<>y then f[i+1][y]:=f[i+1][y]+f[i][j];
     end;
   ans:=0;
   for i:=0 to 9 do ans:=ans+f[n][i];
   fl:=1;
   for i:=2 to n do if abs(a[i]-a[i-1])>1 then fl:=0;
   ans:=ans-fl;
   writeln(ans);
  end.

Const
        Fi      =       '';//44H.inp';
        Fo      =       '';//44H.out';
        maxn    =       50;

Var
        F       :       Text;
        N       :       Longint;
        Res     :       Int64;
        A       :       Array[1..maxn] of Longint;
        L       :       Array[0..maxn, 0..9] of Int64;

Procedure  Input;
 Var i: Longint;  s: String;
 Begin
        Assign(f, fi);  Reset(f);
          Readln(f, s);
          N:= Length(s);
          For i:= 1 to n do
             A[i]:= ord(S[i]) - 48;
        Close(f);
 End;

Procedure  Process;
 Var i, j, b, ok: Longint;
 Begin
        ok:= 0;
        For i:= 0 to 9 do  L[1, i]:= 1;
        For i:= 2 to n do
          For j:= 0 to 9 do
            Begin
                   L[i, (j+a[i]) div 2]:= L[i-1, j] + L[i, (j+a[i]) div 2];
                   If odd(j+A[i]) then
                      L[i, (j+A[i]+1) div 2]:= L[i-1, j] + L[i, (j+A[i]+1) div 2];
            End;

        For i:= 0 to 9 do  Res:= Res + L[n, i];

        For i:= 2 to n do
          If (Abs(A[i] + A[i-1]- 2*A[i])>1) then Exit;
        Res:= Res - 1;
 End;

Procedure  Print;
  Begin
        Assign(f, fo);  Rewrite(f);
          Writeln(f, Res);
        Close(f);
  End;

BEGIN
        Input;
        Process;
        Print;
END.

{$R+,Q+,I+}
{$apptype console}
Uses SysUtils;
Var
   dp:Array[0..9,0..50] of Int64;
   a,b:Array[0..50] of Int64;
   s:String;
   n,ans,f:Int64;
   i,j:Integer;
Function Solve(i,j:Integer):Int64;
Begin
   If dp[i,j]<>-1 Then Begin
      Solve:=dp[i,j];
      Exit;
   End;
   If j=n Then Begin
      If (i+a[j]) mod 2=0 Then dp[i,j]:=1
                          Else dp[i,j]:=2;
      Solve:=dp[i,j];
      Exit;
   End;
   If (i+a[j]) mod 2=0 Then dp[i,j]:=Solve((i+a[j]) div 2,j+1)
                       Else dp[i,j]:=Solve((i+a[j]) div 2,j+1)+Solve((i+a[j]) div 2+1,j+1);
   Solve:=dp[i,j];
End;
Begin
   Read(s);
   n:=length(s);
   If n=1 Then Begin
      Write(9);
      Halt;
   End;
   For i:=1 To n Do a[i]:=strtoint(s[i]);
   For i:=0 To 9 Do
      For j:=1 To 50 Do dp[i,j]:=-1;
   ans:=0;
   For i:=0 To 9 Do ans:=ans+Solve(i,2);
   b[1]:=a[1];
   f:=1;
   For i:=2 To n Do Begin
      If (a[i]+b[i-1]) mod 2=0 Then Begin
         b[i]:=(a[i]+b[i-1]) div 2;
         If b[i]<>a[i] Then Begin
            f:=0;
            Break;
         End;
      End
      Else Begin
         If (a[i]+b[i-1]) div 2=a[i] Then b[i]:=(a[i]+b[i-1]) div 2
                                     Else b[i]:=(a[i]+b[i-1]) div 2+1;
         If b[i]<>a[i] Then Begin
            f:=0;
            Break;
         End;
      End;
   End;
   If f=1 Then ans:=ans-1;
   Write(ans);
End.

var i,j,l,n,t:longint;
    ans:int64;
    q:boolean;
    a,b,c:array[0..51] of int64;
    s:string;
    p:integer;
 begin
  readln(s);
  n:=length(s);
  for i:=1 to n do
   val(s[i],a[i],p);
  for i:=0 to 9 do
   b[i]:=1;
  for i:=2 to n do
   begin
    fillchar(c,sizeof(c),0);
    for j:=0 to 9 do
     begin
      for l:=0 to 9 do
       begin
        if (l+a[i]) div 2=j then c[j]:=c[j]+b[l];
        if (l+a[i]) mod 2=1 then if (a[i]+l) div 2+1=j then c[j]:=c[j]+b[l];
       end;
     end;
    b:=c;
   end;
  ans:=0;
  for i:=0 to 9 do
   ans:=ans+b[i];
  q:=true;
  for i:=2 to n do
   begin
    t:=a[i]+a[i-1];
    if t mod 2=0 then begin
                       if (t div 2)<>a[i] then q:=false;
                      end
                 else begin
                       if ((t div 2)<>a[i]) and ((t div 2+1)<>a[i]) then q:=false;
                      end;
   end;
  if q then ans:=ans-1;
  writeln(ans);
 end.

program     h2;
const
    nfin=   '';
    nfout=  '';

var
    f:  array[0..60, 0..9] of int64;
    cs: array[0..60] of longint;
    s:  string;
    res: int64;
    n:  longint;
    fin, fout: text;

procedure init;
var i, j: longint;
begin
    n:=length(s);
    for i:=1 to n do cs[i]:=ord(s[i]) - ord ('0');
end;

function call(i, pr: longint): longint;
begin
    if f[i, pr]<>-1 then begin
        call:=f[i, pr];
        exit;
    end;

    if i=n+1 then begin
        f[i, pr]:=1;
        call:=1;
        exit;
    end;

    f[i, pr]:=call(i+1, (pr+cs[i]) div 2);
    if ((pr+cs[i]) mod 2 = 1) then
        f[i, pr]:=f[i, pr] + call(i+1, (pr+cs[i]+1) div 2);
    call:=f[i, pr];
end;

procedure solve;
var i, j, k: longint;
begin
    if n = 1 then begin
        res:=9;
        exit;
    end;

    res:=0;
    for k:=0 to 9 do begin
        for i:=0 to 60 do
        for j:=0 to 9 do f[i, j]:=-1;
        res:=res + call(2, k);
    end;

    k:=1;
    for i:=2 to n do
    if (cs[i] = (cs[i] + cs[i-1]) div 2)
    or (((cs[i] + cs[i-1]) mod 2 = 1) and (((cs[i]+cs[i-1]+1) div 2)=cs[i])) then k:=k+1;
    if k=n then res:=res-1;
end;

begin
    assign(fin, nfin); reset(fin);
    assign(fout, nfout); rewrite(fout);
        readln(fin, s);
        init;
        solve;
        writeln(res);
    close(fout);
    close(fin);
end.

program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var a:array[1..50,0..9] of int64;
    s:array[1..50] of longint;
  i, j, n, x: longint;
  ans: int64;
  c: char;
  canphone: boolean;
begin
  read(c);
  i := 1;
  while (c in ['0'..'9']) do begin
    s[i] := ord(c) - ord('0');
    inc(i);
    read(c);
  end;
  n := i - 1;
  for i := 1 to n do begin
    for j := 0 to 9 do begin
      a[i, j] := 0;
    end;
  end;
  for i := 0 to 9 do begin
    a[1][i] := 1;
  end;
  for i := 2 to n do begin
    for j := 0 to 9 do begin
       x := s[i] + j;
       if (x mod 2 = 1) then begin
         a[i,(x + 1) div 2] := a[i,(x + 1) div 2] + a[i - 1,j];
       end;
       a[i,x div 2] := a[i,x div 2] + a[i - 1,j];
    end;
  end;
  ans := 0;
  for i := 0 to 9 do begin
    ans := ans + a[n, i];
  end;
  canphone := true;
  for i := 1 to n - 1 do begin
    canphone := canphone and (abs(s[i] - s[i + 1]) <= 1);
  end;
  if canphone then ans := ans - 1;
  writeln(ans);

end.

const
        fi='';
var
        f:text;
        kq:int64;
        g:array [0..50,0..9] of int64;
        s:string;
        n:longint;
        a:array [1..50] of longint;
procedure nhap;
var
        i:longint;
begin
        assign(f,fi);
        reset(f);
        readln(f,s);
        n:=length(s);
        close(f);
        for i:=1 to n do a[i]:=ord(s[i])-48;
end;
procedure xuly;
var
        i,u,j:longint;
begin
        for i:=0 to 9 do g[1,i]:=1;
        for i:=1 to n-1 do
        for j:=0 to 9 do
        begin
                u:=j+a[i+1];
                g[i+1,u div 2]:=g[i+1,u div 2]+g[i,j];
                if u mod 2=1 then g[i+1,(u+1) div 2]:=g[i+1,(u+1) div 2]+g[i,j];
        end;
        j:=0;
        for i:=1 to n-1 do
        begin
                u:=a[i]+a[i+1];
                if ((u+1) div 2<>a[i+1]) and (u div 2<>a[i+1]) then j:=-1;
        end;
        if j=0 then kq:=-1;
        for i:=0 to 9 do kq:=kq+g[n,i];
        writeln(kq);
end;
begin
        nhap;
        xuly;
end.

program HH;

{$APPTYPE CONSOLE}

var
fin:boolean;
i,j,n,l,c:longint;
sum,y:int64;
s:string;
a:array[1..105] of longint;
b:array[1..105,0..9] of int64;

begin
  {assign(input,'input.txt');
  assign(output,'output.txt');
  reset(input);
  rewrite(output);}
  readln(s);
  sum:=0;
  n:=length(s);
  sum:=0;
  if n=1 then writeln('9') else begin

  for i:=1 to n do begin
    val(s[i],a[i],c);
  end;

  for i:=0 to 9 do begin
  b[1,i]:=1;
  end;

  for i:=2 to n do begin

    for j:=0 to 9 do begin
      if {(b[i-1,j]>0) and} ((j+a[i]) mod 2=0) then begin
        b[i,(j+a[i]) div 2]:=b[i,(j+a[i]) div 2]+b[i-1,j];
      end;
      if {(b[i-1,j]>0) and }((j+a[i]) mod 2=1) then begin
        b[i,(j+a[i]) div 2]:=b[i,(j+a[i]) div 2]+b[i-1,j];
        b[i,((j+a[i]) div 2)+1]:=b[i,((j+a[i]) div 2)+1]+b[i-1,j];
      end;
    end;

  end;

  for i:=0 to 9 do begin
  sum:=sum+b[n,i];
  end;

  fin:=false;
  for i:=2 to n do begin
  y:=(a[i-1]+a[i])div 2;
  if ((a[i-1]+a[i])mod 2)=0 then begin
    if y<>a[i] then fin:=true;
  end else begin
    if (a[i]<y) or (a[i]>y+1) then fin:=true;
  end;
  end;
  if (fin=false) then sum:=sum-1;

  writeln(sum);

  end;

end.

const
        fi='';
var
        f:text;
        s:string;
        n:longint;
        g:array [1..50,0..9] of int64;
        kq:int64;
procedure nhap;
begin
        assign(f,fi);
        reset(f);
        readln(f,s);
        n:=length(s);
        close(f);
end;
procedure xuly;
var
        i,j,u,v:longint;
        kt:boolean;
begin
        for i:=0 to 9 do g[1,i]:=1;
        for i:=1 to n-1 do
        for j:=0 to 9 do
        begin
                u:=(j+ord(s[i+1])-48);
                g[i+1,u div 2]:=g[i+1,u div 2]+g[i,j];
                if u mod 2=1 then g[i+1,(u+1) div 2]:=g[i+1,(u+1) div 2]+g[i,j];
        end;
        for i:=0 to 9 do kq:=kq+g[n,i];
        kt:=true;  u:=ord(s[1])-48;
        for i:=2 to n do
        begin
                v:=ord(s[i])-48;
                u:=(u+v) div 2;
                if (u<>v) and (u<>v-1) then
                begin
                        kt:=false;
                        break;
                end;
        end;
        if kt then dec(kq);
        writeln(kq);
end;
begin
        nhap;
        xuly;
end.

var
 s:string;
 a,b:array[1..111]of longint;
 ff,jj,n,i,j:longint;
 f:array[1..111,-10..19]of extended;
 ans:extended;
begin
//assign(input,fi);reset(input);
//assign(output,fo);rewrite(output);
 readln(s);
 n:=length(s);
 ans:=0;
 for i:=1 to n do a[i]:=ord(s[i])-48;
 for i:=0 to 9 do f[1,i]:=1;
 for i:=1 to n-1 do
  for j:=0 to 9 do
  begin
        jj:=(a[i+1]+j)div 2;
        f[i+1,jj]:=f[i+1,jj]+f[i,j];
        if (a[i+1]+j)mod 2=1 then
                f[i+1,jj+1]:=f[i+1,jj+1]+f[i,j];
  end;
 b[1]:=a[1];
 ff:=1;
 for i:=2 to n do
 begin
  if (a[i]+b[i-1])div 2=a[i] then
        b[i]:=a[i]
  else
  if ((a[i]+b[i-1])mod 2=1)and(((a[i]+b[i-1])div 2)+1=a[i])
        then b[i]:=a[i]
  else
  begin
   ff:=0;
   break;
  end;
 end;
 ans:=ans-ff;
 for i:=0 to 9 do ans:=ans+f[n,i];
 writeln(ans:0:0);
end.

{$APPTYPE CONSOLE}

{$R+,S+,Q+,I+,C+,M+,H+,O-}
{M 67108864}

uses SysUtils, Math;

var
    s:string;
    ls,kk,i,j,pp:longint;
    a:array[0..1010,0..10] of int64;
    ans:int64;
    f:boolean;

begin
{$IFNDEF ONLINE_JUDGE}
reset(input,'input.txt');
rewrite(output,'output.txt');
{$ENDIF}
fillchar(a,sizeof(a),0);
readln(s);
ls:=length(s);
kk:=ls-1;
ans:=0;
for i:=0 to 9 do
    a[1][i]:=1;
for i:=1 to kk do begin
    for j:=0 to 9 do begin
        pp:=j+ord(s[i+1])-48;
        inc(a[i+1][pp div 2],a[i][j]);
        if pp and 1=1 then inc(a[i+1][(pp+1) div 2],a[i][j]);
    end;
end;
for i:=0 to 9 do
    inc(ans,a[ls][i]);
f:=true;
for i:=2 to ls do
    if abs(ord(s[i])-ord(s[i-1]))>1 then begin
        f:=false;
        break;
    end;
if f then dec(ans);
write(ans);
end.

//writeln(FormatDateTime('hh:mm:ss.zzz', now));

program Z_H;

{$APPTYPE CONSOLE} {$O- R+ Q+}

uses
  SysUtils;

var s:string;
    n,i,j,k:longint;
    ans:int64;
    a:array[1..50] of longint;
    flag:boolean;
    f:array[1..50,0..9] of int64;
    b:array[1..50,0..9] of boolean;
function proc(const ind,v:longint; flag:boolean):int64;
var k,l:longint;
    f:boolean;
begin
 if (ind=n+1)
  then
   begin
    if not flag
     then
      result:=1
     else
      result:=0;
    exit;
   end;
 k:=(v+a[ind]);
 if odd(k)
  then
   l:=(k-1) shr 1
  else
   l:=(k) shr 1;
 if flag and (l=a[ind])
  then
   f:=true
  else
   f:=false;
 result:=0;
 result:=result+proc(ind+1,l,f);
 if flag and (l +1=a[ind])
  then
   f:=true
  else
   f:=false;
 if odd(k)
  then
   begin
    result:=result+proc(ind+1,l +1,f);
   end;
end;
begin
 { assign(input,'input.txt');
  assign(output,'output.txt');
  reset(input);
  rewrite(output); }
  readln(s);
  n:=length(s);
  for i:=1 to n do
   begin
    a[i]:=strtoint(s[i]);
   end;
  ans:=0;
  for i:=0 to 9 do
   f[n,i]:=1;
 b[n,a[n]]:=true;
 for i:=n-1 downto 1 do
  for j:=0 to 9 do
   begin
    k:=j+a[i+1];
    if (j=a[i])and(b[i+1, k div 2])
     then
      b[i,j]:=true;
    f[i,j]:=f[i+1,k div 2];
    if odd(k)
     then
      begin
       f[i,j]:=f[i,j]+f[i+1,k div 2 +1];
       if (j=a[i])and(b[i+1, k div 2 +1])
        then
         b[i,j]:=true;

      end;
   end;
 for i:=0 to 9 do
  ans:=ans+f[1,i];
 for i:=0 to 9 do
  if b[1,i]
   then
    begin
     dec(ans);
     break;
    end;
 { for i:=0 to 9 do
   begin
    flag:=i=a[1];
    ans:=ans+proc(2,i,flag);
   end;    }
  write(ans);
end.

var
k:array[0..9,0..49] of  int64;
nom:array[1..50] of longint;
i,l,j:longint;
fs:int64;
s:string;
sp:boolean;
begin
readln(s);
for i:=0 to 9 do k[i,0]:=1;
l:=0;
while s<>'' do begin
inc(l);
nom[l]:=ord(s[length(s)])-ord('0');
s:=copy(s,1,length(s)-1);
end;
for i:=1 to l-1 do
for j:=0 to 9 do
if ((j+nom[i]) mod 2)=0 then k[j,i]:=k[(j+nom[i]) div 2,i-1]
else k[j,i]:=k[(j+nom[i]) div 2,i-1]+k[((j+nom[i]) div 2)+1,i-1];
fs:=0;
for i:=0 to 9 do
fs:=fs+k[i,l-1];
sp:=true;
for i:=1 to l-1 do
if (abs(nom[i]-nom[i+1])>1) then sp:=false;
if sp then dec(fs);
writeln(fs);
end.

const
  maxn = 55;
var
  f:array[0..maxn, 0..maxn, 0..1] of int64;
  k,j,n,i,ne:longint;
  s:string;
  res:int64;
begin
  readln(s);
  for i:=0 to 9 do f[1, i, ord(chr(48+i) = s[1])]:=1;
  for i:=1 to length(s)-1 do for j:=0 to 9 do for k:=0 to 1 do if f[i, j, k]>0 then
  begin
    ne:=j+ord(s[i+1])-48;
    if ne and 1 = 0 then inc(f[i+1, ne shr 1, k and (ord(chr(ne shr 1+48) = s[i+1]))], f[i, j, k]) else
    begin
      inc(f[i+1, ne shr 1, k and (ord(chr(ne shr 1+48) = s[i+1]))], f[i, j, k]);
      if ne shr 1<9 then inc(f[i+1, ne shr 1+1, k and (ord(chr(ne shr 1+49) = s[i+1]))], f[i, j, k]);
    end;
  end;
  for i:=0 to 9 do inc(res, f[length(s), i, 0]);
  writeln(res);
end.

var
        s:string;
        a:array[1..50,0..9] of int64;
        n,i,j,k,t:longint;
        kq:int64;
        check:boolean;
begin
        readln(s);
        kq:=0;
        for i:=0 to 9 do a[1,i]:=1;
        check:=true;
        for i:=2 to length(s) do
        begin
                k:=ord(s[i])-48;
                for j:=0 to 9 do
                begin
                        if (j+k) mod 2 = 0 then a[i,(j+k) div 2]:=a[i,(j+k) div 2]+a[i-1,j]
                        else
                        begin
                                a[i,(j+k) div 2]:=a[i,(j+k) div 2]+a[i-1,j];
                                a[i,(j+k) div 2+1]:=a[i,(j+k) div 2+1]+a[i-1,j];
                        end;
                end;
        end;
        for i:=0 to 9 do kq:=kq+a[length(s),i];
        t:=ord(s[1])-48;
        for i:=2 to length(s) do
        begin
                k:=ord(s[i])-48;
                if (t+k) mod 2 = 0 then
                        if ((t+k) div 2 <> k) then
                        begin
                                check:=false;
                                break;
                        end;
                if (t+k) mod 2 =1 then
                        if ((t+k) div 2 <> k) and ((t+k) div 2+1<>k) then
                        begin
                                check:=false;
                                break;
                        end;
                t:=k;
        end;
        if check=true then dec(kq);
        writeln(kq);
end.

program sdt;
const
  fi = '';
  fo = '';
  nmax = 50;
var
  a: array[1..nmax] of int64;
  b: array[0..9, 1..nmax] of int64;
  n: longint;
  kq: int64;
  f1, f2: text;

  procedure openf;
  begin
    assign(f1, fi); reset(f1);
    assign(f2, fo); rewrite(f2);
  end;

  procedure closef;
  begin
    close(f1); close(f2);
  end;

  procedure input;
  var
    s: string;
    i: longint;
  begin
    read(f1, s);
    n := length(s);
    for i := 1 to n do
      a[i] := ord(s[i]) - ord('0');
  end;

  procedure output;
  begin
    write(f2, kq);
  end;

  procedure process;
  var
    i, j: longint;
  begin
    for i := 0 to 9 do
      b[i, n] := 1;
    for i := n - 1 downto 1 do
      for j := 0 to 9 do
        if (j + a[i + 1]) and 1 = 1 then
          b[j, i] := b[(j + a[i + 1]) div 2, i + 1] + b[(j + a[i + 1]) div 2 + 1, i + 1]
        else
          b[j, i] := b[(j + a[i + 1]) div 2, i + 1];
    for i := 0 to 9 do
      kq := kq + b[i, 1];
    for i := 2 to n do
      begin
        if abs(a[i] - a[i - 1]) > 1 then
          break;
        if i = n then
          kq := kq - 1;
      end;
    if n = 1 then
      kq := kq - 1;
  end;

begin
  openf;
  input;
  process;
  output;
  closef;
end.

var i,j,m:Longint;
f:array[0..51,0..9] of int64;
a:array[0..51] of LongInt;
s:ansistring;
q:Longint;
res:int64;
find:boolean;

procedure Can(x,prev:LongInt);
begin
  if x=length(s)+1 then begin find:=true;exit;end;

  if a[x]<>prev then exit;
  can(x+1,(prev+a[x+1]) div 2);
  if (prev+a[x+1])mod 2=1 then
  can(x+1,(prev+a[x+1]) div 2+(prev+a[x+1]) mod 2);
end;

begin
   find:=false;
   readln(s);
   for i:=1 to length(s) do
     a[i]:=ord(s[i])-ord('0');

   fillchar(f,sizeof(f),0);
   for i:=0 to 9 do
     f[1,i]:=1;

   for i:=1 to length(s)  do
   begin
     for j:=0 to 9 do
     begin
     //  writeln(i,' ',j,' ',f[i,j]);
       q:=(j+a[i+1])div 2;
         f[i+1,q]:=f[i+1,q]+f[i,j];
       if ((j+a[i+1])mod 2)=1 then
         f[i+1,q+1]:=f[i+1,q+1]+f[i,j];
     end;
   end;

   res:=0;
   for j:=0 to 9 do
     inc(res,f[length(S),j]);

   for i:=0 to 9 do
   begin
     Can(1,i);
   end;
   if find then dec(res);
   writeln(res);
end.

{const
    fi='44H.INP';
    fo='44H.OUT';}
var
    f:text;
    s:String;
    i,j,tg,tmp:longint;
    sum,x,y:int64;
    ok:boolean;
    a:array[0..50,0..9] of int64;
begin
    //assign(f,fi);reset(f);
        readln(s);
    // close(f);
    //assign(f,fo);rewrite(f);
        for i:=0 to 9 do a[1,i]:=1;
        ok:=true;
        for i:=1 to length(s)-1 do
            for j:=0 to 9 do
            begin
                val(s[i+1],tmp);
                tg:=(j+tmp);
                if not odd(tg) then
                    a[i+1,tg div 2]:=a[i+1,tg div 2]+a[i,j]
                    else
                        begin
                            a[i+1,tg div 2]  :=a[i+1,tg div 2]  +a[i,j];
                            a[i+1,tg div 2+1]:=a[i+1,tg div 2+1]+a[i,j];
                        end;
            end;

        for j:=0 to 9 do sum:=sum+a[length(s),j];

        for i:=2 to length(s) do
        begin
            val(s[i],x);
            val(s[i-1],y);
            if (x<>(x+y) div 2) and (x<>(x+y+1) div 2) then ok:=false;
        end;
        if ok then dec(sum);
        write(sum);
    //close(f);
end.

var s:string;
    a:array[1..55] of integer;
    f:array[1..55,0..9] of int64;
    i,j,k:longint;
    ok:boolean;
    kq:int64;
begin
    readln(s);
    for i:=1 to length(s) do a[i]:=ord(s[i])-48;
    fillchar(f,sizeof(f),0);
    for i:=0 to 9 do f[1][i]:=1;
    for i:=2 to length(s) do
    for j:=0 to 9 do
    begin
        k:=a[i]+j;
        f[i][k div 2]:=f[i][k div 2] +f[i-1][j];
        if (k mod 2=1) then  f[i][k div 2+1]:=f[i][k div 2+1]+f[i-1][j];
    end;
    kq:=0;
    for i:=0 to 9 do kq:=kq+f[length(s)][i];
    ok:=true;
    for i:=2 to length(s) do
    if ((a[i]<>(a[i]+a[i-1]) div 2) and (a[i]<>(a[i]+a[i-1]+1) div 2))
    then ok:=false;
    if (ok) then  dec(kq);
    write(kq);
end.

var s:ansistring;
    n,i,x,j,z:longint;
    a:array[1..55] of longint;
    f:array[0..1,0..10] of int64;
    d:array[1..55,0..9,0..9] of boolean;
    re:int64;

function check:boolean;
var i:longint;
begin
     for i:=2 to n do
         if not d[i,a[i-1],a[i]] then
         begin
              check:=false; exit;
         end;
     check:=true;
end;

begin
     readln(s);
     n:=length(s);
     for i:=1 to n do a[i]:=ord(s[i])-48;
     fillchar(f,sizeof(f),0);
     for i:=0 to 9 do f[1,i]:=1;
     z:=1;
     fillchar(d,sizeof(d),false);
     for i:=2 to n do
     begin
       z:=i and 1;
       fillchar(f[z],sizeof(f[z]),0);
       for j:=0 to 9 do
       begin
            x:=j+a[i];
            inc(f[z,x div 2],f[1-z,j]);
            d[i,j,x div 2]:=true;
            if odd(x) then
            begin
                 inc(f[z,x div 2+1],f[1-z,j]);
                 d[i,j,x div 2+1]:=true;
            end;
       end;
     end;
     re:=0;
     for i:=0 to 9 do re:=re+f[z,i];
     if check then dec(re);
     writeln(re);
end.

program Project1;

{$APPTYPE CONSOLE}
{$O-}

uses
  SysUtils, Math;

var
  a: array [-10..100, -10..100] of Int64;
  h: array [-10..100] of Byte;
  st: String;
  n1, digit, ans: Int64;
  i, x : integer;
  fl : boolean;

function f(x, n : integer) : int64;
begin
  if a[x, n] > 0 then
  begin
    result := a[x, n];
    exit;
  end;

  if n = 0 then
  begin
    result := 1;
    a[x, n] := 1;
    exit;
  end;

  if not odd(x + h[n1 - n + 1]) then
    result :=f((x + h[n1 - n + 1])div 2, n - 1)
  else
    result :=f((x + h[n1 - n + 1])div 2, n - 1) + f((x + h[n1 - n + 1])div 2 + 1, n - 1);

  a[x, n] := result;
end;

begin
{
  Assign(Input, 'input.txt');
  Reset(Input);
  Assign(Output, 'output.txt');
  Rewrite(Output);
}
  Readln(st);
  n1 := Length(st);
  for i := 1 to n1 do
  begin
    h[i] := strtoint(st[i]);
  end;

  fl := false;
  for x := 1 to n1 - 1 do
  begin
    if ((h[x] + h[x + 1]) div 2 <> h[x + 1]) and ((h[x] + h[x + 1]) div 2 + (h[x] + h[x + 1]) mod 2 <> h[x + 1]) then
    fl := true;
  end;

  ans := 0;
  if not fl then dec(ans);

  for x := 0 to 9 do
  begin
    inc(ans, f(x, n1 - 1));
  end;

  writeln(max(ans, 0));

end.

{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O-,P+,Q-,R-,S-,T-,U-,V+,W-,X+,Y+,Z1}

{$APPTYPE CONSOLE}

uses
  SysUtils;

type
  int = integer;

var
  a : array[0..202, 0..10] of int64;
  i, j, n: int;
  s : string;

procedure init;
begin
  readln(s);
  n := length(s);
  fillchar(a, sizeof(a), 0);
  for i := 0 to 9 do
    a[1, i] := 1;
end;

procedure main;
var
  i, j, x : integer;
  ans : int64;
  l : boolean;
begin
  for i := 2 to n do begin
    for j := 0 to 9 do begin
      x := ord(s[i]) - ord('0') + j;
      if x mod 2 = 0 then begin
        a[i, x div 2] := a[i, x div 2] + a[i - 1, j];
      end
      else begin
        a[i, (x div 2) + 1] := a[i, (x div 2) + 1] + a[i - 1, j];
        a[i, x div 2] := a[i, x div 2] + a[i - 1, j];
      end;
    end;
  end;
  ans := 0;
  for i := 0 to 9 do
    ans := ans + a[n, i];
  l := true;
  for i := 2 to n do
    if abs((ord(s[i]) - ord('0')) - (ord(s[i - 1]) - ord('0'))) > 1 then begin
      l := false;
      break;
    end;
  if l then
    ans := ans - 1;
  writeln(ans);
end;

begin
  //reset(input, 'input.txt');
 // rewrite(output, 'output.txt');

  init;
  main;

  //close(input);
  //close(output);
end.

var
   s : string;
   i,j,n : longint;
   sum : int64;
   sr : extended;
   a : array[0..1000,0..1000] of int64;
   f : boolean;
begin
   readln(s);
   n := length(s);
   for j := 0 to 9 do
      a[1,j] := 1;
   for i := 2 to n do
   begin
      for j := 0 to 9 do
      begin
         sr := (j + (ord(s[i]) - 48)) / 2;
         if sr <> trunc(sr) then
         begin
            a[i,trunc(sr)] := a[i,trunc(sr)] + a[i-1,j];
             a[i,trunc(sr) + 1] := a[i,trunc(sr) + 1] + a[i-1,j];
         end else
            a[i,trunc(sr)] :=  a[i,trunc(sr)] + a[i-1,j];
      end;
   end;
   sum := 0;
   for j := 0 to 9 do
      sum := sum + a[n,j];
   f := true;
   for i := 2 to n do
     begin
       sr := ord(s[i]) - 48 + ord(s[i - 1]) - 48;
       sr := sr / 2;
       if sr = round(sr) then
         if (trunc(sr) <> ord(s[i]) - 48) then f := false;

       if sr <> round(sr) then
         if (trunc(sr) <> ord(s[i]) - 48)
         and (trunc(sr) + 1 <> ord(s[i]) - 48)
         then f := false;
     end;
   if f then dec(sum);
   write(sum);
end.

const   INPUT = '';
        OUTPUT = '';
        MAX_N = 60;

var fi,fo:text;
    n:longint;
    a:array[0..MAX_N] of longint;

procedure   enter;
var i:longint;
    s:string;
begin
    readln(fi,s);
    n:=length(s);
    for i:=1 to length(s) do a[i]:=ord(s[i])-ord('0');
end;

function    check:boolean;
var i,j,k:longint;
begin
    j:=a[1];
    for i:=2 to n do begin
        k:=(j+a[i]) div 2;
        if (k <> a[i]) and (k+1 <> a[i]) then exit(false);
        j:=a[i];
    end;
    exit(true);
end;

procedure   solve;
var i,j,k,r:longint;
    res:int64;
    ok:boolean;
    f:array[0..MAX_N,0..9] of int64;
begin
    if check = true then res:=-1
    else res:=0;

    for j:=0 to 9 do f[n][j]:=1;
    for i:=n-1 downto 1 do
        for j:=0 to 9 do begin
            k:=(j+a[i+1]) div 2;
            if (j+a[i+1]) mod 2 = 0 then f[i][j]:=f[i+1][k]
            else f[i][j]:=f[i+1][k]+f[i+1][k+1];
        end;

    for j:=0 to 9 do begin
        k:=j;   ok:=true;
        for i:=2 to n do
            if (k+a[i]) mod 2 = 1 then begin
                ok:=false;
                break;
            end
            else k:=(k+a[i]) div 2;
        if ok = true then res:=res+1
        else res:=res+f[i-1][k];
    end;
    writeln(fo,res);
end;

begin
    assign(fi,INPUT);   reset(fi);
    assign(fo,OUTPUT);  rewrite(fo);
    enter;
    solve;
    close(fo);
    close(fi);
end.

  CONST
                fi      =       '';//44H.inp';
                fo      =       '';//44H.out';
                mmax    =       50;

  VAR
                ff      :       array [1.. mmax, 0.. 9] of int64;
                a       :       array [1.. mmax] of longint;
                n, res  :       int64;
                f, g    :       text;

  procedure   openf;
     begin
        assign(f, fi);   reset(f);
        assign(g, fo);   rewrite(g);
     end;

  procedure    closef;
     begin
        close(f);   close(g);
     end;

  procedure    readf;
     var
        k: char;
     begin
        while not eoln(f) do
           begin
              read(f, k);
              inc(n);
              a[n]:= ord(k)- ord('0');
           end;
     end;

  procedure    process;
     var
        i, j, k: longint;
        ko     : boolean;
     begin
        for i:= 0 to 9 do
           ff[1, i]:= 1;

        for i:= 2 to n do
           for j:= 0 to 9 do
              begin
                 k:= j* 2- a[i];
                 if (k >= 0) and(k< 10) then
                    ff[i, j]:= ff[i- 1, k];
                 k:= j* 2- a[i]- 1;
                 if (k>= 0) and(k< 10) then
                    ff[i, j]:= ff[i, j]+ ff[i- 1, k];
                 k:= j* 2- a[i]+ 1;
                 if (k>= 0) and(k< 10) then
                    ff[i, j]:= ff[i, j]+ ff[i- 1, k];
              end;

        for i:= 0 to 9 do
            res:= res+ ff[n, i];
        ko:= true;
        for i:= 2 to n do
           begin
              j:= a[i- 1]+ a[i];
              if  (j div 2<> a[i]) and((j- 1) div 2<> a[i]) and((j+ 1) div 2<> a[i]) then
                 begin
                    ko:= false;
                    break;
                 end;
           end;

        if ko then
           dec(res);

        write(res);
     end;

     BEGIN
          openf;
          readf;
          process;
          closef;
     END.

program aa;
 var j,b,i,n,c,m,k,d:longint;e,r,s:string;t,x,y:array[-1..55] of int64;
   q,w:char;f:boolean;z:array[0..9,0..9,1..2] of integer;a:int64;
   label 1;
begin
{ assign(input,'input.txt');reset(input);
 assign(output,'output.txt');rewrite(output);}
  r:='123456789';
  read(s);
  n:=length(s);
  for i:=0 to 9 do
  for j:=0 to 9 do
  begin
   z[i,j,1]:=(i+j)div 2;
   if odd(i+j) then z[i,j,2]:=z[i,j,1]+1 else z[i,j,2]:=-1

  end;
  for i:=1 to n do t[i]:=pos(s[i],r);
  k:=1;
  for i:=1 to n-1 do if abs(t[i]-t[i+1])>1 then k:=0;
  for i:=0 to 9 do x[i]:=1;
  for i:=2 to n do
  begin
   for j:=-1 to 9 do y[j]:=0;
   for j:=0 to 9 do
   begin
   y[z[j,t[i],1]]:=y[z[j,t[i],1]]+x[j];
   y[z[j,t[i],2]]:=y[z[j,t[i],2]]+x[j];
   end;
   x:=y;
  end;
  a:=0;
  for i:=0 to 9 do
  a:=a+x[i];
  write(a-K);

                            {
 close(input);close(output);                   }
end.

program Project4;

{$APPTYPE CONSOLE}
{$R+,S+,Q+}

uses
  SysUtils;

var
  can: array[1..501, 0..90] of int64;
  len, i: integer;
  sum: int64;
  s: string;
  f: boolean;

begin
  fillchar(can, sizeof(can), 0);

  {reset(input, 'input.txt');
  rewrite(output, 'output.txt');  }

  readln(s);
  for i := 0 to 9 do
    can[1, i] := 1;

  for len := 1 to length(s) - 1 do
    for i := 0 to 9 do begin
      if (i + strtoint(s[len + 1])) mod 2 = 0 then
        can[len + 1, (i + strtoint(s[len + 1])) div 2] := can[len + 1, (i + strtoint(s[len + 1])) div 2] + can[len, i]
      else begin
        can[len + 1, (i + strtoint(s[len + 1])) div 2] := can[len + 1, (i + strtoint(s[len + 1])) div 2] + can[len, i];
        can[len + 1, (i + strtoint(s[len + 1])) div 2 + 1] := can[len + 1, (i + strtoint(s[len + 1])) div 2 + 1] + can[len, i];
      end;
    end;

  sum := 0;
  for i := 0 to 9 do
    sum := sum + can[length(s), i];

  f := true;
  for i := 1 to length(s) - 1 do begin
    if abs((strtoint(s[i]) + strtoint(s[i + 1])) / 2 - strtoint(s[i + 1])) >= 1 then begin
      f := false;
      break;
    end;
  end;

  if f then
    dec(sum);

  writeln(sum);
end.

{ fp }
Uses sysutils;
VAr
 s:string;
 last,i,j,n:Longint;
 ans : int64;
 a : array[0..52] of longint;
 b : array[0..51,0..9] of int64;
 p : integer;
 ok : Boolean;

 function go(last,x:Longint):int64;
  VAr
   ans:int64;
  Begin
   If x=n+1 then
    Begin
     go := 1;
     exit;
    End;
   If b[x,last]=-1 then
    Begin
     ans := go((last+a[x]) div 2,x+1);
     If (last+a[x]) mod 2=1 then
      ans := ans+go((last+a[x]) div 2+1,x+1);
     b[x,last] := ans;
    End;
   go := b[x,last];
  End;

 Begin
  readLn(s);
  n := length(s);
  For i :=1 to n do
   val(s[i],a[i],p);
  For i := 1 to n do
   For j := 0 to 9 do
    b[i,j] := -1;
  For i := 0 to  9 do
   Begin
    ans :=ans+go(i,2);
   End;
  last := a[1];
  ok := true;
  For i := 2 to n do
   Begin
    last := last+a[i];
    If (last div 2=a[i]) or ((last+1) div 2=a[i]) then  last := a[i]
     else
      Begin
       ok := false;
       break;
      End;
   End;
  If ok then ans := ans-1;
  WriteLn(ans);
 End.

program pr1;

{$APPTYPE CONSOLE}

uses
  SysUtils;

const nn=50{1024};eps=0; label 1;
type mas=array[0..nn] of longint;
var tt,t,t1,imax,n,p,k,l,m,n1,k1,ot,name2,i1:int64;
  b,a1,b1,dl,dr,hl,hr:mas; flag:boolean;  pl:longint;
  i,j,step:longint;
 name:array [0..nn,0..nn] of string ;
 spname :array[0..nn] of string;
  ch:char;
 sc,time:array[0..nn] of longint;
 variant:array[0..nn,0..nn] of int64;
 a:array[0..nn] of int64;
  ss:string;
  fl:array[0..nn] of boolean;

 begin
{assign(input,'input.txt');reset(input);
assign(output,'output1234.txt');rewrite(output);
}readln (ss);  n:=length(ss);
for i:=1 to n do a[i]:=ord(ss[i])-48;
{for i:=1 to n do write(a[i],' ');  writeln;writeln;
}for i:=0 to 9 do variant[1,i]:=1;  variant[1,9]:=1;
for step:=1 to n-1 do for i:=0 to 9 do
  begin   i1:=i;
     t:=i+a[step+1]; t1:=t div 2;
       if not odd(t) then
         begin
          variant[step+1,t1]:=variant[step+1,t1]+variant[step,i];
         end;
       if  odd(t) then
        begin
               variant[step+1,t1]:=variant[step+1,t1]+variant[step,i];
               variant[step+1,t1+1]:=variant[step+1,t1+1]+variant[step,i];
        end;
  end;
 for step:=1 to n do
 {begin for i:=0 to 9 do  write(variant[step,i],' ');writeln;             end;
 }
ot:=0; for i:=0 to 9 do ot:=ot+variant[n,i];
flag:=true;
tt:=a[1];
for i:=2 to n do
  begin
      if (not odd(a[i]+a[i-1])) and ((a[i]+a[i-1])div 2 <>a[i]) then flag:=false;
      if (odd(a[i]+a[i-1])) and ((a[i]+a[i-1])div 2 <>a[i])and ((a[i]+a[i-1])div 2+1 <>a[i])  then flag:=false;
  end;

if flag then dec(ot);
writeln(ot);

 1: close (output);
end.

type TYP=array[0..51] of int64;
var s:String;
    a,b:TYP;
    i,j,n,zifr:longint;
    t:extended;
    rez:int64;
    lik,lik1,lik2:longint;
    pp:boolean;
function FUNCT(a:TYP):int64;
var i,j,t,k1,k2:longint;
    res:int64;
    k:extended;
    mas:array[0..10,0..51] of int64;
begin
res:=0;
Fillchar(mas,sizeof(mas),0);
mas[zifr,1]:=1;
 for i:= 2 to n do
 begin
  for j:= 0 to 9 do
   begin
    k:=(j+a[i])/2;
    if frac(k)<0.0000001 then begin
                       t:=trunc(k);
                       mas[t,i]:=mas[j,i-1]+mas[t,i];
                      end else
                      begin
                       k:=k-frac(k);
                       k1:=trunc(k);
                       k2:=k1+1;
                       mas[k1,i]:=mas[j,i-1]+mas[k1,i];
                       mas[k2,i]:=mas[j,i-1]+mas[k2,i];
                      end;
   end;
 end;
 res:=0;
 for i:= 0 to 9 do
 res:=res+mas[i,n];
Funct:=res;
end;

begin
readln(s);
rez:=0;
for i:= 1 to length(s) do
a[i]:=ord(s[i])-ord('0');
n:=length(s);
for zifr:=0 to 9 do begin
rez:=rez+FUNCT(a);
//writeln(FUNCT(a));
end;
Fillchar(b,sizeof(b),0);
b[1]:=a[1];    lik:=0;
pp:=true;
for i:= 2 to n do
begin
 t:=(b[i-1]+a[i])/2;
 if frac(t)<0.000001 then begin
                    lik:=trunc(t);
                    if lik<>a[i] then pp:=false;
                    b[i]:=a[i];
                   end else
                   begin
                    t:=t-frac(t);
                    lik1:=trunc(t);
                    lik2:=lik1+1;
                    if (lik1<>a[i]) and (lik2<>a[i]) then pp:=false;
                    b[i]:=a[i];
                   end;
end;
if pp then rez:=rez-1;
writeln(rez);
end.

program JJ_Mybabe;
  {$APPTYPE CONSOLE}  {$o-} {$R+}
uses SysUtils,Math;
var
    i,j,p,m:integer;
    k:int64;
    s:string;
    b:array[1..50] of integer;
    a:array[1..50,0..9] of int64;
begin
 //reset(input,'input.txt');
// rewrite(output,'output.txt');
 read(s);
 for i:=1 to length(s) do
   b[i]:=strtoint(s[i]);
 for i:=0 to 9 do a[1][i]:=1;
 for i:=2 to length(S) do
   for j:=0 to 9 do
   begin
     k:=(j+b[i]);
     a[i][k div 2]:=a[i][k div 2]+a[i-1][j];
     if (j+b[i]) mod 2<>0 then
       a[i][k div 2+1]:=a[i][k div 2+1]+a[i-1][j];
   end;
 k:=0;
 for i:=0 to 9 do
   k:=k+a[length(s)][i];
 for i:=2 to length(s) do
 begin
   p:=(b[i]+b[i-1]);
   if p mod 2 =0 then
     if p div 2<>b[i] then m:=1;
   if p mod 2<>0 then
     if (p div 2<>b[i]) and (p div 2+1<>b[i]) then m:=1;
 end;
 if m=0 then dec(k);
 write(k);
end.

var
  n, i, j, i1, j1: longint;
  sum: int64;
  s: string;
  a: array[1..100] of int64;
  b: array[1..100, 0..9] of int64;
  q: boolean;

begin
  readln(s);
  n := length(s);
  for i := 1 to n do
    a[i] := ord(s[i]) - ord('1') + 1;

  sum := 0;
  for i := 0 to 9 do
  begin

    b[1, i] := 1;
    for j := 2 to n do
      for i1 := 0 to 9 do
      begin
        if (i1 + a[j]) mod 2 = 0 then
          b[j, (i1 + a[j]) div 2] := b[j, (i1 + a[j]) div 2] + b[j - 1, i1];
        if (i1 + a[j]) mod 2 = 1 then
        begin
          b[j, (i1 + a[j]) div 2] := b[j, (i1 + a[j]) div 2] + b[j - 1, i1];
          b[j, (i1 + a[j]) div 2 + 1] := b[j, (i1 + a[j]) div 2 + 1] + b[j - 1, i1];
        end;
      end;

    for i1 := 0 to 9 do
    sum := sum + b[n, i1];
    for i1 := 1 to n do
      for j1 := 0 to 9 do
        b[i1, j1] :=0;
  end;

  q := true;
  for i := 1 to n - 1 do
    if not (((a[i] - a[i + 1]) <= 1) and (a[i] - a[i + 1] >= -1)) then q := false;
  if q then dec(sum);
  writeln(sum);
end.

{const
    fi='44H.INP';
    fo='44H.OUT';}
var
    f:text;
    s:String;
    i,j,tg,tmp:longint;
    sum,x,y:longint;
    ok:boolean;
    a:array[0..50,0..9] of longint;
begin
    //assign(f,fi);reset(f);
        readln(s);
    // close(f);
    //assign(f,fo);rewrite(f);
        for i:=0 to 9 do a[1,i]:=1;
        ok:=true;
        for i:=1 to length(s)-1 do
            for j:=0 to 9 do
            begin
                val(s[i+1],tmp);
                tg:=(j+tmp);
                if not odd(tg) then
                    a[i+1,tg div 2]:=a[i+1,tg div 2]+a[i,j]
                    else
                        begin
                            a[i+1,tg div 2]  :=a[i+1,tg div 2]  +a[i,j];
                            a[i+1,tg div 2+1]:=a[i+1,tg div 2+1]+a[i,j];
                        end;
            end;

        for j:=0 to 9 do sum:=sum+a[length(s),j];

        for i:=2 to length(s) do
        begin
            val(s[i],x);
            val(s[i-1],y);
            if (x<>(x+y) div 2) and (x<>(x+y+1) div 2) then ok:=false;
        end;
        if ok then dec(sum);
        write(sum);
    //close(f);
end.

var
    s:String;
    i,j,chan,le,tg,tmp:longint;
    ca,l,sum:longint;
    a:array[-1..9,-1..50] of longint;
begin

        readln(s);
        for i:=0 to 9 do
        begin
            if odd(i) then le:=1 else chan:=1;
            for j:=2 to length(s)  do
            begin
                a[i,j]:=a[i-1,j];
                val(s[j],tg);
                if odd(tg) then
                begin
                    ca:=le;
                    l:=chan*2;
                end else
                    begin
                        ca:=chan;
                        l:=le*2;
                    end;
                a[i,j]:=a[i,j]+ca+l;
                chan:=ca;
                le:=l
            end;
        end;
        writeln(a[9,length(s)]);
end.

var s:ansistring;
    n,i,x,j,z:longint;
    a:array[1..55] of longint;
    f:array[0..1,0..10] of int64;
    d:array[1..55,0..9,0..9] of boolean;
    re:int64;

function check:boolean;
var i:longint;
begin
     for i:=2 to n do
         if not d[i,a[i-1],a[i]] then
         begin
              check:=false; exit;
         end;
     check:=true;
end;

begin
     readln(s);
     n:=length(s);
     for i:=1 to n do a[i]:=ord(s[i])-48;
     fillchar(f,sizeof(f),0);
     for i:=0 to 9 do f[1,i]:=1;
     fillchar(d,sizeof(d),false);
     for i:=2 to n do
     begin
       z:=i and 1;
       fillchar(f[z],sizeof(f[z]),0);
       for j:=0 to 9 do
       begin
            x:=j+a[i];
            inc(f[z,x div 2],f[1-z,j]);
            d[i,j,x div 2]:=true;
            if odd(x) then
            begin
                 inc(f[z,x div 2+1],f[1-z,j]);
                 d[i,j,x div 2+1]:=true;
            end;
       end;
     end;
     re:=0;
     for i:=0 to 9 do re:=re+f[z,i];
     if check then dec(re);
     writeln(re);
end.

var s:string;
    n,i,x,j:longint;
    a:array[1..55] of longint;
    f:array[1..55,0..10] of longint;
    d:array[1..55,0..9,0..9] of boolean;
    re:longint;

function check:boolean;
var i:longint;
begin
     for i:=2 to n do
         if not d[i,a[i-1],a[i]] then
         begin
              check:=false; exit;
         end;
     check:=true;
end;

begin
     readln(s);
     n:=length(s);
     for i:=1 to n do a[i]:=ord(s[i])-48;
     fillchar(f,sizeof(f),0);
     for i:=0 to 9 do f[1,i]:=1;
     fillchar(d,sizeof(d),false);
     for i:=2 to n do
       for j:=0 to 9 do
       begin
            x:=j+a[i];
            inc(f[i,x div 2],f[i-1,j]);
            d[i,j,x div 2]:=true;
            if odd(x) then
            begin
                 inc(f[i,x div 2+1],f[i-1,j]);
                 d[i,j,x div 2+1]:=true;
            end;
       end;
     re:=0;
     for i:=0 to 9 do re:=re+f[n,i];
     if check then dec(re);
     writeln(re);
end.

  CONST
                fi      =       '';//44H.inp';
                fo      =       '';//44H.out';
                mmax    =       50;

  VAR
                ff      :       array [1.. mmax, 0.. 9] of longint;
                a       :       array [1.. mmax] of longint;
                n, res  :       longint;
                f, g    :       text;

  procedure   openf;
     begin
        assign(f, fi);   reset(f);
        assign(g, fo);   rewrite(g);
     end;

  procedure    closef;
     begin
        close(f);   close(g);
     end;

  procedure    readf;
     var
        k: char;
     begin
        while not eoln(f) do
           begin
              read(f, k);
              inc(n);
              a[n]:= ord(k)- ord('0');
           end;
     end;

  procedure    process;
     var
        i, j, k: longint;
        ko     : boolean;
     begin
        for i:= 0 to 9 do
           ff[1, i]:= 1;

        for i:= 2 to n do
           for j:= 0 to 9 do
              begin
                 k:= j* 2- a[i];
                 if (k >= 0) and(k< 10) then
                    ff[i, j]:= ff[i- 1, k];
                 k:= j* 2- a[i]- 1;
                 if (k>= 0) and(k< 10) then
                    ff[i, j]:= ff[i, j]+ ff[i- 1, k];
                 k:= j* 2- a[i]+ 1;
                 if (k>= 0) and(k< 10) then
                    ff[i, j]:= ff[i, j]+ ff[i- 1, k];
              end;

        for i:= 0 to 9 do
            res:= res+ ff[n, i];
        ko:= true;
        for i:= 2 to n do
           begin
              j:= a[i- 1]+ a[i];
              if  (j div 2<> a[i]) and((j- 1) div 2<> a[i]) and((j+ 1) div 2<> a[i]) then
                 begin
                    ko:= false;
                    break;
                 end;
           end;

        if ko then
           dec(res);

        write(res);
     end;

     BEGIN
          openf;
          readf;
          process;
          closef;
     END.

  CONST
                fi      =       '';//44H.inp';
                fo      =       '';//44H.out';
                mmax    =       50;

  VAR
                ff      :       array [1.. mmax, 0.. 9] of int64;
                a       :       array [1.. mmax] of longint;
                n, res  :       longint;
                f, g    :       text;

  procedure   openf;
     begin
        assign(f, fi);   reset(f);
        assign(g, fo);   rewrite(g);
     end;

  procedure    closef;
     begin
        close(f);   close(g);
     end;

  procedure    readf;
     var
        k: char;
     begin
        while not eoln(f) do
           begin
              read(f, k);
              inc(n);
              a[n]:= ord(k)- ord('0');
           end;
     end;

  procedure    process;
     var
        i, j, k: longint;
        ko     : boolean;
     begin
        for i:= 0 to 9 do
           ff[1, i]:= 1;

        for i:= 2 to n do
           for j:= 0 to 9 do
              begin
                 k:= j* 2- a[i];
                 if (k >= 0) and(k< 10) then
                    ff[i, j]:= ff[i- 1, k];
                 k:= j* 2- a[i]- 1;
                 if (k>= 0) and(k< 10) then
                    ff[i, j]:= ff[i, j]+ ff[i- 1, k];
                 k:= j* 2- a[i]+ 1;
                 if (k>= 0) and(k< 10) then
                    ff[i, j]:= ff[i, j]+ ff[i- 1, k];
              end;

        for i:= 0 to 9 do
            res:= res+ ff[n, i];
        ko:= true;
        for i:= 2 to n do
           begin
              j:= a[i- 1]+ a[i];
              if  (j div 2<> a[i]) and((j- 1) div 2<> a[i]) and((j+ 1) div 2<> a[i]) then
                 begin
                    ko:= false;
                    break;
                 end;
           end;

        if ko then
           dec(res);

        write(res);
     end;

     BEGIN
          openf;
          readf;
          process;
          closef;
     END.

  CONST
                fi      =       '';//44H.inp';
                fo      =       '';//44H.out';
                mmax    =       50;

  VAR
                ff      :       array [1.. mmax, 0.. 9] of longint;
                a       :       array [1.. mmax] of longint;
                n, res  :       longint;
                f, g    :       text;

  procedure   openf;
     begin
        assign(f, fi);   reset(f);
        assign(g, fo);   rewrite(g);
     end;

  procedure    closef;
     begin
        close(f);   close(g);
     end;

  procedure    readf;
     var
        k: char;
     begin
        while not eoln(f) do
           begin
              read(f, k);
              inc(n);
              a[n]:= ord(k)- ord('0');
           end;
     end;

  procedure    process;
     var
        i, j, k: longint;
     begin
        for i:= 0 to 9 do
           ff[1, i]:= 1;

        for i:= 2 to n do
           for j:= 0 to 9 do
              begin
                 k:= j* 2- a[i];
                 if (k >= 0) and(k< 10) then
                    ff[i, j]:= ff[i- 1, k];
                 k:= j* 2- a[i]- 1;
                 if (k>= 0) and(k< 10) then
                    ff[i, j]:= ff[i, j]+ ff[i- 1, k];
                 k:= j* 2- a[i]+ 1;
                 if (k>= 0) and(k< 10) then
                    ff[i, j]:= ff[i, j]+ ff[i- 1, k];
              end;

        for i:= 0 to 9 do
            res:= res+ ff[n, i];

        for i:= 2 to n do
           begin
              j:= a[i- 1]+ a[i];
              if (j div 2<> a[i]) and((j- 1) div 2<> a[i]) and((j+ 1) div 2<> a[i]) then
                 begin
                    break;
                 end;
           end;

        if i= n then
           dec(res);

        write(res);
     end;

     BEGIN
          openf;
          readf;
          process;
          closef;
     END.

{ fp }
VAr
 s:string;
 last,ans,i,n:Longint;
 a : array[0..50] of longint;
 p : integer;
 ok : Boolean;

 Procedure go(last,x:Longint);
  Begin
   If x=n+1 then
    Begin
     inc(ans);
     exit;
    End else
    Begin
     go((last+a[x]) div 2,x+1);
     If (last+a[x]) mod 2=1 then
      go((last+a[x]) div 2+1,x+1);
    End;
  End;

 Begin
  readLn(s);
  n := length(s);
  For i :=1 to n do
   val(s[i],a[i],p);
  For i := 0 to  9 do
   go(i,2);
  last := 1;
  ok := true;
  For i := 2 to n do
   Begin
    last := last+a[i];
    If (last div 2=a[i]) or ((last+1) div 2=a[i]) then  last := a[i]
     else
      Begin
       ok := false;
       break;
      End;
   End;
  If ok then dec(ans);
  WriteLn(ans);
 End.

type TYP=array[0..51] of int64;
var s:String;
    a,b:TYP;
    i,j,n,zifr:longint;
    t:extended;
    rez:int64;
    lik,lik1,lik2:longint;
    pp:boolean;
function FUNCT(a:TYP):int64;
var i,j,t,k1,k2:longint;
    res:int64;
    k:extended;
    mas:array[0..10,0..51] of int64;
begin
res:=0;
Fillchar(mas,sizeof(mas),0);
mas[zifr,1]:=1;
 for i:= 2 to n do
 begin
  for j:= 0 to 9 do
   begin
    k:=(j+a[i])/2;
    if frac(k)<0.0000001 then begin
                       t:=trunc(k);
                       mas[t,i]:=mas[j,i-1]+mas[t,i];
                      end else
                      begin
                       k:=k-frac(k);
                       k1:=trunc(k);
                       k2:=k1+1;
                       mas[k1,i]:=mas[j,i-1]+mas[k1,i];
                       mas[k2,i]:=mas[j,i-1]+mas[k2,i];
                      end;
   end;
 end;
 res:=0;
 for i:= 0 to 9 do
 res:=res+mas[i,n];
Funct:=res;
end;

begin
readln(s);
rez:=0;
for i:= 1 to length(s) do
a[i]:=ord(s[i])-ord('0');
n:=length(s);
for zifr:=0 to 9 do begin
rez:=rez+FUNCT(a);
//writeln(FUNCT(a));
end;
Fillchar(b,sizeof(b),0);
b[1]:=a[1];    lik:=0;
pp:=true;
for i:= 2 to n do
begin
 t:=(b[i-1]+a[i])/2;
 if frac(t)<0.000001 then begin
                    lik:=trunc(t);
                    if lik<>a[i] then pp:=false;
                    b[i]:=a[i];
                   end else
                   begin
                    t:=t-frac(t);
                    lik1:=trunc(t)+1;
                    lik2:=lik1+1;
                    if (lik1<>a[i]) and (lik2<>a[i]) then pp:=false;
                    b[i]:=a[i];
                   end;
end;
if pp then rez:=rez-1;
writeln(rez);
end.

type TYP=array[0..51] of longint;
var s:String;
    a,b:TYP;
    i,j,n,k,m,zifr,rez:longint;
    t:extended;
    lik,lik1,lik2:longint;
    pp:boolean;
function FUNCT(a:TYP):longint;
var res,i,j,t,k1,k2:longint;
    k:extended;
    mas:array[0..10,1..50] of longint;
begin
res:=0;
Fillchar(mas,sizeof(mas),0);
mas[zifr,1]:=1;
 for i:= 2 to n do
 begin
  for j:= 0 to 9 do
   begin
    k:=(j+a[i])/2;
    if frac(k)=0 then begin
                       t:=trunc(k);
                       mas[t,i]:=mas[j,i-1]+mas[t,i];
                      end else
                      begin
                       k:=k-frac(k);
                       k1:=trunc(k);
                       k2:=k1+1;
                       mas[k1,i]:=mas[j,i-1]+mas[k1,i];
                       mas[k2,i]:=mas[j,i-1]+mas[k2,i];
                      end;
   end;
 end;
 res:=0;
 for i:= 0 to 9 do
 res:=res+mas[i,n];
Funct:=res;
end;

begin
readln(s);
rez:=0;
for i:= 1 to length(s) do
a[i]:=ord(s[i])-ord('0');
n:=length(s);
for zifr:=0 to 9 do begin
rez:=rez+FUNCT(a);
//writeln(FUNCT(a));
end;
Fillchar(b,sizeof(b),0);
b[1]:=a[1];    lik:=0;
pp:=true;
for i:= 2 to n do
begin
 t:=(b[i-1]+a[i])/2;
 if frac(t)=0 then begin
                    lik:=trunc(t);
                    if lik<>a[i] then pp:=false;
                    b[i]:=a[i];
                   end else
                   begin
                    t:=t-frac(t);
                    lik1:=trunc(t)+1;
                    lik2:=lik1+1;
                    if (lik1<>a[i]) and (lik2<>a[i]) then pp:=false;
                    b[i]:=a[i];
                   end;
end;
if pp then dec(rez);
writeln(rez);
end.

type TYP=array[0..51] of longint;
var s:String;
    a,b:TYP;
    i,j,n,k,m,zifr:longint;
    t:extended;
    rez:int64;
    lik,lik1,lik2:longint;
    pp:boolean;
function FUNCT(a:TYP):int64;
var i,j,t,k1,k2:longint;
     res:int64;
    k:extended;
    mas:array[0..10,1..50] of int64;
begin
res:=0;
Fillchar(mas,sizeof(mas),0);
mas[zifr,1]:=1;
 for i:= 2 to n do
 begin
  for j:= 0 to 9 do
   begin
    k:=(j+a[i])/2;
    if frac(k)=0 then begin
                       t:=trunc(k);
                       mas[t,i]:=mas[j,i-1]+mas[t,i];
                      end else
                      begin
                       k:=k-frac(k);
                       k1:=trunc(k);
                       k2:=k1+1;
                       mas[k1,i]:=mas[j,i-1]+mas[k1,i];
                       mas[k2,i]:=mas[j,i-1]+mas[k2,i];
                      end;
   end;
 end;
 res:=0;
 for i:= 0 to 9 do
 res:=res+mas[i,n];
Funct:=res;
end;

begin
readln(s);
rez:=0;
for i:= 1 to length(s) do
a[i]:=ord(s[i])-ord('0');
n:=length(s);
for zifr:=0 to 9 do begin
rez:=rez+FUNCT(a);
//writeln(FUNCT(a));
end;
Fillchar(b,sizeof(b),0);
b[1]:=a[1];    lik:=0;
pp:=true;
for i:= 2 to n do
begin
 t:=(b[i-1]+a[i])/2;
 if frac(t)=0 then begin
                    lik:=trunc(t);
                    if lik<>a[i] then pp:=false;
                    b[i]:=a[i];
                   end else
                   begin
                    t:=t-frac(t);
                    lik1:=trunc(t)+1;
                    lik2:=lik1+1;
                    if (lik1<>a[i]) and (lik2<>a[i]) then pp:=false;
                    b[i]:=a[i];
                   end;
end;
if pp then dec(rez);
writeln(rez);
end.

type TYP=array[0..51] of longint;
var s:String;
    a,b:TYP;
    i,j,n,k,m,zifr,rez:longint;

function FUNCT(a:TYP):longint;
var res,i,j,t,k1,k2:longint;
    k:extended;
    mas:array[0..50,0..10] of longint;
begin
res:=0;
Fillchar(mas,sizeof(mas),0);
mas[1,zifr]:=1;
 for i:= 2 to n do
 begin
  for j:= 0 to 9 do
   begin
    k:=(j+a[i])/2;
    if frac(k)=0 then begin
                       t:=trunc(k);
                       mas[i,t]:=mas[i-1,j]+mas[i,t];
                      end else
                      begin
                       k:=k-frac(k);
                       k1:=trunc(k);
                       k2:=k1+1;
                       mas[i,k1]:=mas[i-1,j]+mas[i,k1];
                       mas[i,k2]:=mas[i-1,j]+mas[i,k2];
                      end;
   end;
 end;
 res:=0;
 for i:= 0 to 9 do
 res:=res+mas[n,i];
Funct:=res;
end;

begin
readln(s);
rez:=0;
for i:= 1 to length(s) do
a[i]:=ord(s[i])-ord('0')+1;
n:=length(s);
for zifr:=0 to 9 do
rez:=rez+FUNCT(a);
writeln(rez+1);
end.

type TYP=array[0..51] of longint;
var s:String;
    a,b:TYP;
    i,j,n,k,m,zifr,rez:longint;

function FUNCT(a:TYP):longint;
var res,i,j,t,k1,k2:longint;
    k:extended;
    mas:array[0..50,0..10] of longint;
begin
res:=0;
Fillchar(mas,sizeof(mas),0);
mas[1,zifr]:=1;
 for i:= 2 to n do
 begin
  for j:= 0 to 9 do
   begin
    k:=(j+a[i])/2;
    if frac(k)=0 then begin
                       t:=trunc(k);
                       mas[i,t]:=mas[i-1,j]+mas[i,t];
                      end else
                      begin
                       k:=k-frac(k);
                       k1:=trunc(k);
                       k2:=k1+1;
                       mas[i,k1]:=mas[i-1,j]+mas[i,k1];
                       mas[i,k2]:=mas[i-1,j]+mas[i,k2];
                      end;
   end;
 end;
 res:=0;
 for i:= 0 to 9 do
 res:=res+mas[n,i];
Funct:=res;
end;

begin
readln(s);
for i:= 1 to length(s) do
a[i]:=ord(s[i])-ord('0')+1;
n:=length(s);
for zifr:=0 to 9 do
rez:=rez+FUNCT(a);
writeln(rez+1);
end.

var S,S1:string;
    LS,ch,nech,k,oS,oS1:longint;
    A:array[0..50000] of string;

Procedure Rec(x:integer);
var i:integer;
    T:boolean;

begin
 if x=0
   then for i:=0 to 9 do
         begin
          S:=chr(i+48);
          Rec(1);
          S:='';
         end
   else if x=LS
          then begin
                i:=0; T:=True;
                while (i<=K) and T do
                 begin
                  if A[i]=S
                    then T:=False;
                  inc(i);
                 end;
                if T
                  then begin
                        inc(k);
                        A[i]:=S;
                       end;
               end
          else begin
                oS:=ord(S[x])-48;
                oS1:=ord(S1[x+1])-48;
                if (oS+oS1) and 1=0
                  then begin
                        inc(x);
                        S:=S+chr((oS+oS1) div 2+48);
                        Rec(x);
                       end
                  else begin
                        inc(x);
                        S:=S+chr((oS+oS1) div 2+48);
                        Rec(x);
                        delete(S,x,1);
                        S:=S+chr((oS+oS1) div 2+49);
                        Rec(x);
                       end;
               end;

end;

Begin

 read(S);

 LS:=Length(S);
 A[0]:=S; k:=0;
 S1:=S; S:='';
 Rec(0);

 writeln(k);

End.

var S:string;
    LS,k,k1,i:longint;
    A:array[1..50] of integer;
    B:array[1..50] of integer;
Procedure Rec(x:longint);
var i,oS,oS1:longint;
    T:boolean;

begin
 if x=0
   then for i:=0 to 9 do
         begin
          B[1]:=i;
          Rec(1);
         end
   else if x=LS
          then begin
                {i:=1;
                T:=False;
                while (i<=LS) and not T do
                 begin
                  if A[i]<>B[i]
                    then T:=True;
                  inc(i);
                 end;
                if T
                  then }inc(k);
               end
          else begin
                if (A[x+1]+B[x]) and 1=0
                  then begin
                        inc(x);
                        B[x]:=(A[x]+B[x-1]) shr 1;
                        Rec(x);
                       end
                  else begin
                        inc(x);
                        B[x]:=(A[x]+B[x-1]) shr 1;
                        Rec(x);
                        B[x]:=(A[x]+B[x-1]) shr 1+1;
                        Rec(x);
                       end;
               end;

end;

Begin

 read(S);

 LS:=Length(S);
 for i:=1 to LS do
   A[i]:=ord(S[i])-48;
 FillChar(B,SizeOf(B),0);
 Rec(0);
 writeln(k-1);

End.

var S:string;
    LS,k,i,xy,j,x:longint;
    A:array[1..50] of integer;
    B:array[0..9,1..50] of longint;
    T:boolean;

Begin

 read(S);

 LS:=Length(S);
 for i:=1 to LS do A[i]:=ord(S[i])-48;

 FillChar(B,SizeOf(B),0);
 for i:=0 to 9 do B[i,1]:=1;

 for i:=2 to LS do
   for j:=0 to 9 do
    begin
     xy:=A[i]+j;
     if xy and 1=0
       then B[xy shr 1,i]:=B[xy shr 1,i]+B[j,i-1]
       else begin
             B[xy shr 1+1,i]:=B[xy shr 1+1,i]+B[j,i-1];
             B[xy shr 1,i]:=B[xy shr 1,i]+B[j,i-1];
            end;
    end;
 for i:=0 to 9 do
   inc(k,B[i,LS]);

 x:=A[1]; T:=True;
 for i:=2 to LS do
  begin
   if (x+A[i]) and 1=0
     then begin
           x:=(x+A[i]) shr 1;
           if x<>A[i]
             then T:=False;
          end
     else if ((x+A[i]) shr 1=A[i]) or ((x+A[i]) shr 1+1=A[i])
             then if (x+A[i]) shr 1=A[i]
                    then x:=(x+A[i]) shr 1
                    else x:=(x+A[i]) shr 1+1
             else T:=False;
  end;
 if T
   then writeln(k-1)
   else writeln(k);

End.

var
   sum: longint;
   i,j,k:longint;
   s:string;
   b:boolean;
   arr:array [0..9,1..50] of longint;
Begin
     readln(s);
     for i:=0 to 9 do  arr[i,1]:=1;
     for j:=2 to length(s) do
         begin
               for k:=0 to 9 do
                   begin
                        if (k+ord(s[j])-48) mod 2 = 0 then
                           Begin
                                 arr[(k+ord(s[j])-48 )div 2,j]:=arr[k,j-1]+arr[(k+ord(s[j])-48 )div 2,j];
                           end
                        else
                           Begin
                                 arr[(k+ord(s[j])-48 )div 2,j]:=arr[k,j-1]+arr[(k+ord(s[j])-48 )div 2,j];
                                  arr[(k+ord(s[j])-48 )div 2 +1,j]:=arr[k,j-1]+arr[(k+ord(s[j])-48 )div 2 +1,j];
                           end;

                   end;
         end;
     sum:=0;
     for i:=0 to 9 do
             sum:=arr[i,length(s)]+sum;
     b:=true;
     for i:=1 to length(s)-1 do
         Begin
              if (ord(s[i])+ord(s[i+1])-48*2) mod 2 = 0 then
                 Begin
                   if ((ord(s[i])+ord(s[i+1])-48*2) mod 2) <> ord(s[i+1])-48 then b:=false;
                 end
              else
                 if not (((ord(s[i])+ord(s[i+1])-48*2) div 2 +1 = ord(s[i+1])-48) or ((ord(s[i])+ord(s[i+1])-48*2) div 2= ord(s[i+1])-48)) then b:=false;

         End;
     if b then dec(sum);
     writeln(sum);
End.

var
   sum: longint;
   i,j,k:longint;
   s:string;
   b:boolean;
   arr:array [0..9,1..50] of longint;
Begin
     readln(s);
     for i:=0 to 9 do  arr[i,1]:=1;
     for j:=2 to length(s) do
         begin
               for k:=0 to 9 do
                   begin
                        if (k+ord(s[j])-48) mod 2 = 0 then
                           Begin
                                 arr[(k+ord(s[j])-48 )div 2,j]:=arr[k,j-1]+arr[(k+ord(s[j])-48 )div 2,j];
                           end
                        else
                           Begin
                                 arr[(k+ord(s[j])-48 )div 2,j]:=arr[k,j-1]+arr[(k+ord(s[j])-48 )div 2,j];
                                  arr[(k+ord(s[j])-48 )div 2 +1,j]:=arr[k,j-1]+arr[(k+ord(s[j])-48 )div 2 +1,j];
                           end;

                   end;
         end;
     sum:=0;
     for i:=0 to 9 do
             sum:=arr[i,length(s)]+sum;
     b:=true;
     for i:=1 to length(s)-1 do
         Begin
              if (ord(s[i])+ord(s[i+1])-48*2) mod 2 = 0 then
                 Begin
                   if ((ord(s[i])+ord(s[i+1])-48*2) div 2) <> (ord(s[i+1])-48) then b:=false;
                 end
              else
                 if not (((ord(s[i])+ord(s[i+1])-48*2) div 2 +1 = ord(s[i+1])-48) or ((ord(s[i])+ord(s[i+1])-48*2) div 2= ord(s[i+1])-48)) then b:=false;

         End;
     if b then dec(sum);
     writeln(sum);
End.

const
    fi='';
    fo='';
var
    f:text;
    St:string;
    A:array[1..100,-20..20] of longint;
    res:longint;
procedure nhap;
begin
    assign(f,fi);
    reset(f);
    readln(f,St);
    close(F);
end;
procedure xuat;
begin
    assign(f,fo);
    rewrite(F);
    writeln(f,res);
    close(F);
end;
procedure process;
var i,t,j:longint;xet:boolean;
begin
    fillchar(A,sizeof(A),0);
    for i:=0 to 9 do A[1,i]:=1;
    for i:=2 to length(St) do
     begin
        t:=ord(St[i])-48;
        for j:=0 to 9 do A[i,j]:=A[i-1,2*j-t]+A[i-1,2*j-t+1]+A[i-1,2*j-t-1];
     end;
    res:=0;
    xet:=false;
    for i:=0 to 9 do res:=res+A[length(St),i];
    for i:=1 to length(St) do
        if A[i,ord(St[i])-48]=0 then
         begin
            xet:=true;
            break;
         end;
    if not xet then dec(res);
end;
begin
    nhap;
    process;
    xuat;
end.

const
    fi='';
    fo='';
var
    f:text;
    St:string;
    A:array[1..100,-20..20] of longint;
    res:longint;
procedure nhap;
begin
    assign(f,fi);
    reset(f);
    readln(f,St);
    close(F);
end;
procedure xuat;
begin
    assign(f,fo);
    rewrite(F);
    writeln(f,res);
    close(F);
end;
procedure process;
var i,t,h,j:longint;xet:boolean;
begin
    fillchar(A,sizeof(A),0);
    for i:=0 to 9 do A[1,i]:=1;
    xet:=true;
    for i:=2 to length(St) do
     begin
        t:=ord(St[i])-48;
        for j:=0 to 9 do
         begin
            A[i,j]:=A[i-1,2*j-t]+A[i-1,2*j-t+1]+A[i-1,2*j-t-1];
            h:=ord(St[i-1])-48;
            if j=t then
            begin
            if (h=2*j-t-1) or ((h=2*j-t) or (h=2*j-t+1)) then
             begin
            if A[i-1,h]=0 then xet:=false;
             end
            else xet:=false;
            end;
         end;
     end;
    res:=0;
    for i:=0 to 9 do res:=res+A[length(St),i];
    if xet then dec(res);
end;
begin
    nhap;
    process;
    xuat;
end.

Const
        Fi      =       '';//44H.inp';
        Fo      =       '';//44H.out';
        maxn    =       50;

Var
        F       :       Text;
        N       :       Longint;
        Res     :       Int64;
        A       :       Array[1..maxn] of Longint;
        L       :       Array[0..maxn, 0..9] of Int64;

Procedure  Input;
 Var i: Longint;  s: String;
 Begin
        Assign(f, fi);  Reset(f);
          Readln(f, s);
          N:= Length(s);
          For i:= 1 to n do
             A[i]:= ord(S[i]) - 48;
        Close(f);
 End;

Procedure  Process;
 Var i, j, b, ok: Longint;
 Begin
        ok:= 0;
        For i:= 0 to 9 do  L[1, i]:= 1;
        For i:= 2 to n do
          For j:= 0 to 9 do
            Begin
                   L[i, (j+a[i]) div 2]:= L[i-1, j] + L[i, (j+a[i]) div 2];
                   If odd(j+A[i]) then
                      L[i, (j+A[i]+1) div 2]:= L[i-1, j] + L[i, (j+A[i]+1) div 2];
            End;
        For i:= 0 to 9 do  Res:= Res + L[n, i];

        b:= A[1];
        For i:= 2 to n do
          If (A[i]<>(A[i-1] + A[i]) div 2) or (A[i]<>(A[i-1]+A[i]+1) div 2) then
             ok:= 1;
        Res:= Res - ok;
 End;

Procedure  Print;
 Var ok, i:Longint;
  Begin
        Assign(f, fo);  Rewrite(f);
        If ok=0 then  Dec(Res);
          Writeln(f, Res);
        Close(f);
  End;

BEGIN
        Input;
        Process;
        Print;
END.

const
        fi='';
var
        f:text;
        s:string;
        n,kq:longint;
        g:array [1..50,0..9] of int64;
procedure nhap;
begin
        assign(f,fi);
        reset(f);
        readln(f,s);
        n:=length(s);
        close(f);
end;
procedure xuly;
var
        i,j,u,v:longint;
        kt:boolean;
begin
        for i:=0 to 9 do g[1,i]:=1;
        for i:=1 to n-1 do
        for j:=0 to 9 do
        begin
                u:=(j+ord(s[i+1])-48);
                g[i+1,u div 2]:=g[i+1,u div 2]+g[i,j];
                if u mod 2=1 then g[i+1,(u+1) div 2]:=g[i+1,(u+1) div 2]+g[i,j];
        end;
        for i:=0 to 9 do kq:=kq+g[n,i];
        kt:=true;  u:=ord(s[1])-48;
        for i:=2 to n do
        begin
                v:=ord(s[i])-48;
                u:=(u+v) div 2;
                if (u<>v) and (u<>v-1) then
                begin
                        kt:=false;
                        break;
                end;
        end;
        if kt then dec(kq);
        writeln(kq);
end;
begin
        nhap;
        xuly;
end.

const
        fi='';
var
        f:text;
        kq:int64;
        g:array [0..50,0..9] of int64;
        s:string;
        n:longint;
        a:array [1..50] of longint;
procedure nhap;
var
        i:longint;
begin
        assign(f,fi);
        reset(f);
        readln(f,s);
        n:=length(s);
        close(f);
        for i:=1 to n do a[i]:=ord(s[i])-48;
end;
procedure xuly;
var
        i,u,j:longint;
begin
        for i:=0 to 9 do g[1,i]:=1;
        for i:=1 to n-1 do
        for j:=0 to 9 do
        begin
                u:=j+a[i+1];
                g[i+1,u div 2]:=g[i+1,u div 2]+g[i,j];
                if u mod 2=1 then g[i+1,(u+1) div 2]:=g[i+1,(u+1) div 2]+g[i,j];
        end;
        j:=0;
        for i:=1 to n-1 do
        begin
                u:=(a[i]+a[i+1]+1) div 2;
                if u<>a[i+1] then j:=-1;
        end;
        if j=0 then kq:=-1;
        for i:=0 to 9 do kq:=kq+g[n,i];
        writeln(kq);
end;
begin
        nhap;
        xuly;
end.

var x,y,t,k1,k2,g:longint;
    p:integer;
    i:char;
    s,w:string;
    q:array[0..1000000] of string;
 begin
  readln(s);
  k1:=1;
  k2:=1;
  q[1]:='';
  g:=0;
  while k1<=k2 do
   begin
    if length(q[k1])=0 then begin
                             for i:='0' to '9' do
                              begin
                               inc(k2);
                               q[k2]:=q[k1]+i;
                              end;
                            end
                       else
    if length(q[k1])<length(s) then begin
                                     val(s[length(q[k1])+1],x,p);
                                     w:=q[k1];
                                     val(w[length(w)],y,p);
                                     t:=x+y;
                                     if t mod 2=0 then begin
                                                        inc(k2);
                                                        str(t div 2,w);
                                                        q[k2]:=q[k1]+w;
                                                       end
                                                  else begin
                                                        inc(k2);
                                                        str(t div 2,w);
                                                        q[k2]:=q[k1]+w;
                                                        inc(k2);
                                                        str(t div 2+1,w);
                                                        q[k2]:=q[k1]+w;
                                                       end;
                                    end
                               else if length(q[k1])=length(s) then inc(g);
    inc(k1);
   end;
  writeln(g);
 end.

var i,j,l,ans,n:longint;
    a,b,c:array[0..51] of longint;
    s:string;
    p:integer;
 begin
  readln(s);
  n:=length(s);
  for i:=1 to n do
   val(s[i],a[i],p);
  for i:=0 to 9 do
   b[i]:=1;
  for i:=2 to n do
   begin
    fillchar(c,sizeof(c),0);
    for j:=0 to 9 do
     begin
      for l:=0 to 9 do
       begin
        if (l+a[i]) div 2=j then c[j]:=c[j]+b[l];
        if (l+a[i]) mod 2=1 then if (a[i]+l) div 2+1=j then c[j]:=c[j]+b[l];
       end;
     end;
    b:=c;
   end;
  ans:=0;
  for i:=0 to 9 do
   ans:=ans+b[i];
  if n>2 then ans:=ans-1;
  writeln(ans);
 end.

var i,j,l,ans,n,t:longint;
    q:boolean;
    a,b,c:array[0..51] of longint;
    s:string;
    p:integer;
 begin
  readln(s);
  n:=length(s);
  for i:=1 to n do
   val(s[i],a[i],p);
  for i:=0 to 9 do
   b[i]:=1;
  for i:=2 to n do
   begin
    fillchar(c,sizeof(c),0);
    for j:=0 to 9 do
     begin
      for l:=0 to 9 do
       begin
        if (l+a[i]) div 2=j then c[j]:=c[j]+b[l];
        if (l+a[i]) mod 2=1 then if (a[i]+l) div 2+1=j then c[j]:=c[j]+b[l];
       end;
     end;
    b:=c;
   end;
  ans:=0;
  for i:=0 to 9 do
   ans:=ans+b[i];
  q:=true;
  for i:=2 to n do
   begin
    t:=a[i]+a[i-1];
    if t mod 2=0 then begin
                       if (t div 2)<>a[i] then q:=false;
                      end
                 else begin
                       if ((t div 2)<>a[i]) and ((t div 2+1)<>a[i]) then q:=false;
                      end;
   end;
  if q then ans:=ans-1;
  writeln(ans);
 end.

var
        s:string;
        a:array[1..50,0..9] of longint;
        n,i,j,k,t,kq:longint;
        check:boolean;
begin
        readln(s);
        kq:=0;
        for i:=0 to 9 do a[1,i]:=1;
        check:=true;
        for i:=2 to length(s) do
        begin
                k:=ord(s[i])-48;
                for j:=0 to 9 do
                begin
                        if (j+k) mod 2 = 0 then a[i,(j+k) div 2]:=a[i,(j+k) div 2]+a[i-1,j]
                        else
                        begin
                                a[i,(j+k) div 2]:=a[i,(j+k) div 2]+a[i-1,j];
                                a[i,(j+k) div 2+1]:=a[i,(j+k) div 2+1]+a[i-1,j];
                        end;
                end;
        end;
        for i:=0 to 9 do kq:=kq+a[length(s),i];
        t:=1;
        for i:=2 to length(s) do
        begin
                k:=ord(s[i])-48;
                if (t+k) mod 2 = 0 then
                        if ((t+k) div 2 <> k) then
                        begin
                                check:=false;
                                break;
                        end;
                if (t+k) mod 2 =1 then
                        if ((t+k) div 2 <> k) and ((t+k) div 2+1<>k) then
                        begin
                                check:=false;
                                break;
                        end;
                t:=k;
        end;
        if check=true then dec(kq);
        writeln(kq);
end.

var
        s:string;
        a:array[1..50,0..9] of longint;
        n,i,j,k,t,kq:longint;
        check:boolean;
begin
        readln(s);
        kq:=0;
        for i:=0 to 9 do a[1,i]:=1;
        check:=true;
        for i:=2 to length(s) do
        begin
                k:=ord(s[i])-48;
                for j:=0 to 9 do
                begin
                        if (j+k) mod 2 = 0 then a[i,(j+k) div 2]:=a[i,(j+k) div 2]+a[i-1,j]
                        else
                        begin
                                a[i,(j+k) div 2]:=a[i,(j+k) div 2]+a[i-1,j];
                                a[i,(j+k) div 2+1]:=a[i,(j+k) div 2+1]+a[i-1,j];
                        end;
                end;
        end;
        for i:=0 to 9 do kq:=kq+a[length(s),i];
        t:=ord(s[1])-48;
        for i:=2 to length(s) do
        begin
                k:=ord(s[i])-48;
                if (t+k) mod 2 = 0 then
                        if ((t+k) div 2 <> k) then
                        begin
                                check:=false;
                                break;
                        end;
                if (t+k) mod 2 =1 then
                        if ((t+k) div 2 <> k) and ((t+k) div 2+1<>k) then
                        begin
                                check:=false;
                                break;
                        end;
                t:=k;
        end;
        if check=true then dec(kq);
        writeln(kq);
end.

program sdt;
const
  fi = '';
  fo = '';
  nmax = 50;
var
  a: array[1..nmax] of int64;
  b: array[0..9, 1..nmax] of int64;
  n: longint;
  kq: int64;
  f1, f2: text;

  procedure openf;
  begin
    assign(f1, fi); reset(f1);
    assign(f2, fo); rewrite(f2);
  end;

  procedure closef;
  begin
    close(f1); close(f2);
  end;

  procedure input;
  var
    s: string;
    i: longint;
  begin
    read(f1, s);
    n := length(s);
    for i := 1 to n do
      a[i] := ord(s[i]) - ord('0');
  end;

  procedure output;
  begin
    write(f2, kq);
  end;

  procedure process;
  var
    i, j: longint;
  begin
    for i := 0 to 9 do
      b[i, n] := 1;
    for i := n - 1 downto 1 do
      for j := 0 to 9 do
        if (j + a[i + 1]) and 1 = 1 then
          b[j, i] := b[(j + a[i + 1]) div 2, i + 1] + b[(j + a[i + 1]) div 2 + 1, i + 1]
        else
          b[j, i] := b[(j + a[i + 1]) div 2, i + 1];
    for i := 0 to 9 do
      kq := kq + b[i, 1];
    for i := 2 to n do
      begin
        if abs(a[i] - a[i - 1]) > 1 then
          break;
        if i = n then
          dec(kq);
      end;
  end;

begin
  openf;
  input;
  process;
  output;
  closef;
end.

program sdt;
const
  fi = '';
  fo = '';
  nmax = 50;
var
  a: array[1..nmax] of int64;
  b: array[0..9, 1..nmax] of int64;
  n: longint;
  kq: int64;
  f1, f2: text;

  procedure openf;
  begin
    assign(f1, fi); reset(f1);
    assign(f2, fo); rewrite(f2);
  end;

  procedure closef;
  begin
    close(f1); close(f2);
  end;

  procedure input;
  var
    s: string;
    i: longint;
  begin
    read(f1, s);
    n := length(s);
    for i := 1 to n do
      a[i] := ord(s[i]) - ord('0');
  end;

  procedure output;
  begin
    write(f2, kq);
  end;

  procedure process;
  var
    i, j: longint;
  begin
    for i := 0 to 9 do
      b[i, n] := 1;
    for i := n - 1 downto 1 do
      for j := 0 to 9 do
        if (j + a[i + 1]) and 1 = 1 then
          b[j, i] := b[(j + a[i + 1]) div 2, i + 1] + b[(j + a[i + 1]) div 2 + 1, i + 1]
        else
          b[j, i] := b[(j + a[i + 1]) div 2, i + 1];
    for i := 0 to 9 do
      kq := kq + b[i, 1];
    for i := 2 to n do
      begin
        if abs(a[i] - a[i - 1]) > 1 then
          break;
        if i = n then
          kq := kq - 1;
      end;
  end;

begin
  openf;
  input;
  process;
  output;
  closef;
end.

program pr1;

{$APPTYPE CONSOLE}

uses
  SysUtils;

const nn=50{1024};eps=0; label 1;
type mas=array[0..nn] of longint;
var t,t1,imax,n,p,i,j,k,l,m,step,n1,k1,ot,name2:longint;
  b,a1,b1,dl,dr,hl,hr:mas; flag:boolean;  pl:longint;
 name:array [0..nn,0..nn] of string ;
 spname :array[0..nn] of string;
  ch:char;
 sc,time:array[0..nn] of longint;
 variant:array[0..nn,0..nn] of int64;
 a:array[0..nn] of longint;
  ss:string;

 begin
{assign(input,'input.txt');reset(input);
assign(output,'output1234.txt');rewrite(output);
}readln (ss);  n:=length(ss);
for i:=1 to n do a[i]:=ord(ss[i])-48;
{for i:=1 to n do write(a[i],' ');  writeln;writeln;
}for i:=0 to 9 do variant[1,i]:=1;  variant[1,9]:=1;
for step:=1 to n-1 do for i:=0 to 9 do
  begin
     t:=i+a[step+1]; t1:=t div 2;
       if not odd(t) then
         begin
          variant[step+1,t1]:=variant[step+1,t1]+variant[step,i];
         end;
       if  odd(t) then
        begin
               variant[step+1,t1]:=variant[step+1,t1]+variant[step,i];
               variant[step+1,t1+1]:=variant[step+1,t1+1]+variant[step,i];
        end;
  end;
 for step:=1 to n do
{ begin for i:=0 to 9 do  write(variant[step,i],' ');writeln;             end;
}
flag:=true ;
for step:=1 to n do if variant[step,a[step]]=0 then flag:=false;
ot:=0; for i:=0 to 9 do ot:=ot+variant[n,i];
if flag then dec(ot);
writeln(ot);

 1: close (output);
end.

program pr1;

{$APPTYPE CONSOLE}

uses
  SysUtils;

const nn=50{1024};eps=0; label 1;
type mas=array[0..nn] of longint;
var tt,t,t1,imax,n,p,i,j,k,l,m,step,n1,k1,ot,name2:longint;
  b,a1,b1,dl,dr,hl,hr:mas; flag:boolean;  pl:longint;
 name:array [0..nn,0..nn] of string ;
 spname :array[0..nn] of string;
  ch:char;
 sc,time:array[0..nn] of longint;
 variant:array[0..nn,0..nn] of int64;
 a:array[0..nn] of longint;
  ss:string;
  fl:array[0..nn] of boolean;

 begin
{assign(input,'input.txt');reset(input);
assign(output,'output1234.txt');rewrite(output);
}readln (ss);  n:=length(ss);
for i:=1 to n do a[i]:=ord(ss[i])-48;
{for i:=1 to n do write(a[i],' ');  writeln;writeln;
}for i:=0 to 9 do variant[1,i]:=1;  variant[1,9]:=1;
for step:=1 to n-1 do for i:=0 to 9 do
  begin
     t:=i+a[step+1]; t1:=t div 2;
       if not odd(t) then
         begin
          variant[step+1,t1]:=variant[step+1,t1]+variant[step,i];
         end;
       if  odd(t) then
        begin
               variant[step+1,t1]:=variant[step+1,t1]+variant[step,i];
               variant[step+1,t1+1]:=variant[step+1,t1+1]+variant[step,i];
        end;
  end;
 for step:=1 to n do
 {begin for i:=0 to 9 do  write(variant[step,i],' ');writeln;             end;
 }
ot:=0; for i:=0 to 9 do ot:=ot+variant[n,i];
flag:=true;
tt:=a[1];
for i:=2 to n do
  begin
      if (not odd(a[i]+a[i-1])) and ((a[i]+a[i-1])div 2 <>a[i]) then flag:=false;
      if (odd(a[i]+a[i-1])) and ((a[i]+a[i-1])div 2 <>a[i])and ((a[i]+a[i-1])div 2+1 <>a[i])  then flag:=false;
  end;

if flag then dec(ot);
writeln(ot);

 1: close (output);
end.

program JJ_Mybabe;
  {$APPTYPE CONSOLE}  {$o-}
uses SysUtils,Math;
var
    i,j,p,m:integer;
    k:int64;
    s:string;
    b:array[1..50] of integer;
    a:array[1..50,0..9] of integer;
begin
 //reset(input,'input.txt');
 //rewrite(output,'output.txt');
 read(s);
 for i:=1 to length(s) do
   b[i]:=strtoint(s[i]);
 for i:=0 to 9 do a[1][i]:=1;
 for i:=2 to length(S) do
   for j:=0 to 9 do
   begin
     k:=(j+b[i]);
     a[i][k div 2]:=a[i][k div 2]+a[i-1][j];
     if (j+b[i]) mod 2<>0 then
       a[i][k div 2+1]:=a[i][k div 2+1]+a[i-1][j];
   end;
 k:=0;
 for i:=0 to 9 do
   k:=k+a[length(s)][i];
 for i:=2 to length(s) do
 begin
   p:=(b[i]+b[i-1]);
   if p mod 2 =0 then
     if p div 2<>b[i] then m:=1;
   if p mod 2<>0 then
     if (p div 2<>b[i]) and (p div 2+1<>b[i]) then m:=1;
 end;
 if m=0 then dec(k);
 write(k);
end.

program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var ans,sn,rem,q,remn,n,m,t,k,cnt,e,currc,currb,b,c:int64;
flag:boolean;
i,j:integer;
s:string;
a:array[1..11111111] of int64;

procedure dfs(n:int64;pos:integer);
var num,d:int64;
begin
//writeln('EXEC DFS(',n,',',pos,')');
d:=n mod 10;
if pos=length(s) then
  begin
   inc(cnt);
   a[cnt]:=n;
  end
else
begin
num:=ord(s[pos+1])-ord('0');

dfs(n*10+(num+d) div 2,pos+1);

if (num+d) mod 2 = 1 then
dfs(n*10+(num+d) div 2 + 1,pos+1);

end;

end;

begin
 readln(s);
 sn:=0;
 for I := 1 to length(s) do
   begin
   sn:=sn*10;
   sn:=sn+ord(s[i])-ord('0');
   end;

 cnt:=0;
 for I := 0 to 9 do
   dfs(i,1);

 for I := 1 to cnt do
 for J := i+1 to cnt do
   if a[i]>a[j] then
   begin
   t:=a[i];a[i]:=a[j];a[j]:=t;
   end;

 for I := 1 to cnt do
  if a[i]<>-1 then
   begin
   j:=i+1;
    while a[i]=a[j] do
    begin
    a[j]:=-1;
    inc(j);
    end;

   end;

   ans:=0;
   for I := 1 to cnt do
     if (a[i]<>sn) and (a[i]<>-1) then inc(ans);

 writeln(ans);
//while True do

 end.

program Project1;

{$APPTYPE CONSOLE}
{$M 16777216}
uses
  SysUtils;
var ans,sn,rem,q,remn,n,m,t,k,cnt,e,currc,currb,b,c:int64;
flag:boolean;
i,j:integer;
s:string;
a:array[1..31111111] of int64;

procedure dfs(n:int64;pos:integer);
var num,d:int64;
begin
//writeln('EXEC DFS(',n,',',pos,')');
d:=n mod 10;
if pos=length(s) then
  begin
   inc(cnt);
   a[cnt]:=n;
  end
else
begin
num:=ord(s[pos+1])-ord('0');

dfs(n*10+(num+d) div 2,pos+1);

if (num+d) mod 2 = 1 then
dfs(n*10+(num+d) div 2 + 1,pos+1);

end;

end;

begin
 readln(s);
 sn:=0;
 for I := 1 to length(s) do
   begin
   sn:=sn*10;
   sn:=sn+ord(s[i])-ord('0');
   end;

 cnt:=0;
 for I := 0 to 9 do
   dfs(i,1);

  {
 for I := 1 to cnt do
 for J := i+1 to cnt do
   if a[i]>a[j] then
   begin
   t:=a[i];a[i]:=a[j];a[j]:=t;
   end;
  }

  //for I := 1 to cnt do
  // writeln(a[i]);

 for I := 1 to cnt do
  if a[i]<>-1 then
   begin
   j:=i+1;
    while a[i]=a[j] do
    begin
    a[j]:=-1;
    inc(j);
    end;

   end;

   ans:=0;
   for I := 1 to cnt do
     if (a[i]<>sn) and (a[i]<>-1) then inc(ans);

 writeln(ans);
//True do

 end.

program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var ans,sn,rem,q,remn,n,m,t,k,cnt,e,currc,currb,b,c:int64;
flag:boolean;
i,j:integer;
s:string;
a:array[1..11111111] of integer;

procedure dfs(n:int64;pos:integer);
var num,d:integer;
begin
//writeln('EXEC DFS(',n,',',pos,')');
d:=n mod 10;
if pos=length(s) then
  begin
   inc(cnt);
   a[cnt]:=n;
  end
else
begin
num:=ord(s[pos+1])-ord('0');
if (num+d) mod 2 = 1 then
dfs(n*10+(num+d) div 2 + 1,pos+1);
dfs(n*10+(num+d) div 2,pos+1);

end;

end;

begin
 readln(s);
 sn:=0;
 for I := 1 to length(s) do
   begin
   sn:=sn*10;
   sn:=sn+ord(s[i])-ord('0');
   end;

 cnt:=0;
 for I := 0 to 9 do
   dfs(i,1);

 for I := 1 to cnt do
 for J := i+1 to cnt do
   if a[i]>a[j] then
   begin
   t:=a[i];a[i]:=a[j];a[j]:=t;
   end;
   ans:=0;
   for I := 1 to cnt do
     if a[i]<>sn then inc(ans);

 writeln(ans);
//while True do

 end.

program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var ans,sn,rem,q,remn,n,m,t,k,cnt,e,currc,currb,b,c:int64;
flag:boolean;
i,j:integer;
s:string;
a:array[1..11111111] of int64;

procedure dfs(n:int64;pos:integer);
var num,d:integer;
begin
//writeln('EXEC DFS(',n,',',pos,')');
d:=n mod 10;
if pos=length(s) then
  begin
   inc(cnt);
   a[cnt]:=n;
  end
else
begin
num:=ord(s[pos+1])-ord('0');
if (num+d) mod 2 = 1 then
dfs(n*10+(num+d) div 2 + 1,pos+1);
dfs(n*10+(num+d) div 2,pos+1);

end;

end;

begin
 readln(s);
 sn:=0;
 for I := 1 to length(s) do
   begin
   sn:=sn*10;
   sn:=sn+ord(s[i])-ord('0');
   end;

 cnt:=0;
 for I := 0 to 9 do
   dfs(i,1);

 for I := 1 to cnt do
 for J := i+1 to cnt do
   if a[i]>a[j] then
   begin
   t:=a[i];a[i]:=a[j];a[j]:=t;
   end;
   ans:=0;
   for I := 1 to cnt do
     if a[i]<>sn then inc(ans);

 writeln(ans);
//while True do

 end.

program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var ans,sn,rem,q,remn,n,m,t,k,cnt,e,currc,currb,b,c:int64;
flag:boolean;
i,j:integer;
s:string;
a:array[1..11111111] of int64;

procedure dfs(n:int64;pos:integer);
var num,d:integer;
begin
//writeln('EXEC DFS(',n,',',pos,')');
d:=n mod 10;
if pos=length(s) then
  begin
   inc(cnt);
   a[cnt]:=n;
  end
else
begin
num:=ord(s[pos+1])-ord('0');
if (num+d) mod 2 = 1 then
dfs(n*10+(num+d) div 2 + 1,pos+1);
dfs(n*10+(num+d) div 2,pos+1);

end;

end;

begin
 readln(s);
 sn:=0;
 for I := 1 to length(s) do
   begin
   sn:=sn*10;
   sn:=sn+ord(s[i])-ord('0');
   end;

 cnt:=0;
 for I := 0 to 9 do
   dfs(i,1);

 for I := 1 to cnt do
 for J := i+1 to cnt do
   if a[i]>a[j] then
   begin
   t:=a[i];a[i]:=a[j];a[j]:=t;
   end;

 for I := 1 to cnt do
  if a[i]<>-1 then
   begin
   j:=i+1;
    while a[i]=a[j] do
    begin
    a[j]:=-1;
    inc(j);
    end;

   end;

   ans:=0;
   for I := 1 to cnt do
     if (a[i]<>sn) and (a[i]<>-1) then inc(ans);

 writeln(ans);
//while True do

 end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var i, j, n, res : longint;
    a : array[1..50] of longint;
    b, b2 : array[0..9] of longint;
    s : string;
begin
 //  reset(input,'input.txt');
 //  rewrite(output,'output.txt');

   readln(s);
   s := trim(s);
   n := length(s);
   for i := 1 to n do
     a[i] := ord(s[i]) - ord('0');

   for i := 0 to 9 do
     b[i] := 1;

   for i := 2 to n do
   begin
      fillchar(b2, sizeof(b2), 0);
      for j := 0 to 9 do
      begin
        b2[(a[i] + j) div 2] := b2[(a[i] + j) div 2] + b[j];
        if ((a[i] + j) div 2) <> ((a[i] + j + 1) div 2) then
          b2[(a[i] + j + 1) div 2] := b2[(a[i] + j + 1) div 2] + b[j];
      end;
      b := b2;
   end;

   res := 0;
   for i := 0 to 9 do
     res := res + b[i];
   res := res - 1;
   for i := 2 to n do
     if ((a[i] + a[i - 1]) div 2 <> a[i]) and ((a[i] + a[i - 1] + 1) div 2 <> a[i]) then
     begin
       res := res + 1;
       break;
     end;
   write(res);
 //  close(input);
 //  close(output);
end.

{$R+,Q+,I+}
{$apptype console}
Uses SysUtils;
Var
   dp:Array[0..9,0..50] of Int64;
   a,b:Array[0..50] of Int64;
   s:String;
   n,ans,f:Int64;
   i,j:Integer;
Function Solve(i,j:Integer):Int64;
Begin
   If dp[i,j]<>-1 Then Begin
      Solve:=dp[i,j];
      Exit;
   End;
   If j=n Then Begin
      If (i+a[j]) mod 2=0 Then dp[i,j]:=1
                          Else dp[i,j]:=2;
      Solve:=dp[i,j];
      Exit;
   End;
   If (i+a[j]) mod 2=0 Then dp[i,j]:=Solve((i+a[j]) div 2,j+1)
                       Else dp[i,j]:=Solve((i+a[j]) div 2,j+1)+Solve((i+a[j]) div 2+1,j+1);
   Solve:=dp[i,j];
End;
Begin
   Read(s);
   n:=length(s);
   If n=1 Then Begin
      Write(8);
      Halt;
   End;
   For i:=1 To n Do a[i]:=strtoint(s[i]);
   For i:=0 To 9 Do
      For j:=1 To 50 Do dp[i,j]:=-1;
   ans:=0;
   For i:=0 To 9 Do ans:=ans+Solve(i,2);
   b[1]:=a[1];
   f:=1;
   For i:=2 To n Do Begin
      If (a[i]+b[i-1]) mod 2=0 Then Begin
         b[i]:=(a[i]+b[i-1]) div 2;
         If b[i]<>a[i] Then Begin
            f:=0;
            Break;
         End;
      End
      Else Begin
         If (a[i]+b[i-1]) div 2=a[i] Then b[i]:=(a[i]+b[i-1]) div 2
                                     Else b[i]:=(a[i]+b[i-1]) div 2+1;
         If b[i]<>a[i] Then Begin
            f:=0;
            Break;
         End;
      End;
   End;
   If f=1 Then ans:=ans-1;
   Write(ans);
End.

{$R+,Q+,I+}
{$apptype console}
Uses SysUtils;
Var
   dp:Array[0..9,0..50] of Int64;
   a,b:Array[0..50] of Int64;
   s:String;
   n,ans,f:Int64;
   i,j:Integer;
Function Solve(i,j:Integer):Int64;
Begin
   If dp[i,j]<>-1 Then Begin
      Solve:=dp[i,j];
      Exit;
   End;
   If j=n Then Begin
      If (i+a[j]) mod 2=0 Then dp[i,j]:=1
                          Else dp[i,j]:=2;
      Solve:=dp[i,j];
      Exit;
   End;
   If (i+a[j]) mod 2=0 Then dp[i,j]:=Solve((i+a[j]) div 2,j+1)
                       Else dp[i,j]:=Solve((i+a[j]) div 2,j+1)+Solve((i+a[j]) div 2+1,j+1);
   Solve:=dp[i,j];
End;
Begin
   Read(s);
   n:=length(s);
   If n=1 Then Begin
      Write(0);
      Halt;
   End;
   For i:=1 To n Do a[i]:=strtoint(s[i]);
   For i:=0 To 9 Do
      For j:=1 To 50 Do dp[i,j]:=-1;
   ans:=0;
   For i:=0 To 9 Do ans:=ans+Solve(i,2);
   b[1]:=a[1];
   f:=1;
   For i:=2 To n Do Begin
      If (a[i]+b[i-1]) mod 2=0 Then Begin
         b[i]:=(a[i]+b[i-1]) div 2;
         If b[i]<>a[i] Then Begin
            f:=0;
            Break;
         End;
      End
      Else Begin
         If (a[i]+b[i-1]) div 2=a[i] Then b[i]:=(a[i]+b[i-1]) div 2
                                     Else b[i]:=(a[i]+b[i-1]) div 2+1;
         If b[i]<>a[i] Then Begin
            f:=0;
            Break;
         End;
      End;
   End;
   If f=1 Then ans:=ans-1;
   Write(ans);
End.

{$APPTYPE CONSOLE}
{$R-,Q-}
var
 s1: string;
 i,j,n,qq : longint;
 f,f2 : array [0..9] of int64;
 ans,ans1 : int64;
 a,b : array [1..50] of longint;
procedure rec(s : string);
var
 i : longint;
begin
 i:=length(s);
 if s=s1 then
  exit;
 if i=length(s1) then
  begin
   inc(n);
   exit;
  end;
 if ((ord(s1[i+1])-48)+(ord(s[i])-48)) mod 2 = 1 then
  rec(s+chr(((ord(s1[i+1])-48)+(ord(s[i])-48)) div 2 +49));
 rec(s+chr(((ord(s1[i+1])-48)+(ord(s[i])-48)) div 2 +48));
end;
begin
{ reset(input,'input.txt');
 rewrite(output,'output.txt');  }
 readln(s1);
{ n:=0;
 for I:=0 to 9 do
  rec(chr(i+48));
 ans1:=n;
 writeln(n);    }
 n:=length(s1);
 for i:=1 to n do
  a[i]:=ord(s1[i])-ord('0');
 for i:=0 to 9 do
  f[i]:=1;
 for I:=2 to n do
  begin
   f2:=f;
   for j:=0 to 9 do
    f[j]:=0;
   for j:=0 to 9 do
    begin
     if (j+a[i]) mod 2 = 1 then
      f[(j+a[i]+1) div 2]:=f[(j+a[i]+1) div 2]+f2[j];
     f[(j+a[i]) div 2]:=f[(j+a[i]) div 2]+f2[j];
    end;
  end;
 ans:=0;
 for i:=0 to 9 do
  ans:=ans+f[i];
 b[1]:=a[1];
 for i:=2 to n do
  begin
   if (b[i-1]+a[i]) mod 2 = 0 then
    begin
     if ((b[i-1]+a[i]) div 2) <>a[i] then
      break;
    end
   else
    begin
     if (((b[i-1]+a[i]) div 2) <>a[i]) and ((b[i-1]+a[i]+1) div 2 <> a[i]) then
      break;
    end;
   b[i]:=a[i];
  end;
 if i>n then
  dec(ans);
 writeln(ans);
end.

{$APPTYPE CONSOLE}
{$R-,Q-}
var
 s1: string;
 i,j,n,qq : longint;
 f,f2 : array [0..9] of int64;
 ans,ans1 : int64;
 a,b : array [0..100000] of int64;
procedure rec(s : string);
var
 i : longint;
begin
 i:=length(s);
 if s=s1 then
  exit;
 if i=length(s1) then
  begin
   inc(n);
   exit;
  end;
 if ((ord(s1[i+1])-48)+(ord(s[i])-48)) mod 2 = 1 then
  rec(s+chr(((ord(s1[i+1])-48)+(ord(s[i])-48)) div 2 +49));
 rec(s+chr(((ord(s1[i+1])-48)+(ord(s[i])-48)) div 2 +48));
end;
begin
{ for qq:=1 to 1000000 do
  begin
   if qq>1 then
    begin
     close(input);
     close(output);
    end;
 rewrite(output,'input.txt');
 write(qq);
 close(output);  }
 {reset(input,'input.txt');
 rewrite(output,'output.txt'); }
 readln(s1);
{ n:=0;
 for I:=0 to 9 do
  rec(chr(i+48));
 ans1:=n;
 writeln(n);  }
 n:=length(s1);
 for i:=1 to n do
  a[i]:=ord(s1[i])-ord('0');
 for i:=0 to 9 do
  f[i]:=1;
 for I:=2 to n do
  begin
   f2:=f;
   for j:=0 to 9 do
    f[j]:=0;
   for j:=0 to 9 do
    begin
     if (j+a[i]) mod 2 = 1 then
      f[(j+a[i]+1) div 2]:=f[(j+a[i]+1) div 2]+f2[j];
     f[(j+a[i]) div 2]:=f[(j+a[i]) div 2]+f2[j];
    end;
  end;
 ans:=0;
 for i:=0 to 9 do
  ans:=ans+f[i];
 b[1]:=a[1];
 i:=2;
 for i:=2 to n do
  begin
   if (((b[i-1]+a[i]) div 2)<>a[i]) and (((b[i-1]+a[i]+1) div 2)<>a[i]) then
    break;
   b[i]:=a[i];
  end;
 if i>n then
  dec(ans);
 writeln(ans);
{ if ans1<>ans then
  break;
 end; }
end.

{$APPTYPE CONSOLE}
{$R-,Q-}
var
 s1: string;
 i,j,n : longint;
 f,f2 : array [0..9] of int64;
 ans : int64;
 a : array [1..50] of longint;
procedure rec(s : string);
var
 i : longint;
begin
 i:=length(s);
 if s=s1 then
  exit;
 if i=length(s1) then
  begin
   inc(n);
   exit;
  end;
 if ((ord(s1[i+1])-48)+(ord(s[i])-48)) mod 2 = 1 then
  rec(s+chr(((ord(s1[i+1])-48)+(ord(s[i])-48)) div 2 +49));
 rec(s+chr(((ord(s1[i+1])-48)+(ord(s[i])-48)) div 2 +48));
end;
begin
{ reset(input,'input.txt');
 rewrite(output,'output.txt');}
 readln(s1);
{ n:=0;
 for I:=0 to 9 do
  rec(chr(i+48));
 writeln(n);  }
 n:=length(s1);
 for i:=1 to n do
  a[i]:=ord(s1[i])-ord('0');
 for i:=0 to 9 do
  f[i]:=1;
 for I:=2 to n do
  begin
   f2:=f;
   for j:=0 to 9 do
    f[j]:=0;
   for j:=0 to 9 do
    begin
     if (j+a[i]) mod 2 = 1 then
      f[(j+a[i]+1) div 2]:=f[(j+a[i]+1) div 2]+f2[j];
     f[(j+a[i]) div 2]:=f[(j+a[i]) div 2]+f2[j];
    end;
  end;
 ans:=0;
 for i:=0 to 9 do
  ans:=ans+f[i];
 i:=1;
 if a[i]<a[i+1] then
  begin
   i:=1;
   while (a[i]<a[i+1]) and (i<n) do
    inc(i);
   while (a[i]=a[i+1]) and (i<n) do
    inc(i);
   if i=n then
    dec(ans);
  end
 else
  begin
   i:=1;
   while (a[i]>a[i+1]) and (i<n) do
    inc(i);
   while (a[i]=a[i+1]) and (i<n) do
    inc(i);
   if i=n then
    dec(ans);
  end;
 writeln(ans);
end.

{$APPTYPE CONSOLE}
{$R-,Q-}
var
 s1: string;
 i,j,n,qq : longint;
 f,f2 : array [0..9] of int64;
 ans,ans1 : int64;
 a,b : array [1..50] of longint;
procedure rec(s : string);
var
 i : longint;
begin
 i:=length(s);
 if s=s1 then
  exit;
 if i=length(s1) then
  begin
   inc(n);
   exit;
  end;
 if ((ord(s1[i+1])-48)+(ord(s[i])-48)) mod 2 = 1 then
  rec(s+chr(((ord(s1[i+1])-48)+(ord(s[i])-48)) div 2 +49));
 rec(s+chr(((ord(s1[i+1])-48)+(ord(s[i])-48)) div 2 +48));
end;
begin
 {reset(input,'input.txt');
 rewrite(output,'output.txt'); }
 readln(s1);
{ n:=0;
 for I:=0 to 9 do
  rec(chr(i+48));
 ans1:=n;
 writeln(n);
 n:=length(s1); }
 for i:=1 to n do
  a[i]:=ord(s1[i])-ord('0');
 for i:=0 to 9 do
  f[i]:=1;
 for I:=2 to n do
  begin
   f2:=f;
   for j:=0 to 9 do
    f[j]:=0;
   for j:=0 to 9 do
    begin
     if (j+a[i]) mod 2 = 1 then
      f[(j+a[i]+1) div 2]:=f[(j+a[i]+1) div 2]+f2[j];
     f[(j+a[i]) div 2]:=f[(j+a[i]) div 2]+f2[j];
    end;
  end;
 ans:=0;
 for i:=0 to 9 do
  ans:=ans+f[i];
 b[1]:=a[1];
 for i:=2 to n do
  begin
   if (b[i-1]+a[i]) mod 2 = 0 then
    begin
     if ((b[i-1]+a[i]) div 2) <>a[i] then
      break;
    end
   else
    begin
     if (((b[i-1]+a[i]) div 2) <>a[i]) and ((b[i-1]+a[i]+1) div 2 <> a[i]) then
      break;
    end;
   b[i]:=a[i];
  end;
 if i>n then
  dec(ans);
 writeln(ans);
end.

{$APPTYPE CONSOLE}
{$R-,Q-}
var
 s1: string;
 i,j,n : longint;
 f,f2 : array [0..9] of int64;
 ans : int64;
 a : array [1..50] of longint;
procedure rec(s : string);
var
 i : longint;
begin
 i:=length(s);
 if s=s1 then
  exit;
 if i=length(s1) then
  begin
   inc(n);
   exit;
  end;
 if ((ord(s1[i+1])-48)+(ord(s[i])-48)) mod 2 = 1 then
  rec(s+chr(((ord(s1[i+1])-48)+(ord(s[i])-48)) div 2 +49));
 rec(s+chr(((ord(s1[i+1])-48)+(ord(s[i])-48)) div 2 +48));
end;
begin
{ reset(input,'input.txt');
 rewrite(output,'output.txt'); }
 readln(s1);
{ n:=0;
 for I:=0 to 9 do
  rec(chr(i+48));
 writeln(n);    }
 n:=length(s1);
 for i:=1 to n do
  a[i]:=ord(s1[i])-ord('0');
 for i:=0 to 9 do
  f[i]:=1;
 for I:=2 to n do
  begin
   f2:=f;
   for j:=0 to 9 do
    f[j]:=0;
   for j:=0 to 9 do
    begin
     if (j+a[i]) mod 2 = 1 then
      f[(j+a[i]+1) div 2]:=f[(j+a[i]+1) div 2]+f2[j];
     f[(j+a[i]) div 2]:=f[(j+a[i]) div 2]+f2[j];
    end;
  end;
 ans:=0;
 for i:=0 to 9 do
  ans:=ans+f[i];
 i:=1;
 if a[i]<a[i+1] then
  begin
   i:=1;
   while (a[i]+1=a[i+1]) and (i<n) do
    inc(i);
   while (a[i]=a[i+1]) and (i<n) do
    inc(i);
   if i=n then
    dec(ans);
  end
 else
  begin
   i:=1;
   while (a[i]-1=a[i+1]) and (i<n) do
    inc(i);
   while (a[i]=a[i+1]) and (i<n) do
    inc(i);
   if i=n then
    dec(ans);
  end;
 writeln(ans);
end.

{$APPTYPE CONSOLE}
{$R-,Q-}
var
 s1: string;
 i,j,n : longint;
 f,f2 : array [0..9] of int64;
 ans : int64;
 a,b : array [1..50] of longint;
procedure rec(s : string);
var
 i : longint;
begin
 i:=length(s);
 if s=s1 then
  exit;
 if i=length(s1) then
  begin
   inc(n);
   exit;
  end;
 if ((ord(s1[i+1])-48)+(ord(s[i])-48)) mod 2 = 1 then
  rec(s+chr(((ord(s1[i+1])-48)+(ord(s[i])-48)) div 2 +49));
 rec(s+chr(((ord(s1[i+1])-48)+(ord(s[i])-48)) div 2 +48));
end;
begin
{ reset(input,'input.txt');
 rewrite(output,'output.txt');  }
 readln(s1);
{ n:=0;
 for I:=0 to 9 do
  rec(chr(i+48));
 writeln(n);   }
 n:=length(s1);
 for i:=1 to n do
  a[i]:=ord(s1[i])-ord('0');
 for i:=0 to 9 do
  f[i]:=1;
 for I:=2 to n do
  begin
   f2:=f;
   for j:=0 to 9 do
    f[j]:=0;
   for j:=0 to 9 do
    begin
     if (j+a[i]) mod 2 = 1 then
      f[(j+a[i]+1) div 2]:=f[(j+a[i]+1) div 2]+f2[j];
     f[(j+a[i]) div 2]:=f[(j+a[i]) div 2]+f2[j];
    end;
  end;
 ans:=0;
 for i:=0 to 9 do
  ans:=ans+f[i];
 b[1]:=a[1];
 for i:=2 to n do
  begin
   if (b[i-1]+a[i]) mod 2 = 0 then
    begin
     if (b[i-1]+a[i] div 2) <>a[i] then
      break;
    end
   else
    begin
     if (((b[i-1]+a[i]) div 2) <>a[i]) and ((b[i-1]+a[i]+1) div 2 <> a[i]) then
      break;
    end;
   b[i]:=a[i];
  end;
 if i>n then
  writeln(ans-1)
 else
  write(ans);
end.

var
   s : string;
   i,j,n,sum : longint;
   sr : extended;
   a : array[0..1000,0..1000] of longint;
   f : boolean;
begin
   readln(s);
   n := length(s);
   for j := 0 to 9 do
      a[1,j] := 1;
   for i := 2 to n do
   begin
      for j := 0 to 9 do
      begin
         sr := (j + (ord(s[i]) - 48)) / 2;
         if sr <> trunc(sr) then
         begin
            a[i,trunc(sr)] := a[i,trunc(sr)] + a[i-1,j];
             a[i,trunc(sr) + 1] := a[i,trunc(sr) + 1] + a[i-1,j];
         end else
            a[i,trunc(sr)] :=  a[i,trunc(sr)] + a[i-1,j];
      end;
   end;
   sum := 0;
   for j := 0 to 9 do
      sum := sum + a[n,j];
   f := true;
   for i := 2 to n do
     begin
       sr := ord(s[i]) - 48 + ord(s[i - 1]) - 48;
       sr := sr / 2;
       if sr = round(sr) then
         if (trunc(sr) <> ord(s[i]) - 48) then f := false;

       if sr <> round(sr) then
         if (trunc(sr) <> ord(s[i]) - 48)
         and (trunc(sr) + 1 <> ord(s[i]) - 48)
         then f := false;
     end;
   if f then dec(sum);
   write(sum);
end.

{$APPTYPE CONSOLE}
var s:string;
l:integer;
o:int64;
begin;
{reset(input,'input.txt');
rewrite(output,'output.txt');        }
readln(s);
l:=length(s);
o:=(l+2)*(l+2)-1;
if l=1 then writeln(0) else writeln(o);
{close(input);
close(output);}
end.

{$APPTYPE CONSOLE}

var s:string;
k:int64;
i,q,q1,pr,pr1,j:integer;
a:array[1..53,0..9] of integer;
begin
{ reset(input,'input.txt');
 rewrite(output,'output.txt'); }
 readln(s);
 for i := 0 to 9 do
 a[1,i]:=1;

  for i := 2 to length(s) do
   begin
      val(s[i],q,pr);
      for j:=0 to 9 do
       if (q+j) mod 2=0  then a[i,(q+j) div 2]:=a[i-1,j]+a[i,(q+j) div 2]
                         else
                            begin
                              a[i,(q+j) div 2]:=a[i-1,j]+a[i,(q+j) div 2];
                              a[i,(q+j) div 2+1]:=a[i-1,j]+a[i,(q+j) div 2+1];
                            end;
   end;
            k:=0;
            pr1:=0;
          for i:=0 to 9 do k:=k+a[length(s),i];
          val(s[1],q1,pr);
   for i:= 2 to length(s) do
           begin
            val(s[i],q,pr);
            if (q+q1) mod  2 =0 then begin if ((q+q1) div  2)<>q then pr1:=1; end
                                else if (((q+q1) div  2)<>q) and (((q+q1+1) div  2)<>q) then pr1:=1;
              q1:=q;
           end;

 if pr1=0 then dec(k);
 writeln(k);

{close(input);
close(output);}
end.

{$APPTYPE CONSOLE}
var s:string;
l:integer;
o:int64;
begin;
readln(s);
l:=length(s);
l:=l+2;
o:=l*l;
o:=o-1;
writeln(o);
end.

{$APPTYPE CONSOLE}
var s:string;
l:integer;
o:int64;
begin;
readln(s);
l:=length(s);
o:=(l+2)*(l+2)-1;
if l=1 then writeln(10) else writeln(o);
end.

program HH;

{$APPTYPE CONSOLE}

var
fin:boolean;
y,i,j,n,d,k,l,c,x,sum:longint;
s,s1,ss,sss,ssss:string;
a:array[1..105] of longint;
b:array[1..105,0..9] of longint;

begin
  {assign(input,'input.txt');
  assign(output,'output.txt');
  reset(input);
  rewrite(output);}
  readln(s);
  sum:=0;
  n:=length(s);
  sum:=0;
  if n=1 then writeln('9') else begin

  for i:=1 to n do begin
    val(s[i],a[i],c);
  end;

  for i:=0 to 9 do begin
  b[1,i]:=1;
  end;

  for i:=2 to n do begin

    for j:=0 to 9 do begin
      if (b[i-1,j]>0) and ((j+a[i]) mod 2=0) then begin
        b[i,(j+a[i]) div 2]:=b[i,(j+a[i]) div 2]+b[i-1,j];
      end;
      if (b[i-1,j]>0) and ((j+a[i]) mod 2=1) then begin
        b[i,(j+a[i]) div 2]:=b[i,(j+a[i]) div 2]+b[i-1,j];
        b[i,((j+a[i]) div 2)+1]:=b[i,((j+a[i]) div 2)+1]+b[i-1,j];
      end;
    end;

  end;

  for i:=0 to 9 do begin
  sum:=sum+b[n,i];
  end;
  {if (fin=false) then sum:=sum-1;}

  fin:=false;
  for i:=2 to n do begin
  y:=(a[i-1]+a[i])div 2;
  if ((a[i-1]+a[i])mod 2)=0 then begin
    if y<>a[i] then fin:=true;
  end else begin
    if (a[i]<y) or (a[i]>y+1) then fin:=true;
  end;
  end;
  if (fin=false) then sum:=sum-1;

  writeln(sum);

  end;

end.

{$APPTYPE CONSOLE}

{$R+,S+,Q+,I+,C+,M+,H+,O-}
{M 67108864}

uses SysUtils, Math;

var
    s:string;
    ls,kk,i,j,pp:longint;
    a:array[0..1010,0..10] of int64;
    ans:int64;

begin
{$IFNDEF ONLINE_JUDGE}
reset(input,'input.txt');
rewrite(output,'output.txt');
{$ENDIF}
fillchar(a,sizeof(a),0);
readln(s);
ls:=length(s);
kk:=ls-1;
ans:=0;
for i:=0 to 9 do
    a[1][i]:=1;
for i:=1 to kk do begin
    for j:=0 to 9 do begin
        pp:=j+ord(s[i+1])-48;
        inc(a[i+1][pp shr 1],a[i][j]);
        if pp and 1=1 then inc(a[i+1][(pp+1) shr 1],a[i][j]);
    end;
end;
for i:=0 to 9 do
    inc(ans,a[ls][i]);
for i:=2 to ls do
    if abs(ord(s[i])-ord(s[i-1]))>1 then begin
        dec(ans);
        break;
    end;
write(ans);
end.

//writeln(FormatDateTime('hh:mm:ss.zzz', now));

{$APPTYPE CONSOLE}

{$R+,S+,Q+,I+,C+,M+,H+,O-}
{M 67108864}

uses SysUtils, Math;

var
    s:string;
    ls,kk,i,j,pp:longint;
    a:array[0..1010,0..10] of int64;
    ans:int64;

begin
{$IFNDEF ONLINE_JUDGE}
reset(input,'input.txt');
rewrite(output,'output.txt');
{$ENDIF}
fillchar(a,sizeof(a),0);
readln(s);
ls:=length(s);
kk:=ls-1;
ans:=0;
for i:=0 to 9 do
    a[1][i]:=1;
for i:=1 to kk do begin
    for j:=0 to 9 do begin
        pp:=j+ord(s[i+1])-48;
        inc(a[i+1][pp div 2],a[i][j]);
        if pp and 1=1 then inc(a[i+1][(pp+1) div 2],a[i][j]);
    end;
end;
for i:=0 to 9 do
    inc(ans,a[ls][i]);
for i:=2 to ls do
    if abs(ord(s[i])-ord(s[i-1]))>1 then begin
        dec(ans);
        break;
    end;
write(ans);
end.

//writeln(FormatDateTime('hh:mm:ss.zzz', now));