program cf814E;
const mo=1000000007;
      maxn=51;
var dp:array[0..1,0..maxn,0..maxn,0..maxn,0..maxn] of int64;
    v:int64;
    i,pre,now,pre1,pre2,now1,now2,d1,d2,n:longint;
    d:array[0..maxn] of longint;
procedure plus(var x:int64;y:int64);inline;
begin
  x:=(x+y)mod mo;
end;
begin
  readln(n);
  for i:=1 to n do read(d[i]);
  d1:=d[1]-1;
  d2:=d[2]-1;
  fillchar(dp,sizeof(dp),0);
  if(d1=1)and(d2=1) then dp[0,1,0,1,0]:=1;
  if(d1=2)and(d2=1) then dp[0,0,1,1,0]:=1;
  if(d1=1)and(d2=2) then dp[0,1,0,0,1]:=1;
  if(d1=2)and(d2=2) then dp[0,0,1,0,1]:=1;
  for i:=3 to n do
  begin
    now:=i and 1;
    pre:=now xor 1;
    for pre1:=0 to i do
      for pre2:=0 to i do
        for now1:=0 to i do
          for now2:=0 to i do dp[now,pre1,pre2,now1,now2]:=0;
    for pre1:=0 to i-1 do
      for pre2:=0 to i-1 do
        for now1:=0 to i-1 do
          for now2:=0 to i-1 do if dp[pre,pre1,pre2,now1,now2]>0 then
          begin
            v:=dp[pre,pre1,pre2,now1,now2];
            if d[i]=2 then
            begin
              if pre1+pre2=0 then
              begin
                //next,1 edge
                if now1>0 then plus(dp[now,now1-1,now2,1,0],v*now1 mod mo);
                if now2>0 then plus(dp[now,now1+1,now2-1,1,0],v*now2 mod mo);
              end else
              begin
                //current

                //1 edge
                if pre1>0 then plus(dp[now,pre1-1,pre2,now1+1,now2],v*pre1 mod mo);
                if pre2>0 then plus(dp[now,pre1+1,pre2-1,now1+1,now2],v*pre2 mod mo);

                //2 edge
                if (pre1>0)and(now1>0) then
                  plus(dp[now,pre1-1,pre2,now1-1,now2],v*pre1 mod mo*now1 mod mo);
                if (pre1>0)and(now2>0) then
                  plus(dp[now,pre1-1,pre2,now1+1,now2-1],v*pre1 mod mo*now2 mod mo);
                if (pre2>0)and(now1>0) then
                  plus(dp[now,pre1+1,pre2-1,now1-1,now2],v*pre2 mod mo*now1 mod mo);
                if (pre2>0)and(now2>0) then
                  plus(dp[now,pre1+1,pre2-1,now1+1,now2-1],v*pre2 mod mo*now2 mod mo);
              end;
            end else
            begin
              if pre1+pre2=0 then
              begin
                //next,1 edge
                if now1>0 then plus(dp[now,now1-1,now2,0,1],v*now1 mod mo);
                if now2>0 then plus(dp[now,now1+1,now2-1,0,1],v*now2 mod mo);
              end else
              begin
                //current

                //1 edge
                if pre1>0 then plus(dp[now,pre1-1,pre2,now1,now2+1],v*pre1 mod mo);
                if pre2>0 then plus(dp[now,pre1+1,pre2-1,now1,now2+1],v*pre2 mod mo);

                //2 edge
                if (pre1>0)and(now1>0) then
                  plus(dp[now,pre1-1,pre2,now1,now2],v*pre1 mod mo*now1 mod mo);
                if (pre1>0)and(now2>0) then
                  plus(dp[now,pre1-1,pre2,now1+2,now2-1],v*pre1 mod mo*now2 mod mo);
                if (pre2>0)and(now1>0) then
                  plus(dp[now,pre1+1,pre2-1,now1,now2],v*pre2 mod mo*now1 mod mo);
                if (pre2>0)and(now2>0) then
                  plus(dp[now,pre1+1,pre2-1,now1+2,now2-1],v*pre2 mod mo*now2 mod mo);

                //3 edge
                if (pre1>0)and(now1>1) then
                  plus(dp[now,pre1-1,pre2,now1-2,now2],v*pre1 mod mo*(now1*(now1-1) div 2 mod mo)mod mo);
                if (pre1>0)and(now2>1) then
                  plus(dp[now,pre1-1,pre2,now1+2,now2-2],v*pre1 mod mo*(now2*(now2-1)div 2 mod mo)mod mo);
                if (pre1>0)and(now1>0)and(now2>0) then
                  plus(dp[now,pre1-1,pre2,now1,now2-1],v*pre1 mod mo*now1 mod mo*now2 mod mo);
                if (pre2>0)and(now1>1) then
                  plus(dp[now,pre1+1,pre2-1,now1-2,now2],v*pre2 mod mo*(now1*(now1-1) div 2 mod mo)mod mo);
                if (pre2>0)and(now2>1) then
                  plus(dp[now,pre1+1,pre2-1,now1+2,now2-2],v*pre2 mod mo*(now2*(now2-1)div 2 mod mo)mod mo);
                if (pre2>0)and(now1>0)and(now2>0) then
                  plus(dp[now,pre1+1,pre2-1,now1,now2-1],v*pre2 mod mo*now1 mod mo*now2 mod mo);
              end;
            end;
          end;
  end;
  writeln(dp[n and 1,0,0,0,0]);
end.

program cf814E;
const mo=1000000007;
      maxn=51;
var dp:array[0..1,0..maxn,0..maxn,0..maxn,0..maxn] of int64;
    v:int64;
    i,pre,now,pre1,pre2,now1,now2,d1,d2,n:longint;
    d:array[0..maxn] of longint;
procedure plus(var x:int64;y:int64);inline;
begin
  x:=(x+y)mod mo;
end;
begin
  readln(n);
  for i:=1 to n do read(d[i]);
  d1:=d[1]-1;
  d2:=d[2]-1;
  fillchar(dp,sizeof(dp),0);
  if(d1=1)and(d2=1) then dp[0,1,0,1,0]:=1;
  if(d1=2)and(d2=1) then dp[0,0,1,1,0]:=1;
  if(d1=1)and(d2=2) then dp[0,1,0,0,1]:=1;
  if(d1=2)and(d2=2) then dp[0,0,1,0,1]:=1;
  for i:=3 to n do
  begin
    now:=i and 1;
    pre:=now xor 1;
    for pre1:=0 to i do
      for pre2:=0 to i do
        for now1:=0 to i do
          for now2:=0 to i do dp[now,pre1,pre2,now1,now2]:=0;
    for pre1:=0 to i-1 do
      for pre2:=0 to i-1 do
        for now1:=0 to i-1 do
          for now2:=0 to i-1 do if dp[pre,pre1,pre2,now1,now2]>0 then
          begin
            v:=dp[pre,pre1,pre2,now1,now2];
            if d[i]=2 then
            begin
              if pre1+pre2=0 then
              begin
                //next,1 edge
                if now1>0 then plus(dp[now,now1-1,now2,1,0],v*now1 mod mo);
                if now2>0 then plus(dp[now,now1+1,now2-1,1,0],v*now2 mod mo);
              end else
              begin
                //current

                //1 edge
                if pre1>0 then plus(dp[now,pre1-1,pre2,now1+1,now2],v*pre1 mod mo);
                if pre2>0 then plus(dp[now,pre1+1,pre2-1,now1+1,now2],v*pre2 mod mo);

                //2 edge
                if (pre1>0)and(now1>0) then
                  plus(dp[now,pre1-1,pre2,now1-1,now2],v*pre1 mod mo*now1 mod mo);
                if (pre1>0)and(now2>0) then
                  plus(dp[now,pre1-1,pre2,now1+1,now2-1],v*pre1 mod mo*now2 mod mo);
                if (pre2>0)and(now1>0) then
                  plus(dp[now,pre1+1,pre2-1,now1-1,now2],v*pre2 mod mo*now1 mod mo);
                if (pre2>0)and(now2>0) then
                  plus(dp[now,pre1+1,pre2-1,now1+1,now2-1],v*pre2 mod mo*now2 mod mo);
              end;
            end else
            begin
              if pre1+pre2=0 then
              begin
                //next,1 edge
                if now1>0 then plus(dp[now,now1-1,now2,0,1],v*now1);
                if now2>0 then plus(dp[now,now1+1,now2-1,0,1],v*now2);
              end else
              begin
                //current

                //1 edge
                if pre1>0 then plus(dp[now,pre1-1,pre2,now1,now2+1],v*pre1);
                if pre2>0 then plus(dp[now,pre1+1,pre2-1,now1,now2+1],v*pre2);

                //2 edge
                if (pre1>0)and(now1>0) then
                  plus(dp[now,pre1-1,pre2,now1,now2],v*pre1*now1);
                if (pre1>0)and(now2>0) then
                  plus(dp[now,pre1-1,pre2,now1+2,now2-1],v*pre1*now2);
                if (pre2>0)and(now1>0) then
                  plus(dp[now,pre1+1,pre2-1,now1,now2],v*pre2*now1);
                if (pre2>0)and(now2>0) then
                  plus(dp[now,pre1+1,pre2-1,now1+2,now2-1],v*pre2*now2);

                //3 edge
                if (pre1>0)and(now1>1) then
                  plus(dp[now,pre1-1,pre2,now1-2,now2],v*pre1*(now1*(now1-1)>>1));
                if (pre1>0)and(now2>1) then
                  plus(dp[now,pre1-1,pre2,now1+2,now2-2],v*pre1*(now2*(now2-1)>>1));
                if (pre1>0)and(now1>0)and(now2>0) then
                  plus(dp[now,pre1-1,pre2,now1,now2-1],v*pre1*now1*now2);
                if (pre2>0)and(now1>1) then
                  plus(dp[now,pre1+1,pre2-1,now1-2,now2],v*pre2*(now1*(now1-1)>>1));
                if (pre2>0)and(now2>1) then
                  plus(dp[now,pre1+1,pre2-1,now1+2,now2-2],v*pre2*(now2*(now2-1)>>1));
                if (pre2>0)and(now1>0)and(now2>0) then
                  plus(dp[now,pre1+1,pre2-1,now1,now2-1],v*pre2*now1*now2);
              end;
            end;
          end;
  end;
  writeln(dp[n and 1,0,0,0,0]);
end.


var A:array [0..30] of int64;
        x,l,r,ans,ans1,ans2,t,t1:int64;
        kl,kr,i,j,v:integer;
        b,c:string[30];
begin
readln(l,r);
if r<=5 then begin
        ans:=r*(10-1-r);
        write(ans);
        exit;
end;

A[1]:=5;
A[0]:=1;
for i:=2 to 15 do
A[i]:=A[i-1]*10;
i:=15;

while A[i]>r do dec(i);
if A[i]>=l then
ans2:=A[i]*(A[i]-1)
else ans2:=0;

str(l,b);
for i:=1 to length(b) do
b[i]:=chr(ord('9')-ord(b[i])+ord('0'));
i:=1;
while b[i]='0' do inc(i);
b:=copy(b,i,length(b)-i+1);
val(b,t,v);
ans:=l*t;

str(r,b);
for i:=1 to length(b) do
b[i]:=chr(ord('9')-ord(b[i])+ord('0'));
i:=1;
while b[i]='0' do inc(i);
b:=copy(b,i,length(b)-i+1);
val(b,t,v);
ans1:=r*t;

        if (ans>ans1) and (ans>ans2) then write(ans)
        else if ans2>ans1 then write(ans2)
        else write(ans1);

end.

var l,r:int64;
t1,t2,ff,ss,f,s:int64;
opt:int64;
len:longint;
 begin
  readln(l,r);
  f:=1;
  s:=9;

  for len:=1 to 10 do
    begin
     ff:=f;
     ss:=s;
     if l>ff then ff:=l;
     if r<ss then ss:=r;

     while (ff+2<ss) do
       begin
        t1:=ff+(ss-ff) div 3;
        t2:=ss-(ss-ff) div 3;

        if t1*(s-t1)>t2*(s-t2) then ss:=t2
                               else ff:=t1;
       end;

     if (ff>=l)and(ff<=r) then
     if (ff*(s-ff))>opt then opt:=(ff*(s-ff));
     ff:=ff+1;
     if (ff>=l)and(ff<=r) then
     if (ff*(s-ff))>opt then opt:=(ff*(s-ff));
     ff:=ff+1;
     if (ff>=l)and(ff<=r) then
     if (ff*(s-ff))>opt then opt:=(ff*(s-ff));

     f:=f*10;
     s:=s*10+9;
    end;

  writeln(opt);
 end.

     uses math;
const san='0123456789';
      otr='9876543210';
var t1,l,r,chis:int64;
 function otra(v:int64):int64;
 var z:int64;
     q:longint;
     a:string;
 begin
 a:='';
     while v>0 do
     begin
      a:=otr[pos(chr((v mod 10)+48),san)]+a;
      v:=v div 10;
     end;
     val(a,z,q);
     otra:=z;
 end;

 begin
 read(l,r);
t1:=max(otra(l)*l,otra(r)*r);
chis:=5;
while chis<=r do
 begin
 if chis>=l then t1:=max(t1,otra(chis)*chis);
 chis:=chis*10;
 end;
 write(t1);
