#include<bits/stdc++.h>
using namespace std;
#define _rep(i, x, y) for(int i = (int)x; i < (int)y; ++i)
#define _dep(i,x,y) for(int i = (int)x; i > (int)y; i--)
#define PII pair<int,int>
#define eb emplace_back
#define pb push_back
#define fi first
#define se second
#define PQ priority_queue
#define lb lower_bound
#define ub upper_bound
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VII;
typedef vector<ll> VL;
typedef vector<vector<ll>> VLL;
constexpr int mod = 1e9 + 7;
constexpr int KINF = 0x3f3f3f3f;
constexpr double eps = 1e-7;
int main(){
	ios::sync_with_stdio(false); cin.tie(0);
	ll k;
	cin >> k;
	string s, t;
	cin >> s >> t;
	VI cnt(10, k);
	_rep(i, 0, 4) cnt[s[i] - '0'] --;
	_rep(i, 0, 4) cnt[t[i] - '0'] --;
	auto get = [&](string S){
		VL c(10);
		iota(all(c), 0ll);
		_rep(i, 0, 5) c[S[i] - '0'] *= 10;
		return accumulate(all(c), 0); 
	};
	ll win = 0;
	_rep(i, 1, 10){
		s.back() = '0' + i;
		int sc = get(s);
		_rep(j, 1, 10){	
			t.back() = '0' + j;
			if(sc <= get(t)) continue;
			win += 1ll * cnt[i] * (cnt[j] - (i == j));
		}
	}
	int rem = 9 * k - 8;
	cout <<  (double)(win) / (rem) / (rem - 1) << endl;
	return 0;
} 
// 小心左移运算符导致的int溢出
// dp记得处理非法状态
// resize并不会初始化数组
// 全局函数一定要记得inline
// 带空格字符串不能直接cin,要用getline


#include <bits/stdc++.h>
#define int             long long
#define trace(x) 		cerr<<#x<<": "<<x<<" "<<endl;
#define w(x)            int x; cin>>x; while(x--)
#define fr(i,a,b)       for(int i = a; (int)i < b; i++)
#define frr(i,a,b)      for(int i = a; (int)i >= b; i--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;
int32_t main()
{
	FIO;
	int a, b, c;
	cin >> a >> b >> c;
	if ((a * a) + (b * b) < (c * c)) {
		cout << "Yes";

	}
	else cout << "No";
	return 0;
}