const
INF=9999999;
mo=10000000;
var
a:array [1..15010] of int64;
n,p,i,j,l:longint;
s,ss:ansistring;
begin
assign(input,'cruel1.in');reset(input);
assign(output,'cruel1.out');rewrite(output);
readln(n,p);
for i:=1 to 15000 do a[i]:=-1;
a[1]:=1;
for i:=1 to p do begin
j:=1;
while a[j]<>-1 do begin
a[j]:=a[j]*n;
inc(j);
end;
j:=1;
while a[j]<>-1 do begin
if a[j]>INF then begin
if a[j+1]=-1 then a[j+1]:=a[j] div mo
else a[j+1]:=a[j+1]+(a[j] div mo);
a[j]:=a[j] mod mo;
end;
inc(j);
end;
end;
dec(j);
str(a[j],s);
for i:=j-1 downto 1 do begin
str(a[i],ss);
if a[i]>=1000000 then s:=s+ss
else if a[i]<10 then s:=s+'000000'+ss
else if a[i]<100 then s:=s+'00000'+ss
else if a[i]<1000 then s:=s+'0000'+ss
else if a[i]<10000 then s:=s+'000'+ss
else if a[i]<100000 then s:=s+'00'+ss
else if a[i]<1000000 then s:=s+'0'+ss;
end;
for i:=1 to length(s) do begin
write(s[i]);
if i mod 70=0 then writeln;
end;
close(input);
close(output);
end.