#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define pii pair<ll,ll>
#define inf 1000000000000000000
#define bpc(x) __builtin_popcountll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define autoitr(x,it) for(auto it = x.rbegin(); it != x.rend(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

using namespace std;
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());

void get(ll i, ll arr[], ll n, ll xo, ll o, ll &ans)
{
    if(i == n)
    {
        ans = min(ans, xo^o);
        return;
    }
    
    get(i+1, arr, n, xo, o|arr[i], ans);
    get(i+1, arr, n, xo^o, arr[i], ans);
}

const ld PI = acos(-1);

int main()
{
  FAST/**/
  
  ll n;
  cin>>n;
  
  ld x0,y0,x1,y1;
  cin>>x0>>y0>>x1>>y1;
  
  ld cx = (x0+x1)/2, cy = (y0+y1)/2;
  x0-=cx, y0-=cy;
  ld ang = (2*PI)/n;
  ld fx = (x0*cos(ang) - y0*sin(ang)), fy = (x0*sin(ang) + y0*cos(ang));
  fx+=cx, fy+=cy;
  cout<<fixed<<setprecision(12)<<fx<<" "<<fy<<'\n';
  
  return 0;
}
   
   
 
#include <bits/stdc++.h>
#define int long long

using namespace std;

const int O = 2e5 + 5;

int tree[2][O * 4], t[2][O * 4];

vector <int> val;

void Update(int id, int l, int r, int u, int v, int k){
    if (l > u || r < u) return;
    if (l == r){
        tree[k][id] += val[l] * v;
        t[k][id] += v;
        return;
    }
    int mid = (l + r) / 2;
    Update(id << 1, l, mid, u, v, k);
    Update(id << 1 | 1, mid + 1, r, u, v, k);
    tree[k][id] = tree[k][id << 1] + tree[k][id << 1 | 1];
    t[k][id] = t[k][id << 1] + t[k][id << 1 | 1];
}

pair <int, int> Get(int id, int l, int r, int u, int v, int k){
    if (l > v || r < u) return make_pair(0, 0);
    if (u <= l && r <= v) return make_pair(tree[k][id], t[k][id]);
    int mid = (l + r) / 2;
    auto x = Get(id << 1, l, mid, u, v, k);
    auto y = Get(id << 1 | 1, mid + 1, r, u, v, k);
    return make_pair(x.first + y.first, x.second + y.second);
}

main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

    int n, m, q; cin >> n >> m >> q;
    vector <vector <int>> pre(2, vector <int> (max(n, m) + 1));
    vector <vector <int>> sum(2, vector <int> (max(n, m) + 1));
    vector <tuple <int, int, int>> queries; val.push_back(0);
    for (int i = 1; i <= q; ++ i){
        int t, x, y; cin >> t >> x >> y;
        queries.push_back(make_tuple(t, x, y));
        val.push_back(y);
    }

    sort(val.begin(), val.end());
    auto cac = unique(val.begin(), val.end());
    val.resize(distance(val.begin(), cac));

    int ans = 0, h = val.size() - 1;
    Update(1, 0, h, 0, n, 0);
    Update(1, 0, h, 0, m, 1);
    for (int i = 0; i < q; ++ i){
        int t = get<0>(queries[i]);
        int r = get<1>(queries[i]);
        int x = pre[t - 1][r];
        int y = get<2>(queries[i]);

        t -= 1;
        int idx = upper_bound(val.begin(), val.end(), x) - val.begin() - 1;
        int idy = upper_bound(val.begin(), val.end(), y) - val.begin() - 1;
        auto X = Get(1, 0, h, 0, idx, t ^ 1);
        auto Y = Get(1, 0, h, 0, idy, t ^ 1);
        auto greatX = Get(1, 0, h, idx + 1, h, t ^ 1);
        auto greatY = Get(1, 0, h, idy + 1, h, t ^ 1);
        Update(1, 0, h, idx, -1, t);
        Update(1, 0, h, idy, 1, t);
        ans = ans - (x * X.second - X.first) + (y * Y.second - Y.first);
        pre[t][r] = y;
        cout << ans << "\n";
    }
}
