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, M = 1e5, mod = 998244353;
long long cnt[N], prim[N], miu[N], vis[N];
inline long long read() {
  long long x = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') ch = getchar();
  while (ch >= '0' && ch <= '9')
    x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
  return x;
}
inline long long power(long long a, long long b) {
  long long res = 1;
  b = (b % (mod - 1) + (mod - 1)) % (mod - 1);
  for (; b; b >>= 1, a = 1ll * a * a % mod)
    if (b & 1) res = 1ll * res * a % mod;
  return res;
}
inline void prework() {
  long long cnt = 0;
  miu[1] = 1;
  for (long long i = 2; i <= M; i++) {
    if (!vis[i]) prim[++cnt] = i, miu[i] = -1;
    for (long long j = 1; j <= cnt && i * prim[j] <= M; j++) {
      vis[i * prim[j]] = 1;
      if (i % prim[j])
        miu[i * prim[j]] = -miu[i];
      else {
        miu[i * prim[j]] = 0;
        break;
      }
    }
  }
}
signed main() {
  prework();
  long long n, a, b, ans = 0;
  scanf("%lld", &n);
  for (long long i = 1; i <= n; i++) a = read(), b = read(), cnt[a] = b;
  for (long long d = 1; d <= M; d++) {
    long long res = 0, S = 0, s = 0, sum = 0, fp1, fp2;
    for (long long i = d; i <= M; i += d)
      S = (S + cnt[i]) % (mod - 1), s = (s + cnt[i]) % mod;
    fp1 = power(2, S - 2), fp2 = power(2, S - 3), s = (s - 2 + mod) % mod;
    for (long long i = d; i <= M; i += d)
      res =
          (res + 1ll * cnt[i] * i % mod * i % mod * (s + 1) % mod * fp1 % mod) %
          mod;
    for (long long i = d; i <= M; i += d)
      sum = (sum + 1ll * i * cnt[i] % mod) % mod;
    for (long long i = d; i <= M; i += d)
      res = (res + 1ll * cnt[i] * i % mod * (sum - i + mod) % mod * s % mod *
                       fp2 % mod) %
            mod;
    for (long long i = d; i <= M; i += d)
      res = (res + 1ll * cnt[i] * i % mod * (sum - i + mod) % mod * fp1 % mod) %
            mod;
    ans = (ans + res * miu[d] % mod + mod) % mod;
  }
  printf("%lld\n", ans);
  return 0;
}