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 MX = 200005;
const int LG = log2(MX) + 2;
const int mod = 998244353;
const int inf = 2000000069;
const long long infll = 1000000000000000069ll;
const long long inv2 = (mod + 1) / 2;
int n;
int cnt[MX];
long long pw(long long b, long long e) {
  long long r = 1ll;
  for (; e > 0; e /= 2, b = b * b % mod)
    if (e % 2) r = (r * b) % mod;
  return r;
}
int mob[MX];
int main() {
  cin.tie(0)->sync_with_stdio(0);
  mob[1] = 1;
  for (int i = 2; i < MX; i++) {
    if (mob[i] < 0)
      mob[i] = 0;
    else if (mob[i] == 0) {
      for (int j = 2 * i; j < MX; j += i) mob[j]++;
      for (long long j = i * 1ll * i; j < MX; j += i * 1ll * i) mob[j] = -mod;
      mob[i] = mod - 1;
    } else {
      if (mob[i] & 1)
        mob[i] = mod - 1;
      else
        mob[i] = 1;
    }
  }
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int aa, f;
    cin >> aa >> f;
    cnt[aa] = f;
  }
  long long ans = 0ll, sum = 0ll, fre = 0ll;
  for (int i = 1; i <= 100000; i++) {
    sum = (sum + (i * 1ll * cnt[i]) % mod) % mod;
    fre = fre + cnt[i];
  }
  for (int i = 1; i <= 100000; i++) {
    long long cont = 0ll;
    long long sml = (sum + mod - i) % mod;
    long long fr = fre - 1;
    long long fac =
        ((fr + 1) % mod * 1ll * pw(2ll, (fr - 2 + mod - 1) % (mod - 1))) % mod;
    cont = (fac * 1ll * i) % mod;
    cont = (cont * 1ll * sml) % mod;
    long long sec = (i * 1ll * i) % mod;
    sec = (sec * 1ll * (fr % mod * 1ll * pw(2ll, fr - 1) % mod) % mod) % mod;
    cont = (cont + sec) % mod;
    cont = (cont * 1ll * cnt[i]) % mod;
    ans = (ans + cont) % mod;
  }
  for (int i = 2; i <= 100000; i++) {
    long long rs = 0ll;
    long long sum = 0ll, fre = 0ll;
    for (int j = i; j <= 100000; j += i) {
      sum = (sum + (j * 1ll * cnt[j]) % mod) % mod;
      fre = fre + cnt[j];
    }
    for (int j = i; j <= 100000; j += i) {
      long long cont = 0ll;
      long long sml = (sum + mod - j) % mod;
      long long fr = fre - 1;
      if (fr == 0) continue;
      long long fac =
          ((fr + 1) % mod * 1ll * pw(2ll, (fr - 2 + mod - 1) % (mod - 1))) %
          mod;
      cont = (fac * 1ll * j) % mod;
      cont = (cont * 1ll * sml) % mod;
      long long sec = (j * 1ll * j) % mod;
      sec = (sec * 1ll *
             (fr % mod * 1ll * pw(2ll, (fr - 1 + mod - 1) % (mod - 1)) % mod) %
             mod) %
            mod;
      cont = (cont + sec) % mod;
      cont = (cont * 1ll * cnt[j]) % mod;
      rs = (rs + cont) % mod;
    }
    ans = (ans + (rs * 1ll * mob[i]) % mod) % mod;
  }
  cout << ans << "\n";
  return 0;
}