#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
void print(vector<long long> v) {
  for (long long i = 0; i < (long long)v.size(); i++) cout << v[i] << " ";
  cout << endl;
}
vector<long long> div(long long n) {
  vector<long long> v;
  for (long long i = 1; i < (long long)sqrt(n) + 1; i++) {
    if ((n % i) == 0) {
      if (i == n / i)
        v.push_back(i);
      else {
        v.push_back(i);
        v.push_back(n / i);
      }
    }
  }
  return v;
}
long long powmod(long long a, long long b, long long c) {
  if (b == 0)
    return 1 % c;
  else if (b % 2 == 0)
    return powmod((a * a) % c, b / 2, c);
  return (a * powmod((a * a) % c, (b - 1) / 2, c)) % c;
}
bool check(string v) {
  for (long long i = 0; i < (long long)v.size() - 1; i++)
    if (v[i] != v[i + 1]) return false;
  return true;
}
void printp(vector<pair<long long, long long> > v) {
  for (long long i = 0; i < (long long)v.size(); i++)
    cout << v[i].first << " " << v[i].second << endl;
}
long long min(long long a, long long b) { return a < b ? a : b; }
long long max(long long a, long long b) { return a > b ? a : b; }
void print_map(map<long long, long long> m) {
  for (auto it : m) cout << it.first << " " << it.second << "\n";
}
void print_set(set<long long> s) {
  for (auto it : s) cout << it << " ";
  cout << endl;
}
bool prime[1000005];
void sieve() {
  memset(prime, true, sizeof(prime));
  for (long long i = 2; i * i < 1000005; i++) {
    if (prime[i] == true) {
      for (long long j = i * i; j < 1000005; j += i) {
        prime[j] = false;
      }
    }
  }
}
vector<long long> pow(long long a) {
  vector<long long> res;
  long long temp = 1;
  while (temp <= 1000005) {
    res.push_back(temp);
    temp *= a;
  }
  return res;
}
vector<long long> v = pow(2);
long long modInverse(long long a, long long m) {
  long long m0 = m;
  long long y = 0, x = 1;
  if (m == 1) return 0;
  while (a > 1) {
    long long q = a / m;
    long long t = m;
    m = a % m, a = t;
    t = y;
    y = x - q * y;
    x = t;
  }
  if (x < 0) x += m0;
  return x;
}
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n, k;
    cin >> n >> k;
    long long skip = k % (n - 1);
    if (skip == 0)
      cout << n * (k / (n - 1)) - 1 << endl;
    else
      cout << n * (k / (n - 1)) + skip << endl;
  }
  return 0;
}