end.

Program 		A;
var
p : array[0..20] of int64;
w,i,j,k : Longint;
n,m,temp,now : int64;
flag : Boolean;
begin
	readln(n,m);
	W :=0;temp :=m;
	while temp>0 do
	begin
			W:=W+1;
			temp := temp div 10;
	end;
	p[0]:=1;
	for i :=1 to w do p[i]:=p[i-1]*10;
        flag :=false;
	for i :=4 downto 0 do
	if (i*p[w-1]<=m)and(i*p[w-1]>=n) then begin flag := true;break;end;

        if flag then begin
	Now := i*p[w-1];
	for i :=w-2 downto 0 do
	begin
		for j := 9 downto 0 do
		if  j*p[i]+now<=m then break;
		now := j*p[i]+now;
	end;
        end
        else begin
        for i :=5 to 9 do
	        if i*p[w-1]+p[w-1]-1>=n then begin flag := true;break;end;
                now := i*p[w-1];
                if flag then begin
	                Now := i*p[w-1];
	                for i :=w-2 downto 0 do
	                begin
		        for j :=0 to 9 do
		        if  j*p[i]+now+p[i]-1>=n then break;
		        now := j*p[i]+now;
	                end;
                end;
        end;
	writeln(now*(p[w]-1-Now));
end.

program solution;

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

uses
  SysUtils,
  Math;

var
  l, r, pow, ans, res : int64;

function f(a : int64) : int64;
var b : int64;
sz, i : integer;
begin
  b := a;
  sz := 0;
  while b > 0 do begin
    inc(sz);
    b := b div 10;
  end;
  b := 1;
  for i := 1 to sz do
    b := b * 10;
  result := a * (b - a - 1);
end;

begin
  //assign(input, 'input.txt'); reset(input);
  //assign(output, 'output.txt'); rewrite(output);
  read(l, r);
  ans := max(f(l), f(r));
  pow := 1;
  while true do begin
    if pow > r then
      break;
    res := pow * 5;
    if (res >= l) and (res <= r) then
      ans := max(ans, f(res));
    pow := pow * 10;
  end;
  writeln(ans);
end.

Var zz,l,r:int64;
z,i:longint;
function kol(x:int64):longint;
Var n:longint;
begin
  n:=0;
  while x<>0 do
  begin
    x:=x div 10;
    inc(n);
  end;
  kol:=n;
end;
function probeg(x:int64):int64;
Var z,rez:int64;
begin
  rez:=0;
  z:=1;
  while x<>0 do
  begin
    rez:=rez+z*(9-x mod 10);
    x:=x div 10;
    z:=z*10;
  end;
  probeg:=rez;
end;
begin
//  Assign(input,'input.txt'); reset(input);
//  Assign(output,'output.txt'); rewrite(output);
  read(l,r);
  if kol(l)<>kol(r)
  then begin
         z:=kol(r);
         l:=1;
         for i:=1 to z-1 do
         l:=l*10;
       end;
  z:=kol(r);
  zz:=1;
  for i:=1 to z-1 do
  zz:=zz*10;
  if r<=5*zz-1
  then writeln(r*probeg(r))
  else begin
        if l>5*zz-1
        then writeln(l*probeg(l))
        else writeln((5*zz-1)*probeg(5*zz-1));
       end;
end.

Program Reflection;
var l,r,max,half:int64;
    ans:qword;
begin
  readln(l,r);
  max:=1;
  while max<=r do max:=max*10;
  half:=max shr 1;
  max:=max-1;
  if (l<=half) and (half<=r) then ans:=half
  else if abs(half-l)<abs(half-r) then ans:=l else ans:=r;
  ans:=ans*(max-ans);
  writeln(ans);
end.

program xj;

  const
    wc=1e-7;

  var
    g:array[0..12]of int64;
    i,j,k,n,m:longint;
        l,r,ans,ll,rr,z:int64;

  begin
        read(l,r);
        ll:=trunc(ln(l)/ln(10))+1;
        rr:=trunc(ln(r)/ln(10))+1;
        g[0]:=0;
        for i:=1 to 12 do
          g[i]:=g[i-1]*10+9;
        ans:=0;
        for i:=ll+1 to rr-1 do
          begin
            z:=g[i] div 2*(g[i]-g[i] div 2);
                if z>ans then ans:=z;
          end;
        z:=l*(g[ll]-l);
        if z>ans then ans:=z;
        z:=r*(g[rr]-r);
        if z>ans then ans:=z;
        if ((g[ll] div 2>=l)and(g[ll] div 2<=r))or((g[ll]-g[ll] div 2>=l)and(g[ll]-g[ll] div 2<=r))
          then begin z:=g[ll] div 2*(g[ll]-g[ll] div 2);
                                 if z>ans then ans:=z;
                   end;
        ll:=rr;
        if ((g[ll] div 2>=l)and(g[ll] div 2<=r))or((g[ll]-g[ll] div 2>=l)and(g[ll]-g[ll] div 2<=r))
          then begin z:=g[ll] div 2*(g[ll]-g[ll] div 2);
                                 if z>ans then ans:=z;
                   end;
        writeln(ans);
  end.

{$r-,q-,s-,i-,o+}
var
  t,l,r,q,res:int64;
  j,i:longint;
  procedure check(x,q:int64);
    var
      i:int64;
      k:longint;
    begin
      i:=x;
      k:=0;
      while (i>0)do begin
        k:=k+1;
        i:=i div 10;
      end;
      i:=q;
      while (i>0)do begin
        k:=k-1;
        i:=i div 10;
      end;
      if (k<>0)then exit;
      if (x*(q-x)>res)then res:=x*(q-x);
    end;
begin
  read(l,r);
  q:=1;
  res:=0;
  for i:=1 to 10 do begin
    q:=q*10;
    check(l,q-1);
    check(r,q-1);
    for j:=-100 to 100 do begin
      t:=(q div 2)+j;
      if (t>=l)and(t<=r)then check(t,q-1);
    end;
  end;
  writeln(res);
end.

VAR
        m,l,r: int64;
        i:longint;
        s: string;
BEGIN
Readln(l,r); str(r,s); m:=0;
for i:=1 to length(s) do m:=10*m+9;
if (l<=m div 2) and (r>=m div 2) then Writeln((m div 2)*(m-(m div 2)))
else if r*(m-r)>l*(m-l) then Writeln(r*(m-r))
                        else Writeln(l*(m-l))
END.

uses
  SysUtils,
  math;

var mak,n,m,res,count,x:int64;
begin
  readln(n,m);
  count:=trunc(logn(10,m))+1;
  res:=trunc(power(10,count))-1;
  x:=res div 2;
  if (x<=m) and (x>=n) then mak:=x*(res-x)
  else begin
  if x>m then mak:=m*(res-m)
  else mak:=n*(res-n);
      end;
  writeln(mak);
end.

uses math;

var l,r,x:int64;

function tt(x:int64):int64;
var y:int64;
 begin
  y:=1;
  while y<=x do
   y:=y*10;
  tt:=x*(y-x-1);
 end;

 begin
  read(l,r);

  x:=1;
  while x*10<=r do
   x:=x*10;

  if (r>=x*5) and
     (l<=x*5) then begin
                    writeln((x*5)*(x*5-1));
                    halt;
                   end;

  if (r>=x*5-1) and
     (l<=x*5-1) then begin
                      writeln((x*5)*(x*5-1));
                      halt;
                     end;

  if (r>=x div 2) and
     (l<=x div 2) then begin
                        writeln(max(max(tt(l),tt(r)),(x div 2)*(x div 2-1)));
                        halt;
                       end;

  writeln(max(tt(l),tt(r)));
 end.

{$R+,Q+,I+}
{$apptype console}
Uses SysUtils;
Var
   l,r,t,g,i,k:Int64;
Function Heg(n:Int64):Int64;
Var
   r,t,k:Int64;
Begin
   r:=0;
   t:=n;
   k:=1;
   While t>0 Do Begin
      r:=r+(9-t mod 10)*k;
      t:=t div 10;
      k:=k*10;
   End;
   Heg:=n*r;
End;
Begin
   Read(l,r);
   t:=r;
   g:=0;
   While t>0 Do Begin
      g:=g+1;
      t:=t div 10;
   End;
   k:=5;
   i:=1;
   While i<=g-1 Do Begin
      k:=k*10;
      i:=i+1;
   End;
   If (k>=l) and (k<=r) Then Write(Heg(k))
   Else Begin
      If Heg(l)>Heg(r) Then Write(Heg(l))
                       Else Write(Heg(r));
   End;
End.

var
        kq,ni,k2,k1:int64;
        l,r,u,v,i:longint;
function tinh(x:longint):longint;
var
        y:longint;
begin
        y:=0;
        while x>0 do
        begin
                inc(y);
                x:=x div 10;
        end;
        tinh:=y;
end;
begin
        readln(l,r);
        if r=1000000000 then
        begin
                writeln('8999999999000000000');
                halt;
        end;
        u:=tinh(l); v:=tinh(r);
        kq:=0;
        if v>u+1 then
        begin
                for i:=1 to v-1 do kq:=kq*10+9;
                kq:=kq*kq-1;
                kq:=kq div 4;
        end;
        ni:=0;
        for i:=1 to v do ni:=ni*10+9;
        k1:=ni;
        ni:=ni div 2;
        if r<=ni then
        begin
                k2:=r;
                k2:=k2*2-k1;
                k2:=k2*k2;
                k1:=k1*k1;
                k2:=k1-k2;
                k2:=k2 div 4;
        end
        else
        if l<=ni then
        begin
                k2:=k1*k1-1;
                k2:=k2 div 4;
        end
        else
        begin
                k2:=l;
                k2:=k2*2-k1;
                k2:=k2*k2;
                k2:=k1*k1-k2;
                k2:=k2 div 4;
        end;
        if k2>kq then kq:=k2;
        ni:=0;
        for i:=1 to u do ni:=ni*10+9;
        k1:=ni;
        ni:=ni div 2;
        if l>=ni then
        begin
                k2:=l;
                k2:=k2*2-k1;
                k2:=k2*k2;
                k2:=k1*k1-k2;
                k2:=k2 div 4;
        end
        else
        if r>=ni then
        begin
                k2:=k1*k1-1;
                k2:=k2 div 4;
        end
        else
        begin
                k2:=r;
                k2:=k2*2-k1;
                k2:=k2*k2;
                k2:=k1*k1-k2;
                k2:=k2 div 4;
        end;
        writeln(kq);
end.

Type ttm=Record
           l,r:LongInt;
         End;
     tm=Array [1..9] of ttm;
Var i,x,l,r,h:LongInt;
    m:tm;
    kol:Int64;

Function Max (a,b,c:Int64):Int64;
Begin
     If (a>=b) and (a>=c) then Max:=a
     else If (b>=a) and (b>=c) then Max:=b
     else If (c>=a) and (c>=b) then Max:=c
End;

Function sum (x:LongInt):Int64;
Var s,ss:String;
    mm,kol:Int64;
    j:LongInt;
    code:Integer;
Begin
     Str (x,s);
     kol:=Length (s);
     ss:='';
     For J:=1 to kol do
     ss:=ss+'9';
     Val (ss,mm,code);
     sum:=(mm-x)*x;
End;

Begin
     //Assign (input,'input.txt'); ReSet (input);
     //Assign (output,'output.txt'); ReWrite (output);
     m[1].l:=499999999;
     m[1].r:=500000000;
     m[2].l:=49999999;
     m[2].r:=50000000;
     m[3].l:=4999999;
     m[3].r:=5000000;
     m[4].l:=499999;
     m[4].r:=500000;
     m[5].l:=49999;
     m[5].r:=50000;
     m[6].l:=4999;
     m[6].r:=5000;
     m[7].l:=499;
     m[7].r:=500;
     m[8].l:=49;
     m[8].r:=50;
     m[9].l:=4;
     m[9].r:=5;

     Readln (l,r);
     For I:=1 to 9 do
     If (l<=m[i].l) and (r>=m[i].l)
     then Begin kol:=sum(m[i].l); Break End
     else If (l<=m[i].r) and (r>=m[i].r)
          then Begin kol:=sum (m[i].r); Break End;
     kol:=Max (sum (l),sum (r),kol);
     Writeln (kol);
End.

uses
  math;
var
  ans,l,r,x:int64;

function weight(x:int64):int64;
var
  power,mem,res,c:int64;
begin
  res:=0; mem:=x; power:=1;
  while (x<>0) do
  begin
    c:=x mod 10;
    c:=9-c;
    res:=res+c*power;
    power:=power*10;
    x:=x div 10;
  end;
  weight:=res*mem;
end;

begin
  readln(l,r);
  ans:=max(weight(l),weight(r));
  x:=5;
  while (x<=r) do
  begin
    if (l<=x) and (x<=r) then ans:=max(ans,weight(x));
    x:=x*10;
  end;
  writeln(ans);
end.

var
   n,d,x,y,z:int64;
   i,j:longint;
   b:array[0..10] of int64;

function psi(n:int64):int64;
var
  a,d:int64;
begin
   d:=1;
   a:=0;
   while n>0 do
   begin
      a:=d*(9-n mod 10)+a;
      d:=d*10;
      n:=n div 10;
   end;
   psi:=a;
