#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
#define REP(i,n) for(ll i=0;i<(n);i++)
#define ALL(v) v.begin(),v.end()
template<typename T> bool chmax(T &x, const T &y) {return (x<y)?(x=y,true):false;};
template<typename T> bool chmin(T &x, const T &y) {return (x>y)?(x=y,true):false;};
constexpr ll MOD=1000000007;
constexpr ll INF=2e18;

int main(){
    int n; cin >> n;
    VI a(n), b(n), c(n), d(n);
    REP(i,n) cin >> a[i] >> b[i], a[i]*=n, b[i]*=n;
    REP(i,n) cin >> c[i] >> d[i], c[i]*=n, d[i]*=n;
    if(n==1){
        cout << "Yes" << endl;
        return 0;
    }
    double csx=0, csy=0, ctx=0, cty=0;
    REP(i,n){
        csx+=a[i];
        csy+=b[i];
        ctx+=c[i];
        cty+=d[i];
    }
    csx/=n, csy/=n, ctx/=n, cty/=n;
    REP(i,n){
        a[i]-=csx;
        b[i]-=csy;
        c[i]-=ctx;
        d[i]-=cty;
    }
    if(a[0]==0&&b[0]==0){
        swap(a[0],a[1]);
        swap(b[0],b[1]);
    }
    REP(i,n){
        if(c[i]==0&&d[i]==0)
            continue;
        double ang=atan2(d[i],c[i])-atan2(b[0],a[0]);
        bool ok=1;
        REP(j,n){
            double x=a[j]*cos(ang)-b[j]*sin(ang);
            double y=a[j]*sin(ang)+b[j]*cos(ang);
            bool f=0;
            REP(k,n){
                if(abs(x-c[k])<=1e-6&&abs(y-d[k])<=1e-6)
                    f=1;
            }
            if(!f){
                ok=0;
                break;
            }
        }
        if(ok){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}
#include <bits/stdc++.h>
typedef long long ll;
typedef std::pair<int, int> PII;
const int INF = 1e9;
const int MOD = 1e9+7;

int main(){
    int k;
    std::cin>>k;
    int deck[10], ht[10]={}, ha[10]={};
    for(int i=1;i<10;++i)deck[i]=k;
    std::string s, t;
    std::cin>>s>>t;
    ll st, sa;
    st=0;
    sa=0;
    for(int i=0;i<4;++i){
        ++ht[s[i]-48];
        ++ha[t[i]-48];
        --deck[s[i]-48];
        --deck[t[i]-48];
    }
    for(int i=1;i<10;++i){
        st += i * std::pow(10, ht[i]);
        sa += i * std::pow(10, ha[i]);
    }
    double ans = 0;
    double total=9*k-8;
    for(int i=1;i<10;++i){
        if(deck[i]==0)continue;
        for(int j=1;j<10;++j){
            if(i==j){
                if(deck[j]<=1)continue;
            }
            else{
                if(deck[j]==0)continue;
            }
            if(st+i*std::pow(10, ht[i])*9>sa+j*std::pow(10, ha[j])*9){
                if(i==j)ans+=deck[i]/total * (deck[i]-1)/(total-1);
                else{
                    ans += deck[i]/total * (deck[j])/(total-1);
                }
            }
        }
    }
    std::cout<<std::setprecision(8)<<ans<<"\n";
}

