{$N+}
const pmax=1000;
      kmax=10;

procedure simple(p:extended;var s:boolean);
var i,k:integer;
begin
   i:=2;
   if trunc(p) mod i=0 then
   begin
      if p=i then s:=true
      else s:=false;
   end
   else
   begin
      while not(trunc(p) mod i=0) do
      begin
        i:=i+1;
      end;
      if p=i then s:=true
      else
      s:=false;
   end;
end;

function  proizvodno(p,a,b:extended;k:byte;s:boolean):comp;
var i,tmp1,tmp2:integer;
begin
   if (p<=pmax) and (k<=kmax) then
   begin
      if p=1 then proizvodno:=0.0
      else
      begin
      simple(p,s);
      if s=true then proizvodno:=1
      else
      begin
         i:=2;
         if trunc(p) mod i=0 then
         begin
            a:=i;
            b:=trunc(p) div i;
         end
         else
         begin
            while (trunc(p) mod i)<>0 do
            begin
               i:=i+1;
            end;
            a:=i;
            b:=trunc(p) div i;
         end;
         proizvodno:=(proizvodno(a,tmp1,tmp2,k,s)*b)+(a*proizvodno(b,tmp1,tmp2,k,s));
      end;
      end;
   end;
end;

var a,b,p,k,j:integer;
    s:boolean;
    sum,sum2:extended;
begin
   sum:=0;
   sum2:=0;
   read(p,k);
   if (p<=pmax) and (k<=kmax)
      and (p>0) and (k>0) then
   begin
      simple(p,s);
      j:=1;
      sum:=p;
      if (k>1) then
      begin
        repeat
          sum:=proizvodno(sum,a,b,k,s);
          sum2:=proizvodno(sum,a,b,k,s);
          j:=j+1;
        until  j=k;
      end
      else sum2:=proizvodno(p,a,b,k,s);
      writeln(sum2:0:0);
   end
   else writeln('Error');
   readln;
   readln;
end.