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

int main(){
    int N; cin >> N;
    vector<double> a(N),b(N),c(N),d(N);
    for(int _=0; _<2; _++){
        for(int i=0; i<N; i++) cin >> a[i] >> b[i];
        int x = 0, y = 0;
        for(int i=0; i<N; i++){
            x += a[i];
            y += b[i];
            a[i] *= N;
            b[i] *= N;
        }
        for(int i=0; i<N; i++){
            a[i] -= x;
            b[i] -= y;
        }
        swap(a,c);
        swap(b,d);
    }
    for(int i=0; i<N; i++){
        if(a[i]!=0 || b[i]!=0){
            swap(a[i],a[0]);
            swap(b[i],b[0]);
        }
    }
    string ans = "No";
    const double eps = 1e-6;
    for(int i=0; i<N; i++){
        double angle = atan2(d[i],c[i])-atan2(b[0],a[0]);
        bool flag = true;
        for(int j=0; j<N; j++){
            double A = a[j]*cos(angle)-b[j]*sin(angle);
            double B = a[j]*sin(angle)+b[j]*cos(angle);
            bool flag2 = false;
            for(int k=0; k<N; k++){
                if(std::abs(A-c[k])<=eps && std::abs(B-d[k])<=eps) flag2 = true;
            }
            flag &= flag2;
        }
        if(flag) ans = "Yes";
    }
    cout << ans << endl;
}

#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define f first
#define s second
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
const int mod=1e9+7;
const int maxV=2e7+1;
const ll inf=1e18+1;
int main(){
    int n;
    cin>>n;
    map<int, ll> mp1, mp2;
    int c;
    ll x;
    for(int i=0;i<n;i++){
        cin>>x>>c;
        if(mp1.find(c)==mp1.end()){
            mp1[c]=x;
        }
        if(mp2.find(c)==mp2.end()){
            mp2[c]=x;
        }
        mp1[c]=min(mp1[c], x);
        mp2[c]=max(mp2[c], x);
    }
    n=mp1.size();
    vector<pair<ll,ll>> pts(n);
    c=0;
    for(auto it:mp1){
        pts[c].f=it.s;
        c++;
    }
    c=0;
    for(auto it:mp2){
        pts[c].s=it.s;
        c++;
    }
    vector<vector<ll>> dp(n, vector<ll> (2));
    for(int i=0;i<n;i++){
        if(i==0){
            dp[i][0]=abs(pts[i].f-pts[i].s)+abs(pts[i].s);
            dp[i][1]=abs(pts[i].f-pts[i].s)+abs(pts[i].f);
        }
        else{
            dp[i][0]=abs(pts[i].f-pts[i].s)+min(dp[i-1][0]+abs(pts[i-1].f-pts[i].s), dp[i-1][1]+abs(pts[i-1].s-pts[i].s));
            dp[i][1]=abs(pts[i].f-pts[i].s)+min(dp[i-1][0]+abs(pts[i-1].f-pts[i].f), dp[i-1][1]+abs(pts[i-1].s-pts[i].f));
        }
    }
    cout<<min(dp[n-1][0]+abs(pts[n-1].f), dp[n-1][1]+abs(pts[n-1].s))<<"\n";
}