#include <bits/stdc++.h>
typedef __int128 ll;
using namespace std;
const int maxn = 1e5 + 5;
int n;
ll R;
struct vec {
ll x, y;
vec(int x = 0, int y = 0) : x(x), y(y) {}
friend vec operator - (const vec &p, const vec &q) {
return vec(p.x - q.x, p.y - q.y);
}
} a[maxn * 2], c;
ll cross(vec p, vec q) {
return p.x * q.y - p.y * q.x;
}
void print(ll x) {
if(x == 0) {
cout << 0;
return;
}
vector<int> res;
while(x > 0) {
res.push_back(x % 10);
x /= 10;
}
reverse(res.begin(), res.end());
for(int i : res) {
cout << i;
}
}
bool check(vec p, vec q) {
// cout <<sqrt((p.x - q.x) * (p.x - q.x) + (p.y - q.y) * (p.y - q.y)) << '\n';
// cout << (p.y - q.y) * c.x << ' ' << (q.x - p.x) * c.y << ' ';
// cout << abs((p.y - q.y) * c.x + (q.x - p.x) * c.y + p.x * q.y - p.y * q.x) << ' ';
// cout << abs((p.y - q.y) * c.x + (q.x - p.x) * c.y + p.x * q.y - p.y * q.x)
// / sqrt((p.x - q.x) * (p.x - q.x) + (p.y - q.y) * (p.y - q.y)) << '\n';
ll t = (p.y - q.y) * c.x + (q.x - p.x) * c.y + p.x * q.y - p.y * q.x;
return t * t >= R * R * ((p.x - q.x) * (p.x - q.x) + (p.y - q.y) * (p.y - q.y));
}
void solve() {
int x, y;
cin >> n >> x >> y;
c = vec(x, y);
cin >> x;
R = x;
for(int i = 1; i <= n; i++) {
cin >> x >> y;
a[i] = vec(x, y);
a[i + n] = a[i];
}
ll ans = 0, sum1 = 0, sum2 = 0;
sum1 += cross(a[1], a[1]);
for(int i = 1; i <= n; i++) {
sum2 += cross(a[i], a[i + 1]);
}
for(int i = 1, j = 1; i <= n; i++) {
while(j + 1 - i <= n - 2 && check(a[i], a[j + 1]) && cross(a[j + 1] - a[i], c - a[i]) > 0) {
sum1 += cross(a[j], a[j + 1]);
sum1 -= cross(a[j], a[i]);
sum1 += cross(a[j + 1], a[i]);
// sum2 -= cross(a[j], a[j + 1]);
// sum2 -= cross(a[j], a[i + n]);
// sum2 += cross(a[j + 1], a[i + n]);
j++;
}
if(i < j) {
ans = max(ans, abs(sum1));
// cout << i << ' ' << j << ' ' << sum1 << '\n';
// if(cross((a[j] - a[i]), (c - a[i])) < 0) {
// ans = max(ans, sum1 / 2);
// }
// else {
// ans = max(ans, sum2 / 2);
// }
sum1 -= cross(a[i], a[i + 1]);
sum1 -= cross(a[j], a[i]);
sum1 += cross(a[j], a[i + 1]);
// sum2 += cross(a[i + n], a[i + n + 1]);
// sum2 -= cross(a[j], a[i + n]);
// sum2 += cross(a[i + n + 1], a[j]);
}
else {
j++;
}
}
print(ans);
cout << '\n';
}
int main() {
#ifdef yczDEBUG
freopen("1.in", "r", stdin);
freopen("1.out", "w", stdout);
#endif
ios::sync_with_stdio(0);
cin.tie(0);
int T;
cin >> T;
while(T--) {
solve();
}
return 0;
}