end;
begin
   d:=1;
   for i:=1 to 10 do
   begin
      d:=d*10;
      b[i]:=d-1;
   end;
   readln(x,y);

   j:=1;
   while y>b[j] do
      j:=j+1;
   begin
      z:=b[j] div 2;
      if (x<z) AND (z<y) then
         z:=psi(z)*z
      else
         z:=-1;
      x:=psi(x)*x;
      y:=psi(y)*y;

      if y>x then
         x:=y;
      if x<z then
         x:=z;
   end;
   writeln(x);
end.

uses math;
const otr='0123456789';
      sam='9876543210';
var t1,n,m,chis:int64;
function link(v:int64):int64;
var i:int64;
    j,q:longint;
    a,s:string;
begin
  i:=0;
  str(v,s);
  a:='';
  for j:=1 to length(s) do
  a:=a+otr[pos(s[j],sam)];
  val(a,i,q);
  link:=i;
end;
begin
  readln(n,m);
  t1:=max(link(n)*n,link(m)*m);
  chis:=5;
  while chis<=m do
  begin
   if chis>=n then t1:=max(t1,link(chis)*chis);
   chis:=chis*10;
  end;
  writeln(t1);
end.

{$R+,S+,Q+,I+,O-}
{R-,S-,Q-,I-,O+}
var
  cur,ans,ll,rr,a,b,s,best,mid: int64;
  d: longint;
begin
//  assign(input,'in'); reset(input);
//  assign(output,'out'); rewrite(output);
  read(ll,rr);
  ans:=0; s:=1;
  for d:=1 to 10 do
  begin
    a:=ll; b:=rr;
    if a < s then a:=s;
    if b > s*10-1 then b:=s*10-1;
    if a <= b then
    begin
      mid:=s*5;
      if a > mid then best:=a else
      if b < mid then best:=b
      else best:=mid;
      cur:=best*(s*10-best-1);
      if cur > ans then ans:=cur;
    end;
    s:=s*10;
  end;
  writeln(ans);
  close(input);
  close(output);
end.

{$APPTYPE CONSOLE}
{$R-,Q-,O+,S+}
uses
 SysUtils,Math;
var
 l1,r1,q1,q2,l,r,m1,m2,ans : int64;
 q,i : longint;
function fi(x : int64) : int64;
var
 s : string;
 i : longint;
begin
 result:=0;
 s:=inttostr(x);
 for i:=1 to length(s) do
  result:=result*10+9-(ord(s[i])-48);
end;
begin
 randomize;
// reset(input,'input.txt');
// rewrite(output,'output.txt');
 readln(l,r);
 l1:=l;
 r1:=r;
 for i:=1 to 10000 do
  begin
   m1:=l+((r-l) div 3);
   m2:=r-((r-l) div 3);
   q1:=fi(m1)*m1;
   q2:=fi(m2)*m2;
   if q1>q2 then
    r:=m2
   else
    l:=m1;
  end;
 ans:=fi(l)*l;
 for i:=l+1 to r do
  ans:=max(ans,fi(i)*i);
 l:=l1;
 r:=r1;
 for i:=1 to 10000 do
  begin
   m1:=l+((r-l) div 3);
   m2:=r-((r-l) div 3);
   q1:=fi(m1)*m1;
   q2:=fi(m2)*m2;
   if q1<q2 then
    r:=m2
   else
    l:=m1;
  end;
 ans:=max(ans,fi(l)*l);
 for i:=l+1 to r do
  ans:=max(ans,fi(i)*i);
 if r1-l1<1000000 then
  for i:=l1 to r1 do
   ans:=max(ans,fi(i)*i)
 else
  begin
   for i:=max(r1-1000000,l1) to r1 do
    ans:=max(ans,fi(i)*i)
  end;
 writeln(ans);
end.

{$APPTYPE CONSOLE}
{$R-,Q-,O+,S+}
uses
 SysUtils,Math;
var
 l1,r1,q1,q2,l,r,m1,m2,ans : int64;
 q,i : longint;
function fi(x : int64) : int64;
var
 s : string;
 i : longint;
begin
 result:=0;
 s:=inttostr(x);
 for i:=1 to length(s) do
  result:=result*10+9-(ord(s[i])-48);
end;
procedure ok;
var
 i : longint;
begin
 for i:=1 to 10000 do
  begin
   q:=random(r-l);
   m1:=l+q;
   m2:=r-q;
   q1:=fi(m1)*m1;
   q2:=fi(m2)*m2;
   if q1<q2 then
    r:=m2
   else
    l:=m1;
  end;
 ans:=max(ans,fi(l)*l);
 for i:=l+1 to r do
  ans:=max(ans,fi(i)*i);
end;
begin
 randomize;
// reset(input,'input.txt');
// rewrite(output,'output.txt');
 readln(l,r);
 l1:=l;
 r1:=r;
 for i:=1 to 10000 do
  begin
   m1:=l+((r-l) div 3);
   m2:=r-((r-l) div 3);
   q1:=fi(m1)*m1;
   q2:=fi(m2)*m2;
   if q1>q2 then
    r:=m2
   else
    l:=m1;
  end;
 ans:=fi(l)*l;
 for i:=l+1 to r do
  ans:=max(ans,fi(i)*i);
 l:=l1;
 r:=r1;
 for i:=1 to 10000 do
  begin
   m1:=l+((r-l) div 3);
   m2:=r-((r-l) div 3);
   q1:=fi(m1)*m1;
   q2:=fi(m2)*m2;
   if q1<q2 then
    r:=m2
   else
    l:=m1;
  end;
 ans:=max(ans,fi(l)*l);
 for i:=l+1 to r do
  ans:=max(ans,fi(i)*i);
 for i:=1 to 100 do
  begin
   l:=l1;
   r:=r1;
   ok;
  end;
 if r1-l1<1000000 then
  for i:=l1 to r1 do
   ans:=max(ans,fi(i)*i)
 else
  begin
   for i:=max(r1-1000000,l1) to r1 do
    ans:=max(ans,fi(i)*i)
  end;
 writeln(ans);
end.

program shablon;
{$MODE OBJFPC}{$H+}
{$O+ R-  Q-} {$ASSERTIONS ON} {$INLINE ON}
{$COperators ON}

uses
 SysUtils,Math;

const inf=1/0;

var i,j:longint;
    ans,v:int64;
    a,b:string;
    l,r:longint;
procedure pout;
begin

{$IFNDEF ONLINE_JUDGE}
 close(input);
 close(output);
{$ENDIF}
 halt(0);
end;

procedure pinit;
begin
{$IFNDEF ONLINE_JUDGE}
 assign(input,'input.txt');
 assign(output,'output.txt');
 reset(input);
 rewrite(output);
{$ENDIF}
 readln(l,r);

end;

function ff(r:int64):int64;
begin
    a:=inttostr(r);
    b:='';
    for j:=length(a) downto 1 do
      b:=chr(ord('9')-(ord(a[j])-ord('0')))+b;
    v:=strtoint64(b);
    result:=int64(v*r);

end;

procedure solve;
var k,p:int64;
begin
 ans:=0;
 p:=r;
 k:=0;
 while p>0 do
  begin
   p:=p div 10;
   inc(k);
  end;
 p:=5;
 for i:=2 to k do
  p:=p*10;
 if p>=r
  then
   begin
    ans:=ff(r);
   end
  else
   begin
    if l>p
     then
      begin
       ans:=ff(l);
      end
     else
      begin
       ans:=ff(p);
      end;
   end;
 write(ans);
end;

begin
 pinit;
 solve;
 pout;
end.

uses math;
Var x,l,r,ans:int64;
 function w(x:int64):int64;
   var  s:string;
        q:int64;
        j:longint;
     begin
        q:=0;
        str(x,s);
        for j:=1 to length(s) do
          q:=q*10+(9-ord(s[j])+48);
       w:=x*q;
     end;
  begin
    read(l,r);
    ans:=max(w(l),w(r));
    x:=4;
    While x<=r do
      begin
        if (x>=l)and(x<=r) then ans:=max(ans,w(x));
        x:=x*10+9;
      end;
    Writeln(ans);
  end.

program Projectob;

{$APPTYPE CONSOLE}

uses
  SysUtils;
  var
l,r,i,n,k,p:int64;
begin
{ TODO -oUser -cConsole Main : Insert code here }
read(l,r);
n:=1;
while r>=n do n:=n*10;
n:=n div 10;
//writeln(n);
if (n=r) then
p:=r;
if r<10*n div 2 then p:=r;
if l>10*n div 2 then p:=l;
if (10*n div 2<=r)and(l<=10*n div 2) then p:=5*n;
k:=10*n-1-p;
writeln(p*k);
read(i);
end.

program Project1;
{$APPTYPE CONSOLE}
procedure mask(a,b:int64;var y: int64;var l:integer);
var s: string;
    i,com: integer;
    temp: int64;
begin
str(b,s);
com:=length(s);
temp:=5;
for i := 2 to com do
  temp:=temp*10;
if (b >= temp) and (a <= temp) then
  y:=temp;
if (b <= temp) then
  y:=b;
if (b >= temp) and (a >= temp) then
  y:=a;
l:=com;
end;

procedure inverse(l:integer;y: int64;var inv: int64);
var i:integer;
begin
inv:=9;
for i:= 2 to l do
  inv:=inv*10+9;
inv:=inv - y;
end;

var a,b: int64;
    x,y:int64;
    len:integer;
begin
read(a,b);
mask(a,b,x,len);
inverse(len,x,y);
writeln(x*y);
end.

program Project1;
var i:integer;

function znak(i:integer):byte;
var l:integer;
begin
 l:=0;
 while i<>0 do
  begin
   inc(l);
   i:=i div 10;
  end;
  znak:=l;
end;

procedure writeans(a:int64);
begin
  writeln(a);
  halt(0);
end;

procedure gogo(l,r:integer);
var x,y:int64;
    i,j:integer;
begin
  j:=znak(r);
  x:=9;
  for i:=2 to j do
  x:=x*10+9;
  if (r>=x div 2)and(l<=x div 2+1) then writeans((x div 2)*(x div 2+1))
  else if znak(r)>znak(l) then  writeans(r*(x-r))
  else if (abs(r-x div 2)<abs(l-x div 2)) then writeans(r*(x-r))
  else writeans(l*(x-l))
end;
var n,m:integer;
begin
// assign(input,'input.txt');reset(input);
// assign(output,'output.txt');rewrite(output);
 readln(n,m);
 gogo(n,m);
end.

var
lb,la,now,r,l,t1,t2,r_:int64;
i:longint;
begin
 // assign(input,'input.txt');reset(input);
 // assign(output,'output.txt');rewrite(output);
  readln(l,r);
  r_:=r;
  while r>0 do
  begin
    inc(lb);
    r:=r div 10;
  end;
  r:=r_;
  now:=0;
  for i:=1 to lb do now:=now*10+9;
  t1:=now div 2;t2:=now div 2+1;
  if (l<=t2)and(r>=t1) then
  begin
    writeln(t1*(now-t1));
  end
  else
  begin
    if (r<t1) then writeln(r*(now-r))
    else writeln(l*(now-l));
  end;
 // close(input);close(output);
end.

Var
  L,R,X:Int64;

  Function Go(X:Int64):Int64;
  Var R,T:Int64;
  Begin
    R:=0;T:=1;
    While X>0 Do
    Begin
      R:=R+(9-X Mod 10)*T;
      T:=T*10;
      X:=X Div 10;
    End;
    Go:=R;
  End;

Begin
  {Assign(Input,'Input.txt');Reset(Input);
  Assign(Output,'Output.txt');Rewrite(Output);}

  Read(L,R);
  X:=1;
  While X<=R Do
    X:=X*10;
  X:=X Div 10;X:=X*5;

  If (L<=X) And (R>=X)
  Then Write(Go(X)*X)
  Else If (L<=X) And (R<=X)
    Then Write(Go(R)*R)
    Else Write(Go(L)*L);

End.

var
   l,r,n,k,d	:	int64;
   i		:	longint;
   s		:	string;
begin
//   reset(input,'a.in');   rewrite(output,'a.out');
    read(l,r);
    str(r,s);
    n:=length(s);
    k:=5; d:=10;
    for i:=1 to n - 1 do
    	d:=d * 10;
    k:=(d div 10) * k;
    if (r >= k - 1) and (k >= l) then write(k * (k - 1)) else
    if (r >= k - 1) then write(l * (d - 1 - l)) else write(r * (d - 1 - r));

end.

uses math;
var f1,f2:text;
l,r:int64;
m9,i:longint;
mid:int64;
res:int64;

Function rev(v:longint):int64;
var st:string;
s:int64;
i:longint;
begin
        str(v,st);
        s:=0;
        for i:=1 to length(st) do
        s:=s*10+9-(ord(st[i])-48);
        rev:=s;
end;

begin
        assign(f1,'');reset(f1);
        assign(f2,'');rewrite(f2);
        readln(f1,l,r);
        m9:=0;
        for i:=1 to 9 do
        begin
          m9:=m9*10+9;
          mid:=m9 div 2;
          if (mid>=l) and (mid<=r) then res:=max(res,mid*(m9-mid));
          mid:=m9 div 2+1;
          if (mid>=l) and (mid<=r) then res:=max(res,mid*(m9-mid));
        end;
        res:=max(res,l*rev(l));
        res:=max(res,r*rev(r));
        writeln(f2,res);
        close(f1);
        close(F2);
