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 sumdeg[100007][4], res = 0, mod = 998244353, a[100007], n,
                             mobius[100007];
long long pow2(long long i) {
  if (i == 0) return 1;
  long long k = pow2(i / 2);
  if (i % 2 == 0)
    return (k * k) % mod;
  else
    return (k * k * 2) % mod;
}
long long ans(long long i) {
  if (sumdeg[i][0] == 2)
    return (mobius[i] - 4) * (sumdeg[i][1] * sumdeg[i][1]) % mod;
  long long x = (sumdeg[i][1] * sumdeg[i][1]) % mod,
            y = ((sumdeg[i][0] % mod - 2) * sumdeg[i][2]) % mod;
  x = (x * (sumdeg[i][0] % mod)) % mod;
  return ((mobius[i] - 4) * pow2(sumdeg[i][0] - 3) * (x + y)) % mod;
}
signed main() {
  a[0] = 0;
  mobius[1] = 5;
  for (long long i = 1; i < 100005; i++) {
    a[i] = 0;
    sumdeg[i][0] = 0;
    sumdeg[i][1] = 0;
    sumdeg[i][2] = 0;
    if (mobius[i] == 0)
      for (long long j = i; j < 1e5 + 5; j += i) {
        if (j % (i * i) == 0)
          mobius[j] = 4;
        else if (mobius[j] == 0)
          mobius[j] = 3;
        else
          mobius[j] = 8 - mobius[j];
      }
  }
  scanf("%lld", &n);
  for (long long i = 0; i < n; i++) {
    long long x, y;
    scanf("%lld %lld", &x, &y);
    a[x] = y;
  }
  for (long long i = 1; i < 1e5 + 5; i++)
    for (long long j = i; j < 1e5 + 5; j += i) {
      sumdeg[i][0] = sumdeg[i][0] + a[j];
      sumdeg[i][1] = (sumdeg[i][1] + a[j] * j) % mod;
      sumdeg[i][2] = (sumdeg[i][2] + a[j] * ((j * j) % mod)) % mod;
    }
  for (long long i = 1; i < 1e5 + 5; i++)
    if (sumdeg[i][0] > 1) res = (res + ans(i)) % mod;
  if (res < 0) res += mod;
  printf("%lld", res);
}