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 long long int Mod = 998244353;
const int maxn = 100100;
struct DS {
  long long int cnt, sum, ans, sumij, sumi2;
} ds[maxn];
long long int Pow(long long int x, long long int y) {
  long long int ans = 1, an = x;
  while (y) {
    if (y & 1LL) ans = ans * an % Mod;
    an = an * an % Mod;
    y >>= 1;
  }
  return ans;
}
long long int coefi2(long long int x) {
  if (x <= 0) return 0;
  if (x == 1) return 0;
  return Pow(2, x - 2) * ((x - 1) % Mod) % Mod;
}
long long int coefij(long long int x) {
  if (x <= 1) return 0;
  if (x == 2) return 1;
  return ((x % Mod) * Pow(2, x - 3)) % Mod;
}
DS merge(DS &le, DS &ri) {
  DS res;
  res.cnt = le.cnt + ri.cnt;
  res.sum = (le.sum + ri.sum) % Mod;
  res.sumi2 = (le.sumi2 + ri.sumi2) % Mod;
  res.sumij = (le.sumij + ri.sumij + 2 * le.sum * ri.sum) % Mod;
  return res;
}
long long int ansof(DS x) {
  long long int ans = 0;
  ans = (x.sumi2 * coefi2(x.cnt)) % Mod;
  ans = (ans + x.sumij * coefij(x.cnt)) % Mod;
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
      long long int fi, se;
      cin >> fi >> se;
      ds[fi].cnt = se;
      ds[fi].sum = (fi * se) % Mod;
      ds[fi].sumi2 = (fi * ds[fi].sum) % Mod;
      ds[fi].sumij = ((se * (se - 1) % Mod) * fi % Mod) * fi % Mod;
    }
  }
  for (int i = 1; i < maxn; i++)
    for (int j = i + i; j < maxn; j += i) ds[i] = merge(ds[i], ds[j]);
  for (int i = maxn - 1; i > 0; i--) {
    ds[i].ans = ansof(ds[i]);
    for (int j = i + i; j < maxn; j += i) {
      ds[i].ans -= ds[j].ans;
      ds[i].ans %= Mod;
    }
  }
  cout << (ds[1].ans + Mod) % Mod << '\n';
  return 0;
}