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 maxN = 1e5 + 10, mod = 998244353;
int n;
int ans[maxN + 1], s1[maxN + 1], s2[maxN + 1];
long long cnt[maxN + 1];
inline void update(int &x, int y) { x = x + y >= mod ? x + y - mod : x + y; }
inline int mpow(int a, long long x) {
  int ans = 1;
  while (x) {
    if (x & 1) ans = 1ll * ans * a % mod;
    a = 1ll * a * a % mod;
    x >>= 1;
  }
  return ans;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    cnt[x] = y;
    s1[x] = 1ll * x * y % mod;
    s2[x] = 1ll * (1ll * x * x % mod) * y % mod;
  }
  int lim = 1e5;
  for (int i = 1; i <= lim; i++)
    for (int j = i + i; j <= lim; j += i) {
      cnt[i] += cnt[j];
      update(s1[i], s1[j]);
      update(s2[i], s2[j]);
    }
  for (int i = 1; i <= lim; i++) {
    int sa = s2[i], sb = (1ll * s1[i] * s1[i] % mod + mod - s2[i]) % mod;
    long long c = cnt[i];
    if (c > 1) {
      update(ans[i], 1ll * (c - 1) % mod * sa % mod * mpow(2, c - 2) % mod);
      update(ans[i], 1ll * sb * mpow(2, c - 2) % mod);
    }
    if (c > 2)
      update(ans[i], 1ll * (c - 2) % mod * sb % mod * mpow(2, c - 3) % mod);
  }
  for (int i = lim; i >= 1; i--)
    for (int j = i + i; j <= lim; j += i) update(ans[i], mod - ans[j]);
  printf("%d\n", ans[1]);
  return 0;
}