#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1e6+10;
const ld eps = 1e-6;
typedef pair<int, int> P;
const long double eps = 1e-6;
#define x first
#define y second
// 叉乘
int cross(P a, P b)
{
return a.x * b.y - a.y * b.x;
}
// 点积
int mul(P a, P b)
{
return a.x * b.x + a.y * b.y;
}
// 点平方和
int mul(P a)
{
return a.x * a.x + a.y * a.y;
}
// 计算矢量
P del(P a, P b)
{
return {a.x - b.x, a.y - b.y};
}
void solve()
{
int n;
cin>>n;
P C;
cin>>C.x;
cin>>C.y;
int R;
cin>>R;
vector<P> a(n);
for (int i = 0; i < n; i++)
{
cin>>a[i].x;
cin>>a[i].y;
}
int ans = 0;
int S = 0;
for (int l = 0, r = l + 1; l < n; l++)
{
while (1)
{
int rr = r % n + 1;
int s = cross(del(a[rr], a[l]), del(C, a[l]));
if (s <= 0)
break;
if (s * s < mul(del(a[rr], a[l])) * R * R)
break;
S += cross(del(a[r], a[l]), del(a[rr], a[l]));
r = rr;
}
ans = max(ans, S);
int ll = l % n + 1;
S -= cross(del(a[r], a[l]), del(a[r], a[ll]));
}
cout<<ans<<"\n";
}
signed main(){
int _ = 1;
cin>>_;
while (_--)
{
solve();
}
return 0;
}