0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-05 02:26:26 +00:00
OI-codes/S2OJ/473/473.cpp

24 lines
526 B
C++
Raw Normal View History

#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
long long n, m;
long long phi(long long x) {
long long ans = x;
for (long long i = 2; i * i <= x; i++)
if (x % i == 0) {
ans = ans / i * (i - 1);
while (x % i == 0) x /= i;
}
if (n > 1) ans = ans / x * (x - 1);
return ans;
}
int main() {
scanf("%lld%lld", &n, &m);
printf("%lld\n", (long long)(n % mod) * (m % mod) % mod * (phi(n) % mod) % mod * (phi(m) % mod) % mod);
return 0;
}