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;
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;
}