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 = 100005, mod = 998244353;
long long n, cn[MX], mu[MX], bs[MX];
long long pot(long long b, long long p) {
  long long res = 1;
  b %= mod;
  while (p) {
    if (p & 1) (res *= b) %= mod;
    (b *= b) %= mod;
    p /= 2;
  }
  return res;
}
long long f(long long n) {
  if (n < 1) return 0;
  return n % mod * pot(2, n - 1) % mod;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  for (int i = 0; i < (MX); i++) mu[i] = 1;
  for (long long i = 2; i < MX; i++)
    if (!bs[i]) {
      for (long long j = i; j < MX; j += i) {
        bs[j] = 1;
        mu[j] *= -1;
      }
      for (long long j = i * i; j < MX; j += i * i) mu[j] = 0;
    }
  cin >> n;
  while (n--) {
    long long a, f;
    cin >> a >> f;
    cn[a] = f;
  }
  long long res = 0;
  for (long long i = 1; i < MX; i++)
    if (mu[i]) {
      long long s = 0, acu = 0, dot = 0;
      for (long long j = i; j < MX; j += i) {
        (s += j * cn[j]) %= mod;
        (dot += j * j % mod * cn[j]) %= mod;
        acu += cn[j];
      }
      (s *= s) %= mod;
      (s -= dot) %= mod;
      long long p = s * (f(acu - 2) + pot(2, acu - 2)) % mod;
      (p += dot * f(acu - 1)) %= mod;
      (res += mu[i] * p) %= mod;
    }
  cout << ((((res) % (mod)) + (mod)) % (mod)) << '\n';
  return 0;
}