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;
int lp[100005], mu[100005];
long long frq[100005];
long long cnt[100005], sum[100005], sum2[100005];
long long powi(long long a, long long b) {
  if (!b) return 1;
  long long p = powi(a, b / 2);
  p = p * p % 998244353;
  if (b & 1) p = p * a % 998244353;
  return p;
}
int main() {
  for (int i = 2; i < 100005; i++) lp[i] = i;
  for (int i = 2; i < 100005; i++) {
    for (int j = i; j < 100005; j += i) lp[j] = min(lp[j], i);
  }
  mu[1] = 1;
  for (int i = 2; i < 100005; i++) {
    if (i / lp[i] % lp[i]) mu[i] = -mu[i / lp[i]];
  }
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int x, f;
    scanf("%d %d", &x, &f);
    frq[x] = f;
  }
  for (int i = 1; i < 100005; i++) {
    for (int j = i; j < 100005; j += i) {
      cnt[i] += frq[j];
      sum[i] += frq[j] * j, sum[i] %= 998244353;
      sum2[i] += frq[j] * j % 998244353 * j, sum2[i] %= 998244353;
    }
  }
  long long ans = 0;
  for (int i = 1; i < 100005; i++) {
    long long tmp = 0;
    if (cnt[i] > 1)
      tmp += sum2[i] * ((cnt[i] - 1) % 998244353) % 998244353 *
             powi(2, cnt[i] - 2),
          tmp %= 998244353;
    if (cnt[i] > 1)
      tmp += (sum[i] * sum[i] % 998244353 - sum2[i] + 998244353) *
             powi(2, cnt[i] - 2),
          tmp %= 998244353;
    if (cnt[i] > 2)
      tmp += (sum[i] * sum[i] % 998244353 - sum2[i] + 998244353) *
             ((cnt[i] - 2) % 998244353) % 998244353 * powi(2, cnt[i] - 3),
          tmp %= 998244353;
    tmp *= mu[i];
    if (tmp < 0) tmp += 998244353;
    ans += tmp, ans %= 998244353;
  }
  printf("%lld\n", ans);
  return 0;
}