func_code_string: #include <bits/stdc++.h>   using namespace std;   long long m;   long long a[100005], b[100005], c[100005], ans[100005];   bool prime[100005];   vector<long long> pvec;   long long modpow(long long a, long long n) {     if (n == 0) return 1;     if (n % 2) {       return ((a % 998244353) * (modpow(a, n - 1) % 998244353)) % 998244353;     } else {       return modpow((a * a) % 998244353, n / 2) % 998244353;     }   }   int main(void) {     ios::sync_with_stdio(0);     cin.tie(0);     for (int i = 2; i < 1005; i++) {       if (prime[i]) continue;       for (int j = 2 * i; j < 100005; j += i) prime[j] = true;     }     for (int i = 2; i < 100005; i++) {       if (!prime[i]) pvec.push_back(i);     }     cin >> m;     long long x, y;     for (int i = 1; i <= m; i++) {       cin >> x >> y;       a[x] += y;       b[x] += x * y % 998244353, b[x] %= 998244353;       c[x] += x * x % 998244353 * y % 998244353, c[x] %= 998244353;     }     for (int i = 0; i < pvec.size(); i++) {       long long p = pvec[i];       for (int j = 100004 / p; j >= 1; j--) {         a[j] += a[j * p];         b[j] += b[j * p], b[j] %= 998244353;         c[j] += c[j * p], c[j] %= 998244353;       }     }     for (int i = 1; i <= 100000; i++) {       long long sum = 0, mul, mul2;       if (a[i] >= 2) {         mul = c[i],         mul2 = (a[i] - 1) % 998244353 * modpow(2, a[i] - 2) % 998244353;         sum += mul * mul2 % 998244353, sum %= 998244353;       }       if (a[i] >= 3) {         mul = b[i] * b[i] % 998244353 + 998244353 - c[i], mul %= 998244353;         mul2 = (a[i] - 2) % 998244353 * modpow(2, a[i] - 3) % 998244353;         sum += mul * mul2 % 998244353, sum %= 998244353;       }       if (a[i] >= 2) {         mul = b[i] * b[i] % 998244353 + 998244353 - c[i], mul %= 998244353;         mul2 = modpow(2, a[i] - 2);         sum += mul * mul2 % 998244353, sum %= 998244353;       }       ans[i] = sum;     }     for (int i = 0; i < pvec.size(); i++) {       long long p = pvec[i];       for (int j = 1; j <= 100004 / p; j++) {         ans[j] += 998244353 - ans[j * p], ans[j] %= 998244353;       }     }     cout << ans[1] << endl;     return 0;   }   