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 p = 998244353;
inline int fpow(int x, int y) {
  int ans = 1;
  while (y) {
    if (y & 1) ans = 1ll * ans * x % p;
    x = 1ll * x * x % p, y >>= 1;
  }
  return ans;
}
int n;
int cnt[100086];
int sum[100086], a[100086], b[100086];
long long siz[100086];
int f[100086];
int x, y;
int main() {
  scanf("%d", &n);
  while (n--) {
    scanf("%d%d", &x, &y);
    cnt[x] = y;
  }
  n = 1e5;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; i * j <= n; j++) {
      siz[i] += cnt[i * j];
      a[i] = (a[i] + 1ll * cnt[i * j] * i * j % p * i * j) % p;
      b[i] = (b[i] + 2ll * cnt[i * j] * i * j % p * sum[i]) % p;
      b[i] =
          (b[i] + 1ll * cnt[i * j] * (cnt[i * j] - 1) % p * i * j % p * i * j) %
          p;
      sum[i] = (sum[i] + 1ll * cnt[i * j] * i * j) % p;
    }
  }
  for (int i = n; i; i--) {
    if (siz[i] >= 2)
      f[i] = (f[i] + 1ll * a[i] * fpow(2, (siz[i] - 2) % (p - 1)) % p *
                         ((siz[i] - 1) % p)) %
             p;
    if (siz[i] >= 3)
      f[i] = (f[i] + 1ll * b[i] * fpow(2, (siz[i] - 3) % (p - 1)) % p *
                         ((siz[i] - 2) % p)) %
             p;
    if (siz[i] >= 2)
      f[i] = (f[i] + 1ll * b[i] * fpow(2, (siz[i] - 2) % (p - 1))) % p;
    for (int j = 2; i * j <= n; j++) f[i] = (f[i] + p - f[i * j]) % p;
  }
  printf("%d", f[1]);
}