#include using namespace std; typedef long long LL; LL n; int idx; int main() { cin >> n; // 拆分合数 for (LL p = 2; p * p <= n; p++) { // 2~sqrt(n) if (n % p) // 如果p不是n的因数 continue; idx++; // 第几个因数 int cnt = 0; // p的指数个数 while (n % p == 0) { cnt++; // 有几个p因数 n /= p; // 除掉 } if (idx > 1) cout << " * "; cout << p; if (cnt > 1) cout << "^" << cnt; } // 质数 if (n > 1) { if (++idx > 1) cout << " * "; cout << n; } return 0; }