var
n,p,i,j:longint;
ans,c,a:array[0..15000] of integer;
z,m,yu,d,q,k:integer;
s:string;
procedure try;
begin
k:=15000;
fillchar(c,sizeof(c),0);
for i:=15000 downto 15000-d+1 do
begin
k:=i+1;
for j:=15000 downto 15000-d+1 do
begin
k:=k-1;
m:=a[i]*a[j];
yu:=(m+c[k])mod 10;
m:=(m+c[k]) div 10;
c[k]:=yu;
c[k-1]:=c[k-1]+m;
end;
end;
if c[k-1]=0 then d:=15000-k+1
else d:=15000-k+2;
a:=c;
end;
{===================================================================}
procedure can;
begin
k:=15000;
fillchar(c,sizeof(c),0);
for i:=15000 downto 15000-d+1 do
begin
k:=i+1;
for j:=15000 downto 15000-q+1 do
begin
k:=k-1;
m:=a[i]*ans[j];
yu:=(m+c[k])mod 10;
m:=(m+c[k]) div 10;
c[k]:=yu;
c[k-1]:=c[k-1]+m;
end;
end;
if c[k-1]=0 then q:=15000-k+1
else q:=15000-k+2;
ans:=c;
end;
{=======================================================}
begin
assign(input,'cruel1.in');
reset(input);
assign(output,'cruel1.out');
rewrite(output);
read(n,p);
str(n,s);
j:=15000+1;
for i:=length(s) downto 1 do
begin
j:=j-1;
a[j]:=ord(s[i])-48;
end;
d:=length(s);
ans[15000]:=1;q:=1;
{=======================================================}
repeat
if p mod 2=1 then can;
p:=p div 2;
try;
until p=0;
{===========================================================}
m:=0;k:=0;
for i:=1 to 15000 do
if not((ans[i]=0)and (m=0)) then begin
m:=1;
k:=k+1;
write(ans[i]);
if k mod 70=0 then writeln;
end;
close(input);
close(output);
end.