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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, q; cin >> n >> q;

    vector<long long> x(n), y(n);
    for (int i = 0; i < n; ++i) {
        cin >> x[i] >> y[i];
    }

    while (q--) {
        int l, r;
        long long cx, cy;
        int angle;
        cin >> l >> r >> cx >> cy >> angle;

        --l; --r;

        for (int i = l; i <= r; ++i) {
            long long dx = x[i] - cx;
            long long dy = y[i] - cy;
            long long ndx, ndy;

            if (angle == 90) {
                ndx = dy;
                ndy = -dx;
            } else if (angle == 180) {
                ndx = -dx;
                ndy = -dy;
            } else {
                ndx = -dy;
                ndy = dx;
            }

            x[i] = cx + ndx;
            y[i] = cy + ndy;
        }

        long long minX = x[0], maxX = x[0];
        long long minY = y[0], maxY = y[0];
        for (int i = 1; i < n; ++i) {
            minX = min(minX, x[i]);
            maxX = max(maxX, x[i]);
            minY = min(minY, y[i]);
            maxY = max(maxY, y[i]);
        }

        long long dx = maxX - minX;
        long long dy = maxY - minY;
        long long area = dx * dy;

        cout << area << '\n';
    }

    return 0;
}
