#include <bits/stdc++.h>
using namespace std;
const int N = 10001;
const int M = 100001;
const int HA = 998244353;
const int INF = 2147483647;
const long long INFL = 9223372036854775807;
int main() {
  int t, n, k;
  scanf("%d", &t);
  while (t--) {
    scanf("%d%d", &n, &k);
    printf("%d\n", k + (k - 1) / (n - 1));
  }
  return 0;
}
