#include <bits/stdc++.h>
#define ls rt << 1
#define rs rt << 1|1
#define lson ls,l,m
#define rson rs,m+1,r
#define st first
#define ed second
#define Point pair<int,int>
typedef long long ll;
using namespace std;
const int N = 1e6+5;
const int PI = 314;

int main(){
	ll n,k;
	scanf("%lld%lld",&n,&k);
	
	n += 100;
	ll l = 1ll,r = 2e12;
	while(l < r){
		ll m = (l+r+1) >> 1;
		ll t = m*n/100ll;
		if((t-m) < k) l = m;
		else r = m-1;
	}
	printf("%lld\n",(l*n)/100ll+1ll);
	return 0;
}
#include <bits/stdc++.h>
using namespace std;

#define endl '\n'
#define pii pair <int, int>
#define pb push_back
#define F first
#define S second
#define ll long long
#define io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define M_PI 3.14159265358979323846

const int N = 100005;
const int mod = 1e9 + 7;

int main() {
    io;
    int t;
    cin >> t;
    while(t--){
        ll l, r;
        cin >> l >> r;
        ll k = r - l - l + 1;
        k = max(k, 0ll);
        k = k * (k + 1) / 2;
        cout << k << endl;
    }
}
