func_code_string: #include <bits/stdc++.h>   using namespace std;   long long t, x, y, p, q;   bool check(long long mid) {     long long pp = p * mid;     long long qq = q * mid;     if (pp - x < 0 || qq - y < 0) return false;     return (pp - x <= qq - y);   }   int main() {     scanf( %lld , &t);     while (t--) {       scanf( %lld %lld %lld %lld , &x, &y, &p, &q);       if (x * q == p * y) {         printf( 0 n );         continue;       }       long long lo = 1, hi = 2000000000;       while (lo + 1 < hi) {         long long mid = (lo + hi) / 2LL;         if (check(mid))           hi = mid;         else           lo = mid;       }       if (check(lo)) hi = lo;       if (check(hi))         printf( %lld n , hi * q - y);       else         printf( -1 n );     }     return 0;   }   