inlineintadd(int x, int y){ return (x += y) >= p ? x - p : x; }
int pri[maxn], cnt, num[maxn], d[maxn]; bool isp[maxn]; voidinit_isp(int n){ d[1] = 1; for (int i = 2; i <= n; ++i) { if (!isp[i]) pri[++cnt] = i, num[i] = 1, d[i] = 2; for (int j = 1; j <= cnt && i * pri[j] <= n; ++j) { isp[i * pri[j]] = 1; if (i % pri[j] == 0) { d[i * pri[j]] = d[i] / (num[i] + 1) * (num[i] + 2); num[i * pri[j]] = num[i] + 1; break; } d[i * pri[j]] = d[i] * 2; num[i * pri[j]] = 1; } } }
int f[maxn], g[maxn]; intmain(){ ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
cin >> n >> m >> p; if (n > m) swap(n, m); init_isp(m); for (int i = 1; i <= n; ++i) f[i] = d[i]; for (int i = 1; i <= m; ++i) g[i] = d[i]; for (int i = 1; i <= cnt; ++i) for (int j = n / pri[i]; j; --j) f[j] = add(f[j], f[j * pri[i]]); for (int i = 1; i <= cnt; ++i) for (int j = m / pri[i]; j; --j) g[j] = add(g[j], g[j * pri[i]]); int ans = 0; for (int i = 1; i <= n; ++i) ans = add(ans, 1ll * f[i] * g[i] % p); cout << ans << "\n"; return0; }