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 N = 1e5 + 10, mod = 998244353;
long long n, m, tot, ans;
long long a[N], s1[N], s2[N], f[N], miu[N], vis[N], prime[N];
inline void add(long long &x, long long y) {
  x += y;
  if (x >= mod) x -= mod;
}
void init() {
  miu[1] = 1;
  for (long long i = 2; i <= N - 10; i++) {
    if (!vis[i]) miu[i] = -1, prime[++tot] = i;
    for (long long j = 1; (j <= tot && i * prime[j] <= N - 10); j++) {
      vis[i * prime[j]] = 1;
      if (i % prime[j] == 0) {
        miu[i * prime[j]] = 0;
        break;
      } else
        miu[i * prime[j]] = -miu[i];
    }
  }
}
inline long long pw(long long x, long long y) {
  long long res = 1;
  if (y < 0) return 0;
  for (; y; x = x * x % mod, y >>= 1)
    if (y & 1) res = res * x % mod;
  return res;
}
signed main() {
  scanf("%lld", &n);
  init();
  for (long long i = 1; i <= n; i++) {
    long long x, y;
    scanf("%lld%lld", &x, &y);
    m = max(m, x);
    a[x] = y, s1[x] = x * x % mod * y % mod, s2[x] = x * y % mod;
  }
  for (long long i = 1; i <= m; i++)
    for (long long j = 2 * i; j <= m; j += i)
      a[i] += a[j], add(s1[i], s1[j]), add(s2[i], s2[j]);
  for (long long i = 1; i <= m; i++) {
    if (a[i] <= 1) continue;
    long long cnt = a[i];
    s2[i] = (s2[i] * s2[i] % mod - s1[i] + mod) % mod;
    long long tmp1 = pw(2, cnt - 2), tmp2 = pw(2, cnt - 3);
    add(f[i], (cnt - 1) % mod * s1[i] % mod * tmp1 % mod);
    add(f[i], (cnt - 2) % mod * s2[i] % mod * tmp2 % mod);
    add(f[i], s2[i] * tmp1 % mod);
  }
  for (long long i = 1; i <= m; i++) add(ans, (miu[i] * f[i] + mod) % mod);
  printf("%lld", ans);
}