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;
static long long values[100001];
static int phi[100001];
static long long p = 998244353;
static bool sqf[100001];
long long exp2(long long a) {
  if (a == 0) return 1;
  if (a == 1) return 2;
  long long b = exp2(a / 2);
  long long c = (b * b) % p;
  if (a % 2 == 1)
    return (c * 2) % p;
  else
    return c;
}
int main() {
  constexpr int N = 100000;
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int m;
  cin >> m;
  long long n = 0;
  while (m-- > 0) {
    int k;
    long long f;
    cin >> k >> f;
    values[k] = f;
  }
  fill(sqf, sqf + 100001, true);
  fill(phi, phi + 100001, 0);
  phi[1] = 2;
  long long r = 0;
  for (int d = 1; d <= N; ++d) {
    long long n = 0;
    long long ss = 0;
    long long s = 0;
    if (!sqf[d]) continue;
    if (phi[d] == 0) {
      for (int j = d; j <= N; j += d) {
        ++phi[j];
      }
      if (d <= N / d) {
        int c = d * d;
        for (int j = c; j <= N; j += c) {
          sqf[j] = false;
        }
      }
    }
    for (int j = d; j <= N; j += d) {
      n = n + values[j];
      s = (s + values[j] * j) % p;
      ss = (ss + ((values[j] * j) % p) * j) % p;
    }
    if (n <= 1) continue;
    long long p2 = exp2(n - 3);
    if (n == 2) p2 = (p + 1) / 2;
    long long subsum = ((((p2 * (n % p)) % p) * s) % p * s) % p +
                       (((p2 * ((n - 2) % p)) % p) * ss) % p;
    if (phi[d] % 2 == 1) {
      r -= subsum;
    } else {
      r += subsum;
    }
  }
  cout << (r % p + p) % p << endl;
  return 0;
}