#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007;
constexpr long long INF = 1000000000 + 100;
constexpr long long LINF = 1000000000000000000 + 100;
#define all(v) v.begin(), v.end()
#define rep(i, n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
#define rrep(i, n) for(int i=(n); i>=0; i--)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){
    double a, b; cin >> a >> b;
    cout << fixed << setprecision(12);
    cout << (a-b) / a * 100 << ln;
}

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,m,n) for (int i = (m); i < (n); ++i)
#define rrep(i,n) for (int i = (n)-1; i >= 0; --i)
#define RREP(i,m,n) for (int i = (n)-1; i >= (m); ++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using namespace std;
using ll = long long int;
using vec = vector<int>;
using P = pair<int,int>;
const int INF = 1e9+7;

tuple<ll, ll, ll> egcd(ll a, ll b) {
  if (!b) return {a, 1, 0};
  ll g, x, y;
  tie(g, x, y) = egcd(b, a%b);
  return {g, y, x-a/b*y};
}

ll rem(ll a, ll b) {
  if (a < 0) return a % b + b;
  return a % b;
}

int main() {
  ll t; cin >> t;

  rep(q,t) {
    ll n, s, k; cin >> n >> s >> k;

    k %= n;

    ll g, x, y;
    tie(g, x, y) = egcd(n,k);

    if (s % g) {
      cout << -1 << endl;
      continue;
    }

    n /= g;
    s /= g;
    k /= g;

    cout << rem(-y * s, n) << endl;

  }

}
