#include <bits/stdc++.h>
// #define int long long
#define ff first
#define ss second
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ti tuple<int, int, int>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define sws ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl '\n'
#define teto(a, b) (((a)+(b)-1)/(b))
#define all(x) x.begin(), x.end()
#define forn(i, n) for(int i = 0; i < (int)n; i++)
#define forne(i, a, b) for(int i = a; i <= b; i++)
#define dbg(msg, var) cerr << msg << " " << var << endl;

using namespace std;

const int MAX = 3e5+10;
const ll MOD = 1e9+7;
const int INF = 0x3f3f3f3f;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
const ld EPS = 1e-8;
const ld PI = acos(-1);

// End Template //

int h, w, A, B;

ll solve(int x, int y, int a, vector<vector<bool>> &mat){
    ll ans = 0;
    if(a==0) return 1;
    if(x<h-1)
        ans += solve(x+1, y, a, mat);
    else if(y<w-1)
        ans += solve(0, y+1, a, mat);
    else
        return 0;

    if(x<h-1 and !mat[x][y] and !mat[x+1][y]){
        mat[x][y]=mat[x+1][y]=true;
        ans += solve(x+1, y, a-1, mat);
        mat[x][y]=mat[x+1][y]=false;
    }

    if(y<w-1 and !mat[x][y] and !mat[x][y+1]){
        mat[x][y]=mat[x][y+1]=true;
        if(x<h-1)
            ans += solve(x+1, y, a-1, mat);
        else
            ans += solve(0, y+1, a-1, mat);
        mat[x][y]=mat[x][y+1]=false;
    }
    return ans;
}


int32_t main()
{sws;

    cin >> h >> w >> A >> B;

    vector<vector<bool>> mat(h, vector<bool>(w, false));

    cout << solve(0, 0, A, mat) << endl;

    return 0;
}

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

signed main(){
  int k; cin>>k;
  string s,t; cin>>s>>t; 
  vector<int> vec(9,k);
  
  for(int i=0;i<4;i++){
    vec.at(s.at(i)-'0'-1)--;
    vec.at(t.at(i)-'0'-1)--;
  } //vec内が残り枚数を示すことに。なお合計枚数は9k-8枚
  
  double ans=0;
  cout << fixed<<setprecision(20);
  
  for(int i=1;i<=9;i++){
    for(int j=1;j<=9;j++){
      double p=0;
      if(i==j){
        p+=vec.at(i-1)*(vec.at(i-1)-1)/(9*k-8.0)/(9*k-9.0);
      }else{
        p=vec.at(i-1)*vec.at(j-1)/(9*k-8.0)/(9*k-9.0);
      }
      
      vector<int> vecs(9,0),vect(9,0);
        for(int k=0;k<4;k++){
          vecs.at(s.at(k)-'0'-1)++;
          vect.at(t.at(k)-'0'-1)++;
        }
      vecs.at(i-1)++;
      vect.at(j-1)++; //vecs,vectにそれぞれsとtの1～9の個数
      
      int ns=0,nt=0; //sとtのijの際の得点
      for(int k=1;k<=9;k++){
        ns += k*pow(10,vecs.at(k-1));
        nt += k*pow(10,vect.at(k-1));
      }
      if(ns>nt){
        ans +=p;
      }
    }
  }
  cout <<ans<<endl;
}