#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define PI acos(-1)
#define int long long
bool gt(string s,string t){
	vector<int>cnt1(10,0),cnt2(10,0);
	for(auto u:s)cnt1[u-'0']++;
	int a=0;
	for(int i=1;i<=9;i++)a+=i*pow(10,cnt1[i]);
	for(auto u:t)cnt2[u-'0']++;
	int b=0;
	for(int i=1;i<=9;i++)b+=i*pow(10,cnt2[i]);
	return a>b;
}
int32_t main(){
	IOS;
	int k;
	cin>>k;
	string s,t;
	cin>>s>>t;
	vector<int>cnt(10,k);
	for(int i=0;i<4;i++){
		cnt[s[i]-'0']--;
		cnt[t[i]-'0']--;
	}
	int scorea=0;
	for(int i=1;i<=9;i++){
		for(int j=1;j<=9;j++){
			s.back()=i+'0';
			t.back()=j+'0';
			//cout<<temp1<<" "<<temp2<<endl;
			if (gt(s,t))scorea+=cnt[i]*(cnt[j]-(i==j));
		}
	}
	//cout<<scorea<<" "<<scoreb<<endl;
	cout<<fixed<<setprecision(12)<<1.0*scorea/(9*k-8)/(9*k-9)<<endl;
return 0;
}

#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O0")
typedef long long ll;
typedef long double ld;
const ll mod = 1e9+7;
const ll INF = 1e18;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define Rep(i,a,n) for (ll i = (a); i < (n); ++i)
#define All(a) (a).begin(),(a).end()
#define Pi acos(-1)
using V = vector<ll>;
using P = pair<ll,ll>;
using Graph = vector<V>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << setprecision(15) << fixed;

  ll n, m, t;
  cin >> n >> m >> t;
  V a(m);
  V b(m);
  rep(i,m) {
    cin >> a[i] >> b[i];
  }
  ll N = n;
  rep(i,m) {
    if (i == 0) {
      n -= a[i];
    }
    else {
      n -= a[i];
      n += b[i-1];
    }
    if (n <= 0) {
      cout << "No\n";
      return 0;
    }
    n += (b[i] - a[i]);
    n = min(n,N);
  }
  if (n - (t-b[m-1]) <= 0) {
    cout << "No\n";
  } 
  else {
    cout << "Yes\n";
  }
 }