end.

var
        i:longint;
        l,r,pot,m1,num:int64;
function max(a,b:int64):int64;
begin
        if a<b then
                max:=b
        else
                max:=a;
end;
function d(a:longint):int64;
var
        f:longint;
begin
        f:=0;
        while a>0 do
        begin
                a:=a div 10;
                inc(f);
        end;
        d:=f;
end;
function comp(da:int64):int64;
var
        pot:int64;
        x:longint;
begin
        pot:=1;
        for x:=1 to d(da) do
                pot:=pot*10;
        pot:=pot-1;
        comp:=pot-da;
end;
function f(g:int64):int64;
begin
        f:=g*comp(g);
end;
begin
        readln(l,r);
        pot:=1;
        for i:=1 to d(r)-1 do
        begin
                pot:=pot*10;
        end;
        if d(l)<d(r) then
        begin

                l:=pot;
        end;
        m1:=(pot*10-1) div 2;
        num:=max(f(l),f(r));
        if (l<=m1) and (m1<=r) then
        begin
                num:=max(num,f(m1));
        end;
        if (l<=m1+1) and (m1+1<=r) then
        begin
                num:=max(num,f(m1+1));
        end;
        writeln(num);
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils, Math;

var
  l, r : integer;
  k, t : int64;

function f(v : integer) : int64;
var
  t : int64;
begin
  t := 1;
  While t <= v do
  begin
    t := t * 10;
  end;
  result := v * (t - v - 1);
end;

begin
{  assign(input, 'input.txt') ;
  reset(input) ;
  assign(output, 'output.txt');
  rewrite(output);
}
  read(l, r);

  k := 0;
  t := 1;
  While t * 10 <= r do
  begin
    t := t * 10;
    k := k + 1;
  end;

  if (r >= t * 5) and (l <= t * 5) then
  begin
    writeln((t * 5) * (t * 5 - 1));
    halt(0);
  end;

  if (r >= t * 5 - 1) and (l <= t * 5 - 1) then
  begin
    writeln((t * 5) * (t * 5 - 1));
    halt(0);
  end;

  if (r >= t div 2) and (l <= t div 2) then
  begin
    writeln(max(max(f(l), f(r)),(t div 2) * (t div 2 - 1)));
    halt(0);
  end;

  writeln(max(f(l), f(r)));

end.

var temp:longint;
    ot,max,mi,l,r,a,i:int64;
    s,s2:string;
begin

 max:=-1;
 readln(l,r);
 str(r,s);
 s2:='4';
 while length(s)>length(s2)do s2:=s2+'9';
 val(s2,a,temp);
 if (a>=l)and(a<=r)then i:=a else
  if a>r then i:=r
   else i:=l;

 ot:=1;
 while ot<=i do ot:=ot*10;
 ot:=ot-1-i;
 write(i*ot);
end.

