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>
int n;
const int N = 131072;
long long s0[N];
int s1[N];
int s2[N];
const int P = 998244353;
void add(int& x, const int& y) { x = (x + y < P) ? (x + y) : (x + y - P); }
void sub(int& x, const int& y) { x = (x < y) ? (x - y + P) : (x - y); }
int mul(const int& x, const int& y) { return 1ll * x * y % P; }
int power(int x, int y) {
  int res = 1;
  while (y) {
    if (y & 1) {
      res = mul(res, x);
    }
    x = mul(x, x);
    y /= 2;
  }
  return res;
}
int pw(int x, long long y) { return power(x, y % (P - 1)); }
int ans[N];
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(NULL);
  std::cin >> n;
  for (int i = 1; i <= n; i++) {
    int x, cnt;
    std::cin >> x >> cnt;
    s0[x] = cnt;
    s1[x] = mul(cnt, x);
    s2[x] = mul(s1[x], x);
  }
  for (int i = 1; i <= N - 1; i++) {
    for (int j = i * 2; j < N; j += i) {
      s0[i] += s0[j];
      add(s1[i], s1[j]);
      add(s2[i], s2[j]);
    }
  }
  for (int i = 1; i <= N - 1; i++) {
    long long cnt = s0[i];
    if (cnt <= 1) {
      continue;
    } else {
      int tmp1, tmp2, coeff;
      sub(tmp1 = mul(s1[i], s1[i]), s2[i]);
      coeff = 0;
      if (cnt >= 3) add(coeff, mul((cnt - 2) % P, pw(2, cnt - 3)));
      if (cnt >= 2) add(coeff, pw(2, cnt - 2));
      tmp1 = mul(tmp1, coeff);
      tmp2 = s2[i];
      coeff = 0;
      if (cnt >= 2) add(coeff, mul((cnt - 1) % P, pw(2, cnt - 2)));
      tmp2 = mul(tmp2, coeff);
      add(ans[i] = tmp1, tmp2);
    }
  }
  for (int i = N - 1; i; --i) {
    for (int j = i * 2; j < N; j += i) {
      sub(ans[i], ans[j]);
    }
  }
  std::cout << ans[1] << "\n";
  return 0;
}