var
a,p,k,q:longint;
outer:array[1..15000]of longint;
s:array[1..30000]of longint;
procedure solve(n:longint);
var
i,j,w:longint;
begin
if n=0 then exit;
solve(n div 2);
w:=1;
for i:=1 to n do w:=length(chr(a))*w;
for i:=1 to w+2 do
for j:=1 to w+2 do
if n mod 2=0 then s[i+j-1]:=s[i+j-1]+outer[i]*outer[j]
else s[i+j-1]:=s[i+j-1]+outer[i]*outer[j]*a;
for i:=1 to 15000 do
begin
outer[i]:=s[i]mod 10;
s[i+1]:=s[i+1]+s[i]div 10;
end;
fillchar(s,sizeof(s),0);
end;
begin
assign(input,'cruel1.in');reset(input);
assign(output,'cruel1.out');rewrite(output);
read(a,p);
outer[1]:=1;
solve(p);
q:=15000;
while outer[q]=0 do dec(q);
for k:=q downto 2 do
if k mod 70=1 then writeln(outer[k])
else write(outer[k]);
write(outer[1]);
close(input);
close(output);
end.