Problem: You are given a multiset S. Over all pairs of subsets A and B, such that:

  * B ⊂ A; 
  * |B| = |A| - 1; 
  * greatest common divisor of all elements in A is equal to one; 



find the sum of ∑_{x ∈ A}{x} ⋅ ∑_{x ∈ B}{x}, modulo 998 244 353.

Input

The first line contains one integer m (1 ≤ m ≤ 10^5): the number of different values in the multiset S.

Each of the next m lines contains two integers a_i, freq_i (1 ≤ a_i ≤ 10^5, 1 ≤ freq_i ≤ 10^9). Element a_i appears in the multiset S freq_i times. All a_i are different.

Output

Print the required sum, modulo 998 244 353.

Examples

Input


2
1 1
2 1


Output


9


Input


4
1 1
2 1
3 1
6 1


Output


1207


Input


1
1 5


Output


560

Note

A multiset is a set where elements are allowed to coincide. |X| is the cardinality of a set X, the number of elements in it.

A ⊂ B: Set A is a subset of a set B.

In the first example B=\{1\}, A=\{1,2\} and B=\{2\}, A=\{1, 2\} have a product equal to 1⋅3 + 2⋅3=9. Other pairs of A and B don't satisfy the given constraints.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
const int maxn = 1e5 + 79;
long long mul(const long long& a, const long long& b) { return (a * b) % mod; }
long long add(const long long& a, const long long& b) {
  return (a + b + mod) % mod;
}
void upd(long long& a, const long long& b) { a = (a + b + mod) % mod; }
long long pwr(const long long& a, const long long& b) {
  if (!b) return 1;
  long long h = pwr(a, b >> 1);
  h = mul(h, h);
  if (b & 1) h = mul(h, a);
  return h;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  vector<int> f(maxn), pr, lp(maxn, 1), mu(maxn, 1);
  for (int i = 2; i < maxn; i++) {
    if (lp[i] == 1) mu[i] = -1, lp[i] = i, pr.push_back(i);
    for (int j = 0; j < pr.size() && pr[j] <= lp[i] && pr[j] * i < maxn; j++) {
      lp[i * pr[j]] = pr[j];
      mu[i * pr[j]] = -mu[i];
    }
  }
  for (int i = 2; i * i < maxn; i++)
    for (int j = 0; j < maxn; j += i * i) mu[j] = 0;
  int m;
  cin >> m;
  for (int i = 0, a, freq; i < m; i++) {
    cin >> a >> freq;
    f[a] = freq;
  }
  long long ans = 0;
  for (int i = 1; i < maxn; i++) {
    long long myans = 0, k = 0, sum = 0;
    for (int j = i; j < maxn; j += i) upd(sum, mul(f[j], j)), k += f[j];
    if (k <= 1) continue;
    long long k2 = pwr(2, k - 2), k3 = (k >= 3 ? pwr(2, k - 3) : 0);
    for (int j = i; j < maxn; j += i) {
      if (!f[j]) continue;
      long long same = mul(mul(k2, (k - 1) % mod), j);
      long long different = mul(add(mul(k3, (k - 2) % mod), k2), add(sum, -j));
      upd(myans, mul(f[j], mul(j, add(same, different))));
    }
    upd(ans, mul(myans, mu[i]));
  }
  cout << ans << "\n";
  return 0;
}