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

template <typename T>
struct point {
    T x, y;
    point() : x(), y() { }
    point(T x, T y) : x(x), y(y) { }

    point operator+() const { return *this; }
    point operator-() const { return point(-x, -y); }

    point &operator+=(const point &p) { return x += p.x, y += p.y, *this; }
    point &operator-=(const point &p) { return x -= p.x, y -= p.y, *this; }
    point &operator*=(const T &val) { return x *= val, y *= val, *this; }
    point &operator/=(const T &val) { return x /= val, y /= val, *this; }

    point operator+(const point &p) { return point(x + p.x, y + p.y); }
    point operator-(const point &p) { return point(x - p.x, y - p.y); }
    point operator*(const T &val) { return point(x * val, y * val); }
    point operator/(const T &val) { return point(x / val, y / val); }

    friend T dot(const point &a, const point &b) {
        return a.x * b.x + a.y * b.y;
    }

    friend point operator*(const T &val, const point &p) { return point(val * p.x, val * p.y); }

    bool operator==(const point &p) const {
        return x == p.x && y == p.y;
    }

    friend ostream &operator<<(ostream &os, const point &p) {
        return os << '(' << p.x << ',' << p.y << ')';
    }
};

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

    int n;
    cin >> n;

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

    int m;
    cin >> m;

    vector<point<long long>> pref_x(m + 1), pref_y(m + 1);
    vector<int> swaps(m + 1);

    pref_x[0] = pref_y[0] = {0, 1};
    for (int i = 1; i <= m; i++) {
        int t, p;
        cin >> t;
        pref_x[i] = pref_x[i - 1], pref_y[i] = pref_y[i - 1], swaps[i] = swaps[i - 1];
        if (t == 1) {
            swaps[i] ^= 1;
            swap(pref_x[i], pref_y[i]);
            pref_y[i] = -pref_y[i];
        } else if (t == 2) {
            swaps[i] ^= 1;
            swap(pref_x[i], pref_y[i]);
            pref_x[i] = -pref_x[i];
        } else if (t == 3) {
            cin >> p;
            pref_x[i] = point<long long>(2 * p, 0) - pref_x[i];
        } else {
            cin >> p;
            pref_y[i] = point<long long>(2 * p, 0) - pref_y[i];
        }
    }

    //1 = (y, -x)
    //2 = (-y, x)
    //3, (2p - x, y)
    //4, (x, 2p - y)

    int q;
    cin >> q;

    while (q--) {
        int a, b;
        cin >> a >> b, --b;
        if (!swaps[a]) {
            cout << pref_x[a].x + pref_x[a].y * x[b] << ' ';
            cout << pref_y[a].x + pref_y[a].y * y[b] << '\n';
        } else {
            cout << pref_x[a].x + pref_x[a].y * y[b] << ' ';
            cout << pref_y[a].x + pref_y[a].y * x[b] << '\n';
        }
    }
    return 0;
}
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define int long long
#define ll long long
#define F(type, i, a, b, incr) for (type i = a; i <= (type)(b); i += (type)(incr))
#define RF(type, i, a, b, decr) for (type i = a; i >= (type)(b); i -= (type)(decr))
#define sz(a) sizeof(a)
#define deb(a) cerr << " [" << #a << "->" << a << "] "
#define next_line cerr << '\n'
#define all(a) a.begin(), a.end()
#define iter(it, s) for (auto it = s.begin(); it != s.end(); it++)
#define setbits(x) __builtin_popcountll(x)
using namespace __gnu_pbds;
using namespace std;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

const int N = 1e5 + 1;
int arr[N], n;

double fun(double x){
    double ans =0 ;
    for(int i =0 ; i < n;  i++){
        ans += (x + (double)(arr[i]) - min((double)(arr[i]), 2.0*x));
    }
    return ans;
}

void solve()
{
    cin>> n;
    int mn = 1e9;
    for(int i =0 ; i < n;i ++){
        cin>> arr[i];
        mn = min(arr[i], mn);
    }    
    double l = (double(mn) / 2.0), r = 1e9, e = 1e-7;
    while(r - l >= e){
        double m1 = l + (r - l) / 3;
        double m2 = r - (r - l) / 3;
        double v1 = fun(m1);
        double v2 = fun(m2);
        if(v1 > v2){
            l = m1;
        }else{
            r = m2;
        }
    }
    double x = r;
    double ans = fun(x) / (double(n));
    cout<< ans << '\n';
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	// freopen("Debug.txt", "w", stderr);
    #else
    #endif
    cout << fixed << setprecision(10);
    int _t =1;
    // cin>>_t;
    F(int, i, 1, _t, 1){
	// cout << "Case #" << i << ": ";
	solve();
    }
}
