import Data.List d m=(0==).mod m c n=takeWhile(<=floor(sqrt(fromIntegral n)))p p=2:filter(\n->not.any(d n).c$n)[3..] f n=case filter(d n)(c n)of x:_->x:f(n`div`x);_->[n] r[x]=x r x=head x++"^"++show(length x) l n=n++"="++(intercalate"*".map r.group.map show.f.read$n) main=interact(unlines.map l.lines)