#include <bits/stdc++.h>
using namespace std;

int main(){
  vector<int> A;
  vector<int> B;
  vector<int> product;
  int N,m;
  int result = 0;
  cin >> N;
  for(int i = 0;i < N;i++){
    cin >> m;
    A.push_back(m);
  }
  for(int i = 0;i < N;i++){
    cin >> m;
    B.push_back(m);
  }
  for(int i = 0;i < N;i++){
    int P;
    P = A[i]*B[i];
    product.push_back(P);
  }
  for(int i = 0;i < N;i++){
    result += product[i];
  }
  if(result == 0){
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
}
#include <bits/stdc++.h>
using namespace std;

void solve() {
  int l,r;
  cin >> l >> r;
  long long marg = r-2*l;
  long long ans = (marg+1)*(marg+2)/2;
  if (marg < 0) ans = 0;
  cout << ans << endl;
}

int main() {

  ios::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  for (int i=0;i<t;i++) solve();
}