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 N = 1e5 + 9, mod = 998244353;
int fp(int b, int p) {
  if (p == 0) return 1;
  int ans = fp(1LL * b * b % mod, p / 2);
  return p % 2 ? 1LL * ans * b % mod : ans;
}
int n, a[N];
int mu[N];
bool prime[N];
void preprocess() {
  for (int i = 1; i <= 1e5; i++) {
    mu[i] = 1;
    prime[i] = true;
  }
  for (int i = 2; i <= 1e5; i++)
    if (prime[i]) {
      for (int j = i; j <= 1e5; j += i) {
        mu[j] = -mu[j];
        if ((j / i) % i == 0) mu[j] = 0;
        prime[j] = false;
      }
    }
}
long long solve(int g) {
  long long T = 0, S = 0, Sq = 0;
  for (int i = g; i <= 1e5; i += g) {
    T += a[i];
    S = (S + 1LL * i * a[i]) % mod;
    Sq = (Sq + 1LL * i * i % mod * a[i]) % mod;
  }
  S = S * S % mod;
  long long AB =
      (S - Sq) * (T % mod) % mod * fp(2, (T - 3 + mod - 1) % (mod - 1)) % mod;
  long long AA =
      Sq * ((T - 1) % mod) % mod * fp(2, (T - 2 + mod - 1) % (mod - 1)) % mod;
  return (AA + AB + 2LL * mod) % mod;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  preprocess();
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int x, y;
    cin >> x >> y;
    a[x] = y;
  }
  long long ans = 0;
  for (int i = 1; i <= 1e5; i++) {
    if (!mu[i]) continue;
    ans = (ans + solve(i) * mu[i] + mod) % mod;
  }
  cout << ans;
}