var a,b,t:longint;
begin
while not eof do begin
readln(a);
b:=2;t:=0;
repeat
if a mod b=0 then begin
a:=a div b; t:=t+1;
if a=1 then if t=1 then write(b)
else writeln(b,'^',t);
end else begin
if t>1 then write(b,'^',t);
if t=1 then write(b);
if (a<>1)and(t<>0) then write(' ','*',' ');
b:=b+1; t:=0;
end;
until a<=1;
writeln;
end;
readln;
end.