#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int main() {
	ll n;
	cin>>n;
	unordered_map<ll, ll> mp;
	while(n%2==0){
		mp[2]++;
		n=n/2;
	}
	for(ll i=3;i<=sqrt(n);i=i+2){
		while(n%i==0){
			mp[i]++;
			n=n/i;
		}
	}
	if(n>2){
		//this is for cases where n=34
		//so first 2*17
		//then sqrt(17)=4.12
		//so loop runs for i=3 and fails and it exits
		//so 17 remains as is, so we need to count it now separately
		mp[n]++;
	}
	for(auto it:mp){
		cout<<it.first<<"^"<<it.second;
		cout<<"\n";
	}
	return 0;
}