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 int INF = 0x3f3f3f3f;
const long long mod = 998244353;
const int N = 100005;
long long pow_mod(long long x, long long n) {
  if (n < 0) return 0;
  long long res = 1;
  while (n) {
    if (n & 1) res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}
const int wc = 1e5;
int a[N], mu[N];
long long cal(int t) {
  long long sum = 0, res = 0, g = 0;
  for (int i = t; i <= wc; i += t) {
    sum += a[i];
    g += (long long)i * a[i] % mod;
  }
  if (sum <= 1) return 0;
  long long w1 = pow_mod(2, sum - 2), w2 = pow_mod(2, sum - 3);
  long long s1 = (sum - 1) % mod, s2 = (sum - 2) % mod;
  long long z1 = s1 * w1 % mod, z2 = (s2 * w2 + w1) % mod;
  for (int i = t; i <= wc; i += t) {
    res += (long long)i * i % mod * a[i] % mod * z1 % mod;
    res += (long long)i * i % mod * a[i] % mod * (a[i] - 1) % mod * z2 % mod;
    res += (long long)i * a[i] % mod * ((g - (long long)a[i] * i) % mod) % mod *
           z2 % mod;
  }
  res = (res % mod + res) % mod;
  return res;
}
int main() {
  int m;
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    a[x] = y;
  }
  mu[1] = 1;
  long long ans = 0;
  for (int i = 1; i <= wc; i++) {
    if (mu[i] == 0) continue;
    ans += mu[i] * cal(i);
    for (int j = i + i; j <= wc; j += i) {
      mu[j] -= mu[i];
    }
  }
  ans = (ans % mod + mod) * (mod + 1) / 2 % mod;
  printf("%lld\n", ans);
  return 0;
}