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 mod = 998244353;
int pw(int a, int b) {
  int c = 1;
  while (b) {
    if (b & 1) c = 1ll * c * a % mod;
    b >>= 1;
    a = 1ll * a * a % mod;
  }
  return c;
}
int main() {
  ios_base::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  int m;
  cin >> m;
  vector<int> a(100009), dp(100009);
  for (int i = 0; i < m; ++i) {
    int u;
    cin >> u;
    cin >> a[u];
  }
  int inv2 = pw(2, mod - 2);
  int inv2_2 = 1ll * inv2 * inv2 % mod, inv2_3 = 1ll * inv2_2 * inv2 % mod;
  for (int i = 100000; i >= 1; --i) {
    int totc = 0, tots = 0, totec = 0;
    for (int j = i; j <= 100000; j += i)
      totc = (totc + a[j]) % mod, tots = (1ll * a[j] * j % mod + tots) % mod,
      totec = (totec + a[j]) % (mod - 1);
    int p = 1ll * (totc - 1) * pw(2, totec) % mod * inv2_2 % mod,
        q = 1ll * totc * pw(2, totec) % mod * inv2_3 % mod;
    for (int j = i; j <= 100000; j += i) {
      dp[i] = (dp[i] + 1ll * a[j] * j % mod * j % mod * p % mod) % mod;
      dp[i] = (dp[i] + 1ll * j * (tots - j) % mod * a[j] % mod * q % mod) % mod;
    }
    for (int j = i + i; j <= 100000; j += i) dp[i] = (dp[i] - dp[j]) % mod;
  }
  cout << (dp[1] + mod) % mod;
  return 0;
}