#include <bits/stdc++.h>
using namespace std;
using C = complex<double>;

C unko(){
    double x,y;
    cin>>x>>y;
    return C(x,y);
}
int main(void){
    int n;
    cin>>n;
    C s=unko();
    C t=unko();
    C o=(s+t)/2.0;
    double PI=acos(-1);
    double rad=2*PI/n;
    C r(cos(rad),sin(rad));
    C ans=o+r*(s-o);
    cout<<fixed<<setprecision(10)<<ans.real()<<" "<<ans.imag()<<endl;
    return 0;
}

#include <bits/stdc++.h>
// clang-format off
using namespace std; using ll = long long; using ull = unsigned long long; using pll = pair<ll,ll>; const ll INF = 4e18;
void print0() {}
template<typename Head,typename... Tail> void print0(Head head,Tail... tail){cout<<fixed<<setprecision(15)<<head;print0(tail...);}
void print() { print0("\n"); }
template<typename Head,typename... Tail>void print(Head head,Tail... tail){print0(head);if(sizeof...(Tail)>0)print0(" ");print(tail...);}
// clang-format on

int main() {
    ll t;
    cin >> t;
    for (ll i = 0; i < t; i++) {
        ll l, r;
        cin >> l >> r;
        ll mn = l + l;
        ll mx = r;
        if (mn > mx) {
            print(0);
            continue;
        }
        ll n = mx - mn + 1;
        print(n * (n + 1) / 2);
    }
}
