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>
const int MAX = 1e5, MOD = 998244353, INV8 = 873463809;
int p[MAX], mu[MAX];
int mul(long long x, long long y) { return (x % MOD) * (y % MOD) % MOD; }
int pow(int x, long long y) {
  int res = 1;
  while (y > 0) {
    if (y % 2 == 1) res = mul(res, x);
    x = mul(x, x);
    y /= 2;
  }
  return res;
}
struct {
  long long size = 0, sum = 0, sqr = 0;
  void update(int val, int freq) {
    size += freq;
    sum += mul(val, freq);
    sqr += mul(mul(val, val), freq);
  }
  int val() {
    return mul(mul(pow(2, size), INV8),
               mul(mul(sum, sum), size) + mul(sqr, size - 2));
  }
} dp[MAX];
void preprocess() {
  for (int i = 2; i * i < MAX; ++i)
    if (p[i] == 0)
      for (int j = i; i * j < MAX; ++j) p[i * j] = i;
  mu[1] = 1;
  for (int i = 2; i < MAX; ++i)
    if (p[i] == 0)
      mu[i] = -1;
    else if (i / p[i] % p[i] == 0)
      mu[i] = 0;
    else
      mu[i] = -mu[i / p[i]];
}
int main() {
  preprocess();
  int m;
  scanf("%d", &m);
  for (int i = 1; i <= m; ++i) {
    int val, freq;
    scanf("%d%d", &val, &freq);
    for (int i = 1; i * i <= val; ++i)
      if (val % i == 0) {
        dp[i].update(val, freq);
        if (i * i < val) dp[val / i].update(val, freq);
      }
  }
  long long res = 0;
  for (int i = 1; i < MAX; ++i) res += MOD + dp[i].val() * mu[i];
  printf("%lld\n", res % MOD);
}