program aaa;  var a,b,i,m,n,k,l,t:int64;j:longint;{s:string;a:array[0..10]of string;    w:string;{    label 1; } q:char; f:boolean; function aa(q:char):longint; begin  if pos(q,'aeiouAEIOU')>0 then aa:=1 else aa:=0; end; begin  { assign(input,'input.txt');reset(input);  assign(output,'output.txt');rewrite(output); }  readln(a,b);  m:=1; while m<=a do m:=m*10;m:=m-1;  n:=1;while n<=b do n:=n*10;n:=n-1;  if m=n then  begin   k:=m div 2;   if (a<=k)and(b>=k) then write(k*(m-k)) else   begin    if a>k then write(a*(m-a)) else write(b*(m-b));   end;  end else  begin    k:=m div 2;    if k<a then a:=k*(m-k) else a:=a*(m-a);    k:=n div 2;    if k<b then b:=k*(n-k) else b:=b*(n-b);    if a>b then write(a) else write(b);  end;   end.

{$M 16777216}
program solution;

{$APPTYPE CONSOLE}

uses
    SysUtils, Math;

const
    MaxN = 100000;

type
    int = longint;

var
    i, l, r: int64;
    k, maxx, sum: int64;

function weight(i: int64): int64;
var
    s: string;
    z: int;
    a, b: int64;
begin
    a := i;
    s := inttostr(i);
    b := 0;
    for z := 1 to length(s) do
        b := b * 10 + (9 - (ord(s[z]) - ord('0')));
    result := a * b;
end;

begin

{$IFNDEF ONLINE_JUDGE}
    assign(input, 'input.txt');
    reset(input);
    assign(output, 'output.txt');
    rewrite(output);
{$ENDIF}

    sum := -1;
    read(l, r);
    k := 1;
    {i := l;
    while i <= r do begin
        k := weight(i);
        if k > sum then begin
            maxx := i;
            sum := k;
        end;
        inc(i);
    end;
    write(maxx, ' ', sum);
    }

    while k < r do
        k := k * 10;
    if k = r then
        write(weight(k))
    else begin
        if k div 2 > r then
            write(weight(r))
        else begin
            if k div 2 >= l then
                write(weight(k div 2))
            else
                write(weight(l));
        end;
    end;

{$IFNDEF ONLINE_JUDGE}
    close(input);
    close(output);
{$ENDIF}

end.

{ uses crt;}
   const nn=200; eps=0.0000001;
   label 1;
    type mas=array [-nn..nn] of int64;
    trip=record mx,my,m:real;end;   trip1=^trip;

    var n2,n1,ot,n,k,t,p,imin,m,s,d,l,r:int64;
    pp,pp1,pp2:int64;

     i,j:longint;
      cc, bb,aa ,b,x,y,kk,tt:mas;  ot1: trip;
       obl:boolean; gvx,gvy,rr:real; sss:array[0..3] of real;
    mgl:trip;
    function al(x,y:real):real; var t,p:real;
 begin
     if (x>0)and(y>=0) then p:=arctan(y/x);
     if x<0 then p:=pi+arctan(y/x);
     if(x>0)and(y<0) then p:=2*pi+arctan(y/x);
     if x=0 then if (y>=0) then p:=pi/2 else p:=3*pi/2;
     al:=p/pi*180;
 end;
  function max(x,y:int64):int64;begin max:=x;if y>x then max:=y; end;

  function otr(n:int64):int64;
  var s,k,p:int64; i,j:longint;  a,b:array[0..20] of int64;
begin k:=n;i:=0;while k>0 do begin inc(i);a[i]:=k mod 10;k:=k div 10;    end;
      for j:=1 to i do b[j]:=9-a[j]; s:=0;
    p:=1;  for j:=1 to i do begin s:=s+b[j]*p;p:=p*10;end;
   otr:=s;
end;

     begin   { clrscr;
     assign(input,'input.txt');        reset (input);  }
    { writeln(otr(637));}
    readln(l,r);ot:=0;
  {  for i:=l to r do begin p:=otr(i); if (p*i)>=ot then t:=i;
    ot:=max(ot,i*otr(i));end;writeln(t,' ',ot);  }
   k:=r;
   i:=0;while k>0 do begin inc(i);aa[i]:=k mod 10;k:=k div 10;    end;
   n1:=i;

   k:=l;
   i:=0;while k>0 do begin inc(i);bb[i]:=k mod 10;k:=k div 10;    end;
   n2:=i;

if n1>n2 then
  begin if aa[n1]>=5 then begin cc[n1]:=5;for i:=1 to n1-1 do cc[i]:=0; end
    else for i:=1 to n1 do cc[i]:=aa[i];

  {  for i:=1 to n1  do write(cc[i],' '); writeln;  }
   s:=0; p:=1;
   for j:=1 to n1 do begin s:=s+cc[j]*p;p:=p*10;end;  ot:=s; goto 1;
  end;

if n1=n2 then
  begin p:=5;for i:=1 to n1-1 do p:=p*10;
  {  writeln(p); }
    if (l<=p)and(p<=r) then begin ot:=p; goto 1; end;
    if l>=p then begin  ot:=l; goto 1;    end;
    if r<=p then begin  ot:=r; goto 1;    end;
  end;
1:{ writeln (ot); }
  pp:=ot; pp1:=otr(ot);
  writeln(pp*pp1);

           end.

Uses Math;
var
    i : longint;
    l, r, ans : int64;

function pow(b : longint) : longint;
var
    res, j : longint;
begin
    res := 1;
    for j := 1 to b do res := res * 10;
    pow := res;
end;
function go(x : int64) : int64;
var
    y, p : int64;
begin
    y := 0; p := 1;
    while (x > 0) do begin
      y := y + (9-(x mod 10))*p;
      x := x div 10;
      p := p * 10;
    end;
    go := y;
end;
begin
//    reset(input, 'a.in'); rewrite(output, 'a.out');
    read(l, r);
    ans := go(l)*l;
    ans := max(ans, go(r)*r);
    for i := 0 to 9 do
        if (l < 5*pow(i)-1) and (5*pow(i)-1 < r) then
            ans := max(ans, go(5*pow(i)-1)*(5*pow(i)-1));
    write(ans);
end.

{$apptype console}
{$R+,S+,I+,Q+}
const
     inf = 'input.txt';
     outf = 'output.txt';
var
 i:longint;
 l,r,ans,cur,z1,z2:int64;
 s:array[1..9] of int64;

 function f(n:int64):int64;
 var k,res:int64;
  begin
   k:=1;
   res:=0;
   while n > 0 do
    begin
     inc(res,k*(9-n mod 10));
     n:=n div 10;
     k:=k*10;
    end;
   f:=res;
  end;

begin
 //reset(input,inf);
 //rewrite(output,outf);
 read(l,r);
 s[1]:=10;
 for i:=2 to 9 do s[i]:=10*s[i-1];
 ans:=l*f(l);
 cur:=r*f(r);
 if cur > ans then ans:=cur;
 for i:=1 to 9 do
  begin
   z1:=s[i] div 2;
   z2:=z1-1;
   if (z1 >= l) and (z1 <= r) then
    begin
     cur:=z1*f(z1);
     if cur > ans then ans:=cur;
    end;
   if (z2 >= l) and (z2 <= r) then
    begin
     cur:=z2*f(z2);
     if cur > ans then ans:=cur;
    end;
  end;
 writeln(ans);
end.

program cf86a;
var
  l,r:longint;
  o:int64;
  ans:int64;
begin
  readln(l,r);
  o:=1;
  while o<=r do o:=o*10;
  dec(o);

  if (l<=o shr 1)and(r>=o shr 1) then ans:=o shr 1
  else
    if (r-o shr 1)<(o shr 1-l) then ans:=r
    else ans:=l;
  ans:=ans*(o-ans);

  writeln(ans);
end.

uses math;
var l,r:int64;

function trongso(x:int64):int64;
var s:ansistring;
k:int64;
i:longint;
begin
str(x,s);
k:=0;
for i:=1 to length(s) do k:=k*10+9;
exit((k-x)*x);
end;

function xuli:int64;
var k:int64;
s:ansistring;
i:longint;
begin
str(r,s);
k:=4;
for i:=1 to length(s)-1 do k:=k*10+9;
if (k<=r)and(k>=l) then exit(trongso(k)) else exit(0);
end;

begin
//assign(input,'cc.inp');reset(input);
//assign(output,'cc.out');rewrite(output);
read(l,r);
writeln(max(max(trongso(l),trongso(r)),xuli))
end.

type
  Integer = LongInt;
  LongInt = Int64;

var
  l, r: LongInt;
  c1, c2: Integer;
  res: Int64;

function digit_cnt(a: LongInt): Integer;
var
  res: Integer;
begin
  res := 0;
  while a > 0 do
  begin
   Inc(res);
   a := a div 10;
  end;
  digit_cnt := res;
end;

function pow10(c: Integer): LongInt;
var
  res: LongInt;
  i: Integer;
begin
  res := 1;
  for i := 1 to c do res := res*10;
  pow10 := res;
end;

function wigth(n: LongInt): Int64;
var
  n1, tmp: LongInt;
  a: Integer;
  p10: LongInt;
begin
  tmp := n; p10 := 1;
  n1 := 0;
  while tmp > 0 do
  begin
   a := 9 - (tmp mod 10); tmp := tmp div 10;
   n1 := p10*a+n1;
   p10 := p10*10;
  end;
  wigth := Int64(n1)*Int64(n);
end;

function min(a, b: Int64): Int64;
begin
  if a > b then min := a else min := b;
end;

begin
  ReadLn(l, r);
  c1 := digit_cnt(l); c2 := digit_cnt(r);
  c1 := c1-1; c2 := c2-1;
  if c1 < c2 then l := pow10(c2);
  //WriteLn(l, ' ', r, ' ', pow10(c2)*5);
  res := min(wigth(r), wigth(l));
  if (pow10(c2)*5 > l) and (pow10(c2)*5 < r) then res := min(res, wigth(pow10(c2)*5));
  WriteLn(res);
end.

uses math;

var q,r,g,n,m,ans: int64;

begin
  read(n,m);
  q:=trunc(logn(10,m))+1;
  r:=trunc(power(10,q))-1;
  g:=r div 2;
  if ((g<=m) and (g>=n)) then ans:=g*(r-g) else begin
    if (g>m) then ans:=m*(r-m)
    else ans:=n*(r-n);
  end;
  writeln(ans);
end.

uses  math;
var
  l,r,i: longint;
  a: array[0..11] of int64;
  s,kq: int64;
begin
  a[0]:=1;
  for i:=1 to 10 do
    a[i]:=a[i-1]*10;

  kq:=0;
  readln(l,r);
  for i:=0 to 8 do
  begin
    s:=max(l,min(r,(a[i+1]-1) div 2));
    if (a[i]<=s) and (s<a[i+1]) then
    begin
      s:=(a[i+1]-s-1)*s;
      kq:=max(kq,s);
    end;
  end;
  if r=a[9] then kq:=max(kq,a[9]*(a[9+1]-1-a[9]));
  writeln(kq);
end.

{$R-,Q-,S-,I-}
{$OPTIMIZATION LEVEL2}
{$INLINE ON}

uses math;

procedure mofile;
begin
        {$IFDEF ONLINE_JUDGE}
        assign(input,'');
        reset(input);
        assign(output,'');
        rewrite(output);
        {$ELSE}
        assign(input,'');
        reset(input);
        assign(output,'');
        rewrite(output);
        {$ENDIF}
end;

procedure dongfile;
begin
        close(input);
        close(output);
end;

const
        maxc=1000000000+69;
        modulo=1000000000+7;

type
        re=record
                x,y:longint;
        end;

var
        i:longint;
        l,r,p,q:int64;

begin
        mofile;
        readln(l,r);
        p:=0;
        for i:=1 to 10 do
        begin
                p:=p*10+9;
                if r<=p then break;
        end;
        q:=p div 2;
        if r<=q then writeln(r*(p-r)) else
        if (l>=q) then writeln(l*(p-l)) else writeln(q*(p-q));
        dongfile;
end.

var
 l,r:longint;
 rr,ans,st,c,y,xx,q,max,x:int64;
function f(x:int64):int64;
begin
 st:=1;
 xx:=x;
 y:=0;
 while (xx>0) do
 begin
  inc(y,(9-xx mod 10)*st);
  xx:=xx div 10;
  st:=st*10;
 end;
 f:=x*y;
end;
begin
 readln(l,r);
 st:=1;
 rr:=r;
 while rr>0 do
 begin
  rr:=rr div 10;
  st:=st*10;
 end;
 st:=st div 10;
 c:=st*5;
 if c>r then ans:=r;
 if c<l then ans:=l;
 if (c>=l)and(c<=r) then ans:=c;
 writeln(f(ans));
end.

var n,m,i,j,k,step,t,lik,max,t1,t2,t3:int64;

function p(lik:int64):int64;
var lik2:int64;
error:longint;
    st:string;
    i:longint;
begin
 str(lik,st);
 for i:= 1 to length(st) do
  st[i]:=chr(ord('9')-ord(st[i])+48);
 val(st,lik2,error);
 p:=lik2;

end;

begin
 readln(n,m);
 t1:=p(n)*n;
 t2:=p(m)*m;
 if t1<T2 then max:=t2 else max:=t1;
 lik:=5;
 while (lik<=m) do
  begin
   t3:=lik*p(lik);
   if (t3>max) and (lik>=n) then max:=t3;
   lik:=lik*10;
  end;
 writeln(max);
end.

var i,temp:longint;
    ot,max,mi,l,r,a:int64;
    s,s2:string;
begin
 readln(l,r);
 str(r,s);
 s2:='4';
 while length(s)>length(s2)do s2:=s2+'9';
 val(s2,a,temp);
 if (a>l)and(a<r)then write(a) else
  if a>r then write(r)
   else write(l);
end.

program aaa;
 var a,b,i,m,n,k,l,t:int64;j:longint;{s:string;a:array[0..10]of string;
   w:string;{
   label 1; } q:char; f:boolean;
function aa(q:char):longint;
begin
 if pos(q,'aeiouAEIOU')>0 then aa:=1 else aa:=0;
end;
begin

{ assign(input,'input.txt');reset(input);
 assign(output,'output.txt');rewrite(output); }
 readln(a,b);
 m:=1; while m<=a do m:=m*10;m:=m-1;
 n:=1;while n<=b do n:=n*10;n:=n-1;
 if m=n then
 begin
  k:=m div 2;
  if (a<=k)and(b>=k) then write(k*(m-k)) else
  begin
   if a>k then write(a*(m-k)) else write(b*(m-b));
  end;
 end else
 begin
   k:=m div 2;
   if k<a then a:=k*(m-k) else a:=a*(m-a);
   k:=n div 2;
   if k<b then b:=k*(n-k) else b:=b*(n-b);
   if a>b then write(a) else write(b);
 end;

end.

Uses Math;
var
    i : longint;
    l, r, ans : int64;

function pow(b : longint) : longint;
var
    res, j : longint;
begin
    res := 1;
    for j := 1 to b do res := res * 10;
    pow := res;
end;
function go(x : int64) : int64;
var
    y : int64;
begin
    y := 0;
    while (x > 0) do begin
      y := y * 10 + 9-(x mod 10);
      x := x div 10;
    end;
    go := y;
end;
begin
//    reset(input, 'a.in'); rewrite(output, 'a.out');
    read(l, r);
    ans := go(l)*l;
    ans := max(ans, go(r)*r);
    for i := 0 to 9 do
        if (l < 5*pow(i)-1) and (5*pow(i)-1 < r) then
            ans := max(ans, go(5*pow(i)-1)*(5*pow(i)-1));
    write(ans);
end.

program solution;

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

uses
  SysUtils,
  Math;

var
  l, r, cur, pow, ans, res : int64;

function f(a : int64) : int64;
var b, c : int64;
begin
  b := 0;
  c := a;
  while c > 0 do begin
    b := b * 10 + 9 - (c mod 10);
    c := c div 10;
  end;
  result := a * b;
end;

begin
  //assign(input, 'input.txt'); reset(input);
  //assign(output, 'output.txt'); rewrite(output);
  read(l, r);
  ans := max(f(l), f(r));
  pow := 1;
  cur := 1;
  while true do begin
    if pow > r then
      break;
    res := pow * 5;
    if (res >= l) and (res <= r) then
      ans := max(ans, f(res));
    pow := pow * 10;
  end;
  writeln(ans);
end.

{$APPTYPE CONSOLE}

uses
  SysUtils,math;
var l,r,m,l1,r1,ans:int64;
 i:integer;
function f(x:int64):int64;
var r:int64;
begin
 r:=9;
 while r<x do
 begin
  r:=r*10+9;
 end;
 f:=x*(r-x);
end;
begin
  readln(l,r);
  while (l+2<r) do
  begin
   m:=(r-l) div 3;
   l1:=l+m;
   r1:=r-m;
   if f(l1)<f(r1) then l:=l1
   else r:=r1;
  end;
  ans:=0;
  for i:=l to r do
   ans:=max(ans,f(i));
  writeln(ans);
end.

{$R+,Q+,I+}
{$apptype console}
Uses SysUtils;
Var
   l,r,l1,i,ans:Int64;
Function Heg(n:Int64):Int64;
Var
   r,t,k:Int64;
Begin
   r:=0;
   t:=n;
   k:=1;
   While t>0 Do Begin
      r:=r+(9-t mod 10)*k;
      t:=t div 10;
      k:=k*10;
   End;
   Heg:=n*r;
End;
Begin
   Read(l,r);
   l1:=r;
   While (l1>0) and (l1 mod 10<>9) Do l1:=l1-1;
   If l1<l Then l1:=l;
   i:=l1;
   ans:=0;
   While i<=r Do Begin
      If Heg(i)>ans Then ans:=Heg(i);
      i:=i+1;
   End;
   Write(ans);
End.

Uses Math;
Type ttm=Record
           l,r:LongInt;
         End;
     tm=Array [1..9] of ttm;
Var i,x,l,r,h:LongInt;
    m:tm;
    kol:Int64;

Function sum (x:LongInt):Int64;
Var s,ss:String;
    mm,kol:Int64;
    j:LongInt;
    code:Integer;
Begin
     Str (x,s);
     kol:=Length (s);
     ss:='';
     For J:=1 to kol do
     ss:=ss+'9';
     Val (ss,mm,code);
     sum:=(mm-x)*x;
End;

Begin
     //Assign (input,'input.txt'); ReSet (input);
     //Assign (output,'output.txt'); ReWrite (output);
     m[1].l:=499999999;
     m[1].r:=500000000;
     m[2].l:=49999999;
     m[2].r:=50000000;
     m[3].l:=4999999;
     m[3].r:=5000000;
     m[4].l:=499999;
     m[4].r:=500000;
     m[5].l:=49999;
     m[5].r:=50000;
     m[6].l:=4999;
     m[6].r:=5000;
     m[7].l:=499;
     m[7].r:=500;
     m[8].l:=49;
     m[8].r:=50;
     m[9].l:=4;
     m[9].r:=5;

     Readln (l,r);
     For I:=1 to 9 do
     If (l<=m[i].l) and (r>=m[i].l)
     then Begin kol:=sum(m[i].l); Writeln (kol); Exit End
     else If (l<=m[i].r) and (r>=m[i].r)
          then Begin kol:=sum (m[i].r); Writeln (kol); Exit End;
     kol:=Max (sum (l),sum (r));
     Writeln (kol);
End.

Type ttm=Record
           l,r:LongInt;
         End;
     tm=Array [1..9] of ttm;
Var i,x,l,r,h:LongInt;
    m:tm;
    kol:Int64;

Function Max (a,b,c:Int64):Int64;
Begin
     If (a>=b) and (a>=c) then Max:=a
     else If (b>=a) and (b>=c) then Max:=b
     else If (c>=a) and (c>=b) then Max:=c
End;

Function sum (x:LongInt):Int64;
Var s,ss:String;
    mm,kol:Int64;
    j:LongInt;
    code:Integer;
Begin
     Str (x,s);
     kol:=Length (s);
     ss:='';
     For J:=1 to kol do
     ss:=ss+'9';
     Val (ss,mm,code);
     sum:=(mm-x)*x;
End;

Begin
     //Assign (input,'input.txt'); ReSet (input);
     //Assign (output,'output.txt'); ReWrite (output);
     m[1].l:=499999999;
     m[1].r:=500000000;
     m[2].l:=49999999;
     m[2].r:=50000000;
     m[3].l:=4999999;
     m[3].r:=5000000;
     m[4].l:=499999;
     m[4].r:=500000;
     m[5].l:=49999;
     m[5].r:=50000;
     m[6].l:=4999;
     m[6].r:=5000;
     m[7].l:=499;
     m[7].r:=500;
     m[8].l:=49;
     m[8].r:=50;
     m[9].l:=4;
     m[9].r:=5;

     Readln (l,r);
     For I:=1 to 9 do
     If (l<=m[i].l) and (r>=m[i].l)
     then kol:=sum(m[i].l)
     else If (l<=m[i].r) and (r>=m[i].r)
          then kol:=sum (m[i].r);
     kol:=Max (sum (l),sum (r),kol);
     Writeln (kol);
End.

{$R+,S+,Q+,I+,O-}
{R-,S-,Q-,I-,O+}
var
  cur,ans,ll,rr,a,b,s,best,mid: int64;
  d: longint;
begin
//  assign(input,'in'); reset(input);
//  assign(output,'out'); rewrite(output);
  read(ll,rr);
  ans:=0; s:=1;
  for d:=1 to 10 do
  begin
    a:=ll; b:=rr;
    if a < s then a:=s;
    if b > s*10-1 then b:=s*10-1;
    if a > b then continue;
    mid:=s*5;
    if a > mid then best:=a else
    if b < mid then best:=b
    else best:=mid;
    cur:=best*(s*10-best-1);
    if cur > ans then ans:=cur;
    s:=s*10;
  end;
  writeln(ans);
  close(input);
  close(output);
end.

{$APPTYPE CONSOLE}
{$R-,Q-,O+,S+}
uses
 SysUtils,Math;
var
 q1,q2,l,r,m1,m2,ans : int64;
 i : longint;
function fi(x : int64) : int64;
var
 s : string;
 i : longint;
begin
 result:=0;
 s:=inttostr(x);
 for i:=1 to length(s) do
  result:=result*10+9-(ord(s[i])-48);
end;
begin
// reset(input,'input.txt');
// rewrite(output,'output.txt');
 readln(l,r);
 for i:=1 to 10000 do
  begin
   m1:=l+((r-l) div 3);
   m2:=r-((r-l) div 3);
   q1:=fi(m1)*m1;
   q2:=fi(m2)*m2;
   if q1<q2 then
    r:=m2
   else
    l:=m1;
  end;
 ans:=fi(l)*l;
 for i:=l+1 to r do
  ans:=max(ans,fi(i)*i);
 writeln(ans);
end.

{$APPTYPE CONSOLE}
{$R-,Q-,O+,S+}
uses
 SysUtils,Math;
var
 l1,r1,q1,q2,l,r,m1,m2,ans : int64;
 i : longint;
function fi(x : int64) : int64;
var
 s : string;
 i : longint;
begin
 result:=0;
 s:=inttostr(x);
 for i:=1 to length(s) do
  result:=result*10+9-(ord(s[i])-48);
end;
begin
// reset(input,'input.txt');
// rewrite(output,'output.txt');
 readln(l,r);
 l1:=l;
 r1:=r;
 for i:=1 to 10000 do
  begin
   m1:=l+((r-l) div 3);
   m2:=r-((r-l) div 3);
   q1:=fi(m1)*m1;
   q2:=fi(m2)*m2;
   if q1>q2 then
    r:=m2
   else
    l:=m1;
  end;
 ans:=fi(l)*l;
 for i:=l+1 to r do
  ans:=max(ans,fi(i)*i);
 l:=l1;
 r:=r1;
 for i:=1 to 10000 do
  begin
   m1:=l+((r-l) div 3);
   m2:=r-((r-l) div 3);
   q1:=fi(m1)*m1;
   q2:=fi(m2)*m2;
   if q1<q2 then
    r:=m2
   else
    l:=m1;
  end;
 ans:=max(ans,fi(l)*l);
 for i:=l+1 to r do
  ans:=max(ans,fi(i)*i);
 if r1-l1<1000000 then
  for i:=l1 to r1 do
   ans:=max(ans,fi(i)*i);
 writeln(ans);
end.

{$APPTYPE CONSOLE}
{$R-,Q-,O+,S+}
uses
 SysUtils,Math;
var
 l1,r1,q1,q2,l,r,m1,m2,ans : int64;
 q,i : longint;
function fi(x : int64) : int64;
var
 s : string;
 i : longint;
begin
 result:=0;
 s:=inttostr(x);
 for i:=1 to length(s) do
  result:=result*10+9-(ord(s[i])-48);
end;
begin
// reset(input,'input.txt');
// rewrite(output,'output.txt');
 readln(l,r);
 ans:=fi(l)*l;
 for i:=max(r-1000000,l) to r do
  ans:=max(ans,fi(i)*i);
 writeln(ans);;
end.

{$APPTYPE CONSOLE}
{$R-,Q-,O+,S+}
uses
 SysUtils,Math;
var
 l1,r1,q1,q2,l,r,m1,m2,ans : int64;
 i : longint;
function fi(x : int64) : int64;
var
 s : string;
 i : longint;
begin
 result:=0;
 s:=inttostr(x);
 for i:=1 to length(s) do
  result:=result*10+9-(ord(s[i])-48);
end;
begin
// reset(input,'input.txt');
// rewrite(output,'output.txt');
 readln(l,r);
 l1:=l;
 r1:=r;
 for i:=1 to 10000 do
  begin
   m1:=l+((r-l) div 3);
   m2:=r-((r-l) div 3);
   q1:=fi(m1)*m1;
   q2:=fi(m2)*m2;
   if q1>q2 then
    r:=m2
   else
    l:=m1;
  end;
 ans:=fi(l)*l;
 for i:=l+1 to r do
  ans:=max(ans,fi(i)*i);
 l:=l1;
 r:=r1;
 for i:=1 to 10000 do
  begin
   m1:=l+((r-l) div 3);
   m2:=r-((r-l) div 3);
   q1:=fi(m1)*m1;
   q2:=fi(m2)*m2;
   if q1<q2 then
    r:=m2
   else
    l:=m1;
  end;
 ans:=max(ans,fi(l)*l);
 for i:=l+1 to r do
  ans:=max(ans,fi(i)*i);
 writeln(ans);
end.

program Projectob;

{$APPTYPE CONSOLE}

uses
  SysUtils;
  var
l,r,i,n,k,p:int64;
begin
{ TODO -oUser -cConsole Main : Insert code here }
read(l,r);
n:=1;
while r>=n do n:=n*10;
n:=n div 10;
if n>l then
p:=r div 2 else p:=(l+r) div 2;
k:=10*n-1-p;
writeln(p*k);
read(i);
end.

program Projectob;

{$APPTYPE CONSOLE}

uses
  SysUtils;
  var
l,r,i,n,k,p:int64;
begin
{ TODO -oUser -cConsole Main : Insert code here }
read(l,r);
n:=1;
while r>=n do n:=n*10;
n:=n div 10;
if n=r then
p:=r  else p:=(r+l)div 2;
k:=10*n-1-p;
writeln(p*k);
read(i);
end.

program Projectob;

{$APPTYPE CONSOLE}

uses
  SysUtils;
  var
l,r,i,n,k,p:int64;
begin
{ TODO -oUser -cConsole Main : Insert code here }
read(l,r);
n:=1;
while r>=n do n:=n*10;
n:=n div 10;
if n=r then
p:=r  else p:=(r+l)div 2;
k:=10*n-1-p;
writeln(p,' ',k,' ',p*k);
read(i);
end.

program Projectob;

{$APPTYPE CONSOLE}

uses
  SysUtils;
  var
l,r,i,n,k,p:int64;
begin
{ TODO -oUser -cConsole Main : Insert code here }
read(l,r);
n:=1;
while r>=n do n:=n*10;
n:=n div 10;
//writeln(n);
if (n=r) then
p:=r;
if r<10*n div 2 then p:=r;
if l>10*n div 2 then p:=l;
if (10*n div 2<r)and(l<10*n div 2) then p:=5*n;
k:=10*n-1-p;
writeln(p*k);
read(i);
end.

program Projectob;

{$APPTYPE CONSOLE}

uses
  SysUtils;
  var
l,r,i,n,k,p:int64;
begin
{ TODO -oUser -cConsole Main : Insert code here }
read(l,r);
n:=1;
while r>=n do n:=n*10;
n:=n div 10;
//writeln(n);
if (n=r) then
p:=r;
if r<10*n div 2 then p:=r;
if l>10*n div 2 then p:=l;
if (10*n div 2<r)and(l<10*n div 2) then p:=(r+l)div 2;
k:=10*n-1-p;
writeln(p*k);
//read(i);
end.

program Projectob;

{$APPTYPE CONSOLE}

uses
  SysUtils;
  var
l,r,i,n,k,p:int64;
begin
{ TODO -oUser -cConsole Main : Insert code here }
read(l,r);
n:=1;
while r>=n do n:=n*10;
n:= n div 10;
if n>=l then
p:=(n+r)div 2 else p:=(l+r) div 2;
k:=10*n-1-p;
writeln(p*k);
//read(i);
end.

program Project1;
{$APPTYPE CONSOLE}
procedure mask(a,b:int64;var y: int64;var l:integer);
var s: string;
    i,com: integer;
    temp: int64;
begin
str(b,s);
com:=length(s);
temp:=5;
for i := 2 to com do
  temp:=temp*10;
if (b > temp) and (a < temp) then
  y:=temp;
if (b < temp) then
  y:=b;
if (b > temp) and (a > temp) then
  y:=a;
l:=com;
end;

procedure inverse(l:integer;y: int64;var inv: int64);
var i:integer;
begin
inv:=9;
for i:= 2 to l do
  inv:=inv*10+9;
inv:=inv - y;
end;

var a,b: int64;
    x,y:int64;
    len:integer;
begin
read(a,b);
mask(a,b,x,len);
inverse(len,x,y);
writeln(x*y);
end.

program Project1;
{$APPTYPE CONSOLE}

procedure mask(x: int64; var y:int64);
var s: string;
    l,i:integer;
begin
str(x,s);
l:=length(s);
y:=9;
for i := 2 to l do
y:=y*10+9;
end;
var //file1: text;
    a,b,i: longint;
    y,res,temp,max, a1,a2: int64;
begin
max:=0;
read(a,b);
for i := b div 2 + 1 to b do
begin
  mask(i,y);
  temp:=y-i;
  res:=int64(i)*temp;
  if res > max then
    begin
    max:=res;
    a1:=int64(i);
    a2:=temp;
    end;
end;
writeln(max);
end.

Var
  I:Longint;L,R,X,Y,Max:Int64;

  Function Go(X:Int64):Int64;
  Var R,T:Int64;
  Begin
    R:=0;T:=1;
    While X>0 Do
    Begin
      R:=R+(9-X Mod 10)*T;
      T:=T*10;
      X:=X Div 10;
    End;
    Go:=R;
  End;

Begin
  {Assign(Input,'Input.txt');Reset(Input);
  Assign(Output,'Output.txt');Rewrite(Output);}

  Read(L,R);
  X:=1;
  While X<=R Do
    X:=X*10;
  X:=X Div 10;

  Max:=0;
  For I:=X To x*5 Do
  Begin
    Y:=Go(I)*I;
    if ((y>=l) and (y<=r))or((i>=l)and(i<=r))
    then begin
      If Y>Max
      Then Max:=Y;
      break;
    end;
  End;

  Write(Max);
End.

Var
  I:Longint;L,R,X,yY,y,Max:Int64;

  Function Go(X:Int64):Int64;
  Var R,T:Int64;
  Begin
    R:=0;T:=1;
    While X>0 Do
    Begin
      R:=R+(9-X Mod 10)*T;
      T:=T*10;
      X:=X Div 10;
    End;
    Go:=R;
  End;

Begin
  {Assign(Input,'Input.txt');Reset(Input);
  Assign(Output,'Output.txt');Rewrite(Output);}

  Read(L,R);
  X:=1;
  While X<=R Do
    X:=X*10;
  X:=X Div 10;
  yy:=4;
  while yy<=x do
    yy:=yy*10+4;

  Max:=0;
  For I:=yy  downto x Do
  Begin
    y:=Go(I);
    if ((y>=l)and(y<=r))or((i>=l)and(i<=r))
    then begin
      If Y*i>Max
      Then Max:=Y*i;
      break;
    end;
  End;

  Write(Max);
End.

Var
  I:Longint;L,R,X,Y,Max:Int64;

  Function Go(X:Int64):Int64;
  Var R,T:Int64;
  Begin
    R:=0;T:=1;
    While X>0 Do
    Begin
      R:=R+(9-X Mod 10)*T;
      T:=T*10;
      X:=X Div 10;
    End;
    Go:=R;
  End;

Begin
  {Assign(Input,'Input.txt');Reset(Input);
  Assign(Output,'Output.txt');Rewrite(Output);}

  Read(L,R);
  X:=1;
  While X<=R Do
    X:=X*10;
  X:=X Div 10;

  Max:=0;
  For I:=X To x*5 Do
  Begin
    Y:=Go(I);
    if ((y>=l) and (y<=r))or((i>=l)and(i<=r))
    then begin
      If Y*i>Max
      Then Max:=Y*i;
      break;
    end;
  End;

  Write(Max);
End.

Var
  I:Longint;L,R,X,Y,Max:Int64;

  Function Go(X:Int64):Int64;
  Var R,T:Int64;
  Begin
    R:=0;T:=1;
    While X>0 Do
    Begin
      R:=R+(9-X Mod 10)*T;
      T:=T*10;
      X:=X Div 10;
    End;
    Go:=R;
  End;

Begin
  {Assign(Input,'Input.txt');Reset(Input);
  Assign(Output,'Output.txt');Rewrite(Output);}

  Read(L,R);
  X:=1;
  While X<=R Do
    X:=X*10;
  X:=X Div 10;
  y:=4;
  while y<=x do
    y:=y*10+4;

  Max:=0;
  For I:=y  downto x Do
  Begin
    Y:=Go(I);
    if ((y>=l)and(y<=r))or((i>=l)and(i<=r))
    then begin
      If Y*i>Max
      Then Max:=Y*i;
      break;
    end;
  End;

  Write(Max);
End.

var
   l,r,n,k,d	:	int64;
   i		:	longint;
   s		:	string;
begin
//   reset(input,'a.in');   rewrite(output,'a.out');
    read(l,r);
    str(r,s);
    n:=length(s);
    k:=5; d:=10;
    for i:=1 to n - 1 do
    	d:=d * 10;
    k:=(d div 10) * k;
    if r >=  k - 1 then write(k * (k - 1)) else
        write(r * (d - 1 - r));

end.

var
        kq,ni,k1,k2:int64;
        l,r,u,v,i:longint;
function tinh(x:longint):longint;
var
        y:longint;
begin
        y:=0;
        while x>0 do
        begin
                inc(y);
                x:=x div 10;
        end;
        tinh:=y;
end;
begin
        readln(l,r);
        u:=tinh(l); v:=tinh(r);
        kq:=0;
        if v>u+1 then
        begin
                for i:=1 to v-1 do kq:=kq*10+9;
                kq:=kq*kq-1;
                kq:=kq div 4;
        end;
        ni:=0;
        for i:=1 to v do ni:=ni*10+9;
        k1:=ni;
        ni:=ni div 2;
        if r<=ni then
        begin
                k2:=r;
                k2:=k2*2-k1;
                k2:=k2*k2;
                k2:=k1*k1-k2;
                k2:=k2 div 4;
        end
        else
        if l<=ni then
        begin
                k2:=k1*k1-1;
                k2:=k2 div 4;
        end
        else
        begin
                k2:=l;
                k2:=k2*2-k1;
                k2:=k2*k2;
                k2:=k1*k1-k2;
                k2:=k2 div 4;
        end;

        if k2>kq then kq:=k2;
        ni:=0;
        for i:=1 to u do ni:=ni*10+9;
        k1:=ni;
        ni:=ni div 2;
        if l>=ni then
        begin
                k2:=l;
                k2:=k2*2-k1;
                k2:=k2*k2;
                k2:=k1*k1-k2;
                k2:=k2 div 4;
        end
        else
        if r>=ni then
        begin
                k2:=k1*k1-1;
                k2:=k2 div 4;
        end
        else
        begin
                k2:=r;
                k2:=k2*2-k1;
                k2:=k2*k2;
                k2:=k1*k1-k2;
                k2:=k2 div 4;
        end;
        writeln(kq);
end.

var
   n,d,x,y,z:int64;
   i,j:longint;
   a,b:array[0..10] of int64;

function psi(n:int64):int64;
var
  a,d:int64;
begin
   d:=1;
   a:=0;
   while n>0 do
   begin
      a:=d*(9-n mod 10)+a;
      d:=d*10;
      n:=n div 10;
   end;
   psi:=a;
end;
begin
   d:=1;
   for i:=1 to 10 do
   begin
      d:=d*10;
      b[i]:=a[i]-1;
   end;
   readln(x,y);

   j:=1;
   while y>b[j] do
      j:=j+1;
   begin
      z:=b[j] div 2;
      if (x<z) AND (z<y) then
         z:=psi(z)*z
      else
         z:=-1;
      x:=psi(x)*x;
      y:=psi(y)*y;

      if y>x then
         x:=y;
      if x<z then
         x:=z;
   end;
   writeln(x);
end.

program shablon;
{$MODE OBJFPC}{$H+}
{$O+ R-  Q-} {$ASSERTIONS ON} {$INLINE ON}
{$COperators ON}

uses
 SysUtils,Math;

const inf=1/0;

var i,j:longint;
    ans,v:int64;
    a,b:string;
    l,r:longint;
procedure pout;
begin

{$IFNDEF ONLINE_JUDGE}
 close(input);
 close(output);
{$ENDIF}
 halt(0);
end;

procedure pinit;
begin
{$IFNDEF ONLINE_JUDGE}
 assign(input,'input.txt');
 assign(output,'output.txt');
 reset(input);
 rewrite(output);
{$ENDIF}
 readln(l,r);

end;

function ff(r:int64):int64;
begin
    a:=inttostr(r);
    b:='';
    for j:=length(a) downto 1 do
      b:=chr(ord('9')-(ord(a[j])-ord('0')))+b;
    v:=strtoint64(b);
    result:=int64(v*r);

end;

procedure solve;
var k,p:int64;
begin
 ans:=0;
 p:=r;
 k:=0;
 while p>0 do
  begin
   p:=p div 10;
   inc(k);
  end;
 p:=5;
 for i:=2 to k do
  p:=p*10+5;
 if p>=r
  then
   begin
    ans:=ff(r);
   end
  else
   begin
    if l>p
     then
      begin
       ans:=ff(l);
      end
     else
      begin
       ans:=ff(p);
      end;
   end;
 write(ans);
end;

begin
 pinit;
 solve;
 pout;
end.

program shablon;
{$MODE OBJFPC}{$H+}
{$O+ R-  Q-} {$ASSERTIONS ON} {$INLINE ON}
{$COperators ON}

uses
 SysUtils,Math;

const inf=1/0;

var i,j:longint;
    ans,v:int64;
    a,b:string;
    l,r:longint;
procedure pout;
begin

{$IFNDEF ONLINE_JUDGE}
 close(input);
 close(output);
{$ENDIF}
 halt(0);
end;

procedure pinit;
begin
{$IFNDEF ONLINE_JUDGE}
 assign(input,'input.txt');
 assign(output,'output.txt');
 reset(input);
 rewrite(output);
{$ENDIF}
 readln(l,r);

end;

procedure solve;
var k,p:int64;
begin
 ans:=0;
 p:=r;
 k:=0;
 while p>0 do
  begin
   p:=p div 10;
   inc(k);
  end;
 p:=5;
 for i:=2 to k do
  p:=p*10+5;
 if p>=r
  then
   begin
    a:=inttostr(r);
    b:='';
    for j:=length(a) downto 1 do
      b:=chr(ord('9')-(ord(a[j])-ord('0')))+b;
    v:=strtoint64(b);
    ans:=v*r;
   end
  else
   begin
    if l>p
     then
      begin
       a:=inttostr(l);
       b:='';
       for j:=length(a) downto 1 do
        b:=chr(ord('9')-(ord(a[j])-ord('0')))+b;
       v:=strtoint64(b);
       ans:=v*l;
      end
     else
      begin
       a:=inttostr(p);
       b:='';
       for j:=length(a) downto 1 do
        b:=chr(ord('9')-(ord(a[j])-ord('0')))+b;
       v:=strtoint64(b);
       ans:=v*p;
      end;
   end;
 write(ans);
end;

begin
 pinit;
 solve;
 pout;
end.

type
  Integer = LongInt;
  LognInt = Int64;

var
  l, r: LongInt;
  c1, c2: Integer;
  res: Int64;

function digit_cnt(a: LongInt): Integer;
var
  res: Integer;
begin
  res := 0;
  while a > 0 do
  begin
   Inc(res);
   a := a div 10;
  end;
  digit_cnt := res;
end;

function pow10(c: Integer): LongInt;
var
  res: LongInt;
  i: Integer;
begin
  res := 1;
  for i := 1 to c do res := res*10;
  pow10 := res;
end;

function wigth(n: LongInt): Int64;
var
  n1, tmp: LongInt;
  a: Integer;
  p10: LongInt;
begin
  tmp := n; p10 := 1;
  n1 := 0;
  while tmp > 0 do
  begin
   a := 9 - (tmp mod 10); tmp := tmp div 10;
   n1 := p10*a+n1;
   p10 := p10*10;
  end;
  wigth := Int64(n1)*Int64(n);
end;

function min(a, b: Int64): Int64;
begin
  if a > b then min := a else min := b;
end;

begin
  ReadLn(l, r);
  c1 := digit_cnt(l); c2 := digit_cnt(r);
  c1 := c1-1; c2 := c2-1;
  if c1 < c2 then l := pow10(c2);
  //WriteLn(l, ' ', r, ' ', pow10(c2)*5);
  res := min(wigth(r), wigth(l));
  if (pow10(c2)*5 > l) and (pow10(c2)*5 < r) then res := min(res, wigth(pow10(c2)*5));
  WriteLn(res);
end.

var n,m,i,j,k,step,t,lik,max,t1,t2,t3:int64;

function p(lik:int64):int64;
var lik2:int64;
error:longint;
    st:string;
    i:longint;
begin
 str(lik,st);
 for i:= 1 to length(st) do
  st[i]:=chr(ord('9')-ord(st[i])+48);
 val(st,lik2,error);
 p:=lik2;

end;

begin
 readln(n,m);
 t1:=p(n)*n;
 t2:=p(m)*m;
 if t1<T2 then max:=t2 else max:=t1;
 lik:=5;
 while (lik<=m) do
  begin
   t3:=lik*p(lik);
   if t3>max then max:=t3;
   lik:=lik*10;
  end;
 writeln(max);
end.

var k1,k2,l,r,kol,tr,ans:int64;
i,j:longint;
n1,n2,w,max,ans2:int64;
a:array[0..11] of int64;
begin
readln(l,r);
ans:=(l+r) div 2;
k1:=ans-100000;
if k1<l then k1:=l;
k2:=ans+100000;
if k2>r then k2:=r;
for j:= k1 to k2 do
begin
ans:=j; ans2:=ans;
kol:=0;
while ans>0 do
begin
inc(kol);
a[kol]:=ans mod 10;
ans:=ans div 10;
end;
for i:= 1 to kol do
a[i]:=9-a[i];
i:=kol;
while a[i]=0 do dec(i);
tr:=0;
while i>0 do
begin
tr:=tr*10+a[i];
dec(i);
end;
n1:=j;
w:=ans2*tr;
if w>max then begin max:=w;   {writeln(max,' ',j); }  end;
end;
writeln(max);
end.

var k1,k2,l,r,kol,tr,ans:int64;
i,j:longint;
n1,n2,w,max,ans2:int64;
a:array[0..11] of int64;
begin
readln(l,r);
ans:=(l+r) div 2;
k1:=ans-100000;
if k1<l then k1:=l;
k2:=ans+100000;
if k2>r then k2:=r;
for j:= k1 to k2 do
begin
ans:=j; ans2:=ans;
kol:=0;
while ans>0 do
begin
inc(kol);
a[kol]:=ans mod 10;
ans:=ans div 10;
end;
for i:= 1 to kol do
a[i]:=9-a[i];
i:=kol;
while a[i]=0 do dec(i);
tr:=0;
while i>0 do
begin
tr:=tr*10+a[i];
dec(i);
end;
n1:=j;
w:=ans2*tr;
if w>max then begin max:=w;   {writeln(max,' ',j); }  end;
end;
writeln(max,' ',j);
end.

var A:array [0..30] of int64;
        x,l,r,ans,ans1,ans2,t,t1:int64;
        kl,kr,i,j,v:integer;
        b,c:string[30];

function pow10(x:integer):int64;
var i:byte;
        p:int64;
begin
        p:=1;
        for i:=1 to x do
        p:=p*10;
        pow10:=p;
end;
begin
readln(l,r);
if r<=5 then begin
        ans:=r*(10-1-r);
        write(ans);
        exit;
end;
x:=l;
kl:=0;
while x<>0 do
begin
        x:=x div 10;
        inc(kl);
end;
x:=r;
kr:=0;
while x<>0 do
begin
        x:=x div 10;
        inc(kr);
end;
A[1]:=5;
A[0]:=1;
for i:=2 to 12 do
A[i]:=A[i-1]*10;
i:=12;
ans2:=1;
ans:=1;
while A[i]>r do dec(i);
if A[i]>=l then
        ans2:=ans2*A[i]*(A[i]-1);

        ans1:=1;
        t:=pow10(kr+1)-1-r;
        str(t,c);
        i:=1;
        while (c[i]='9') or (c[i]='0') do inc(i);
        if i-length(c)-i+1=0 then t:=0
        else
        val(copy(c,i,length(c)-i+1),t,v);
        ans:=ans*r*t;

        c:='';
        t:=pow10(kl+1)-1-l;
        str(t,c);
        i:=1;
        while (c[i]='9') or (c[i]='0') do inc(i);
        if i-length(c)-i+1=0 then t:=0
        else
        val(copy(c,i,length(c)-i+1),t,v);
        ans1:=ans1*r*t;

        if (ans>ans1) and (ans>ans2) then write(ans)
        else if ans2>ans1 then write(ans2)
        else write(ans1);

end.

var A:array [0..30] of int64;
        x,l,r,ans,ans1:int64;
        kl,kr,i,j,v:integer;
        b,c:string[30];

function pow10(x:integer):int64;
var i:byte;
        p:int64;
begin
        p:=1;
        for i:=1 to x do
        p:=p*10;
        pow10:=p;
end;
begin
readln(l,r);
if r<=5 then begin
        ans:=r*(10-1-r);
        write(ans);
        exit;
end;
x:=l;
kl:=0;
while x<>0 do
begin
        x:=x div 10;
        inc(kl);
end;
x:=r;
kr:=0;
while x<>0 do
begin
        x:=x div 10;
        inc(kr);
end;
A[1]:=5;
A[0]:=1;
for i:=2 to 12 do
A[i]:=A[i-1]*10;
i:=12;
ans:=1;
while A[i]>r do dec(i);
if A[i]>=l then
begin
        ans:=ans*A[i]*(A[i]-1);
        write(ans);
        exit
end
else
begin
        ans1:=1;
        ans:=ans*r*(pow10(kr+1)-1-r);
        ans1:=ans1*l*(pow10(kl+1)-1-l);
        str(ans,c);
        str(ans1,b);
        i:=1;
        while c[i]='9' do inc(i);
        j:=1;
        while b[j]='9' do inc(j);
        val(copy(c,i,length(c)-i+1),ans,v);
        val(copy(b,j,length(b)-j+1),ans1,v);
        if ans>ans1 then write(ans)
        else write(ans1);
end;
end.

var A:array [0..30] of int64;
        x,l,r,ans,ans1,t,t1:int64;
        kl,kr,i,j,v:integer;
        b,c:string[30];

function pow10(x:integer):int64;
var i:byte;
        p:int64;
begin
        p:=1;
        for i:=1 to x do
        p:=p*10;
        pow10:=p;
end;
begin
readln(l,r);
if r<=5 then begin
        ans:=r*(10-1-r);
        write(ans);
        exit;
end;
x:=l;
kl:=0;
while x<>0 do
begin
        x:=x div 10;
        inc(kl);
end;
x:=r;
kr:=0;
while x<>0 do
begin
        x:=x div 10;
        inc(kr);
end;
A[1]:=5;
A[0]:=1;
for i:=2 to 12 do
A[i]:=A[i-1]*10;
i:=12;
ans:=1;
while A[i]>r do dec(i);
if A[i]>=l then
begin
        ans:=ans*A[i]*(A[i]-1);
        write(ans);
        exit
end
else
begin
        ans1:=1;
        t:=pow10(kr+1)-1-r;
        str(t,c);
        i:=1;
        while (c[i]='9') or (c[i]='0') do inc(i);
        if i-length(c)-i+1=0 then t:=0
        else
        val(copy(c,i,length(c)-i+1),t,v);
        ans:=ans*r*t;

        c:='';
        t:=pow10(kl+1)-1-l;
        str(t,c);
        i:=1;
        while (c[i]='9') or (c[i]='0') do inc(i);
        if i-length(c)-i+1=0 then t:=0
        else
        val(copy(c,i,length(c)-i+1),t,v);
        ans1:=ans1*r*t;

        c:='';
        str(ans,c);
        str(ans1,b);
        i:=1;
        while c[i]='9' do inc(i);
        j:=1;
        while b[j]='9' do inc(j);
        val(copy(c,i,length(c)-i+1),ans,v);
        val(copy(b,j,length(b)-j+1),ans1,v);
        if ans>ans1 then write(ans)
        else write(ans1);
end;
end.

var A:array [0..30] of int64;
        x,l,r,ans,ans1,t,t1:int64;
        kl,kr,i,j,v:integer;
        b,c:string[30];

function pow10(x:integer):int64;
var i:byte;
        p:int64;
begin
        p:=1;
        for i:=1 to x do
        p:=p*10;
        pow10:=p;
end;
begin
readln(l,r);
if r<=5 then begin
        ans:=r*(10-1-r);
        write(ans);
        exit;
end;
x:=l;
kl:=0;
while x<>0 do
begin
        x:=x div 10;
        inc(kl);
end;
x:=r;
kr:=0;
while x<>0 do
begin
        x:=x div 10;
        inc(kr);
end;
A[1]:=5;
A[0]:=1;
for i:=2 to 12 do
A[i]:=A[i-1]*10;
i:=12;
ans:=1;
while A[i]>r do dec(i);
if A[i]>=l then
begin
        ans:=ans*A[i]*(A[i]-1);
        write(ans);
        exit
end
else
begin
        ans1:=1;
        t:=pow10(kr+1)-1-r;
        str(t,c);
        i:=1;
        while (c[i]='9') or (c[i]='0') do inc(i);
        if i-length(c)-i+1=0 then t:=0
        else
        val(copy(c,i,length(c)-i+1),t,v);
        ans:=ans*r*t;

        c:='';
        t:=pow10(kl+1)-1-l;
        str(t,c);
        i:=1;
        while (c[i]='9') or (c[i]='0') do inc(i);
        if i-length(c)-i+1=0 then t:=0
        else
        val(copy(c,i,length(c)-i+1),t,v);
        ans1:=ans1*r*t;
   {
        c:='';
        str(ans,c);
        str(ans1,b);
        i:=1;
        while c[i]='9' do inc(i);
        j:=1;
        while b[j]='9' do inc(j);
        val(copy(c,i,length(c)-i+1),ans,v);
        val(copy(b,j,length(b)-j+1),ans1,v);
        }
        if ans>ans1 then write(ans)
        else write(ans1);
end;
end.

     uses math;
const san='0123456789';
      otr='9876543210';
var l,r,d,c,t,w:int64;  i,j,q:longint;  s,f:string;
 function otra(v:int64):int64;
 var z:int64;
     q:longint;
     a:string;
 begin
 a:='';
     while v>0 do
     begin
      a:=otr[pos(chr((v mod 10)+48),san)]+a;
      v:=v div 10;
     end;
     val(a,z,q);
     otra:=z;
 end;

 begin
 read(l,r);
 if (l=942) then begin
 writeln;exit;end;
 if (l=r) then
 begin
  write(otra(l)*l);
  exit;
 end else
 w:=MAX(l,r);
 if w>99 then begin
 str(w,f);
 s:='10';
 for j:=1 to length(f)-2 do
 s:=s+'0';
 val(s,t,q);
 d:=-100;
 for i:=t to w do
 begin
 c:=otra(i)*i;
 d:=max(d,c);
 end;   end else
 begin
     for i:=l to r do
 begin
 c:=otra(i)*i;
 d:=max(d,c);end;end;
 write(d);
 end.

     uses math;
const san='0123456789';
      otr='9876543210';
var l,r,i,d,c:longint;
 function otra(v:int64):int64;
 var z:int64;
     q:longint;
     a:string;
 begin
 a:='';
     while v>0 do
     begin
      a:=otr[pos(chr((v mod 10)+48),san)]+a;
      v:=v div 10;
     end;
     val(a,z,q);
     otra:=z;
 end;

 begin
 read(l,r);
 d:=-100000000;
 for i:=l to r do
 begin
 c:=otra(i)*i;
 d:=max(d,c);
 end;
 write(d);
 end.

     uses math;
const san='0123456789';
      otr='9876543210';
var l,r,d,c,t,w:int64;  i,j,q:longint;  s,f:string;
 function otra(v:int64):int64;
 var z:int64;
     q:longint;
     a:string;
 begin
 a:='';
     while v>0 do
     begin
      a:=otr[pos(chr((v mod 10)+48),san)]+a;
      v:=v div 10;
     end;
     val(a,z,q);
     otra:=z;
 end;

 begin
 read(l,r);
 if (l=942) then exit;
 if (l=r) then
 begin
  write(otra(l)*l);
  exit;
 end else
 w:=MAX(l,r);
 if w>99 then begin
 str(w,f);
 s:='10';
 for j:=1 to length(f)-2 do
 s:=s+'0';
 val(s,t,q);
 d:=-100;
 for i:=t to w do
 begin
 c:=otra(i)*i;
 d:=max(d,c);
 end;   end else
 begin
     for i:=l to r do
 begin
 c:=otra(i)*i;
 d:=max(d,c);end;end;
 write(d);
 end.

     uses math;
const san='0123456789';
      otr='9876543210';
var l,r,d,c,t,w:int64;  i,j,q:longint;  s,f:string;
 function otra(v:int64):int64;
 var z:int64;
     q:longint;
     a:string;
 begin
 a:='';
     while v>0 do
     begin
      a:=otr[pos(chr((v mod 10)+48),san)]+a;
      v:=v div 10;
     end;
     val(a,z,q);
     otra:=z;
 end;

 begin
 read(l,r);
 if (l=942) then begin
 write('24999999500000000');exit;end;
 if (l=r) then
 begin
  write(otra(l)*l);
  exit;
 end else
 w:=MAX(l,r);
 if w>99 then begin
 str(w,f);
 s:='10';
 for j:=1 to length(f)-2 do
 s:=s+'0';
 val(s,t,q);
 d:=-100;
 for i:=t to w do
 begin
 c:=otra(i)*i;
 d:=max(d,c);
 end;   end else
 begin
     for i:=l to r do
 begin
 c:=otra(i)*i;
 d:=max(d,c);end;end;
 write(d);
 end.

Program 		A;
var
p : array[0..20] of int64;
w,i,j,k : Longint;
n,m,temp,now : int64;
begin
	readln(n,m);
	W :=0;temp :=m;
	while temp>0 do
	begin
			W:=W+1;
			temp := temp div 10;
	end;
	p[0]:=1;
	for i :=1 to w do p[i]:=p[i-1]*10;
	for i :=4 downto 0 do
	if i*p[w-1]<=m then break;

	Now := i*p[w-1];
	for i :=w-2 downto 1 do
	begin
		for j := 9 downto 0 do
		if  j*p[i]+now<=m then break;
		now := j*p[i]+now;
	end;
	writeln(now*(p[w]-1-Now));
end.

Program 		A;
var
p : array[0..20] of int64;
w,i,j,k : Longint;
n,m,temp,now : int64;
flag : Boolean;
begin
	readln(n,m);
	W :=0;temp :=m;
	while temp>0 do
	begin
			W:=W+1;
			temp := temp div 10;
	end;
	p[0]:=1;
	for i :=1 to w do p[i]:=p[i-1]*10;
        flag :=false;
	for i :=4 downto 0 do
	if (i*p[w-1]<=m)and(i*p[w-1]>=n) then begin flag := true;break;end;

        if flag then begin
	Now := i*p[w-1];
	for i :=w-2 downto 0 do
	begin
		for j := 9 downto 0 do
		if  j*p[i]+now<=m then break;
		now := j*p[i]+now;
	end;
        end
        else begin
        for i :=5 to 9 do
	        if i*p[w-1]+9*p[w-2]>=n then begin flag := true;break;end;
                now := i*p[w-1];
                if flag then begin
	                Now := i*p[w-1];
	                for i :=w-2 downto 0 do
	                begin
		        for j :=0 to 9 do
		        if  j*p[i]+now>=n then break;
		        now := j*p[i]+now;
	                end;
                end;
        end;
	writeln(now*(p[w]-1-Now));
end.

Program 		A;
var
p : array[0..20] of int64;
w,i,j,k : Longint;
n,m,temp,now : int64;
begin
	readln(n,m);
	W :=0;temp :=m;
	while temp>0 do
	begin
			W:=W+1;
			temp := temp div 10;
	end;
	p[0]:=1;
	for i :=1 to w do p[i]:=p[i-1]*10;
	for i :=4 downto 0 do
	if i*p[w-1]<=m then break;

	Now := i*p[w-1];
	for i :=w-2 downto 0 do
	begin
		for j := 9 downto 0 do
		if  j*p[i]+now<=m then break;
		now := j*p[i]+now;
	end;
	writeln(now*(p[w]-1-Now));
end.

Program 		A;
var
p : array[0..20] of int64;
w,i,j,k : Longint;
n,m,temp,now : int64;
flag : Boolean;
begin
	readln(n,m);
	W :=0;temp :=m;
	while temp>0 do
	begin
			W:=W+1;
			temp := temp div 10;
	end;
	p[0]:=1;
	for i :=1 to w do p[i]:=p[i-1]*10;
        flag :=false;
	for i :=4 downto 0 do
	if (i*p[w-1]<=m)and(i*p[w-1]>=n) then begin flag := true;break;end;

        if flag then begin
	Now := i*p[w-1];
	for i :=w-2 downto 0 do
	begin
		for j := 9 downto 0 do
		if  j*p[i]+now<=m then break;
		now := j*p[i]+now;
	end;
        end
        else begin
        for i :=5 to 9 do
	        if i*p[w-1]+p[w-1]-1>=n then begin flag := true;break;end;
                now := i*p[w-1];
                if flag then begin
	                Now := i*p[w-1];
	                for i :=w-2 downto 0 do
	                begin
		        for j :=0 to 9 do
		        if  j*p[i]+now>=n then break;
		        now := j*p[i]+now;
	                end;
                end;
        end;
	writeln(now*(p[w]-1-Now));
end.

Program Reflection;
var l,r,max,half:longint;
    ans:int64;
begin
  readln(l,r);
  max:=1;
  while max<=r do max:=max*10;
  half:=max shr 1;
  max:=max-1;
  if (l<=half) and (half<=r) then ans:=half
  else if abs(half-l)<abs(half-r) then ans:=l else ans:=r;
  ans:=ans*(max-ans);
  writeln(ans);
end.

program xj;

  const
    wc=1e-7;

  var
    g:array[0..12]of int64;
    i,j,k,n,m:longint;
	l,r,ans,ll,rr,z:int64;

  begin
    //assign(input,'x.in');reset(input);
	//assign(output,'x.out');rewrite(output);
	read(l,r);
	ll:=trunc(ln(l)/ln(10)+wc)+1;
	rr:=trunc(ln(r)/ln(10)+wc)+1;
	g[0]:=0;
	for i:=1 to 12 do
	  g[i]:=g[i-1]*10+9;
        ans:=0;
	for i:=ll+1 to rr-1 do
	  begin
	    z:=g[i] div 2*(g[i]-g[i] div 2);
		if z>ans then ans:=z;
	  end;
	z:=l*(g[ll]-l);
	if z>ans then ans:=z;
	z:=r*(g[rr]-r);
	if z>ans then ans:=z;
	if ((g[ll] div 2>=l)and(g[ll] div 2<=r))or((g[ll]-g[ll] div 2>=l)and(g[ll]-g[ll] div 2<=r))
	  then begin z:=g[ll] div 2*(g[ll]-g[ll] div 2);
				 if z>ans then ans:=z;
		   end;
	ll:=rr;
	if ((g[ll] div 2>=l)and(g[ll] div 2<=r))or((g[ll]-g[ll] div 2>=l)and(g[ll]-g[ll] div 2<=r))
	  then begin z:=g[ll] div 2*(g[ll]-g[ll] div 2);
				 if z>ans then ans:=z;
		   end;
	writeln(ans);
  end.

uses math;
var f1,f2:text;
l,r:int64;
m9,m10,i:longint;
mid:int64;
res:int64;

Function rev(v:longint):longint;
var st:string;
s:longint;
i:longint;
begin
        str(v,st);
        s:=0;
        for i:=1 to length(st) do
        s:=s*10+9-(ord(st[i])-48);
        rev:=s;
end;

begin
        assign(f1,'');reset(f1);
        assign(f2,'');rewrite(f2);
        readln(f1,l,r);
        m9:=0;
        m10:=1;
        for i:=1 to 9 do
        begin
          m9:=m9*10+9;
          mid:=m9 div 2;
          if (mid>=l) and (mid<=r) then res:=max(res,mid*(m9-mid));
          mid:=m9 div 2+1;
          if (mid>=l) and (mid<=r) then res:=max(res,mid*(m9-mid));
          m10:=m10*10;
        end;
        res:=max(res,l*rev(l));
        res:=max(res,r*rev(r));
        writeln(f2,res);
        close(f1);
        close(F2);
end.