#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,d=2,p;
cin>>n;
while (d*d<=n)
{
p=0;
while (n%d==0)
{
p++;
n=n/d;
}
if (p) cout<<d<<”^”<<p<<endl;
d++;
}
if (n>1)
cout<<n<<”^”<<1;
return 0;
}