//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
ll h,w,a,b;
ll hmax = 16;
ll wmax = 16;
vvll use(hmax+1,vll(wmax+1,0));
ll solve(ll now, ll cnt){
    //cout << now << endl;
    ll ni = now/w;
    ll nj = now%w;
    ll ret = 0;
    if(cnt==a) return 1;
    if(now==h*w) return 0;
    if(use[ni][nj]==1){
        ret += solve(now+1,cnt);
    }else{
        if(nj+1<w&&use[ni][nj+1]==0){
            use[ni][nj]=1;
            use[ni][nj+1]=1;
            ret += solve(now+1,cnt+1);
            use[ni][nj]=0;
            use[ni][nj+1]=0;
        }
        if(ni+1<h){
            use[ni][nj]=1;
            use[ni+1][nj]=1;
            ret += solve(now+1,cnt+1);
            use[ni][nj]=0;
            use[ni+1][nj]=0;
        }
        ret += solve(now+1,cnt);
    }
    return ret;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin >> h >> w >> a >> b;
    ll ans = solve(0,0);
    cout << ans << endl;
    return 0;
}
#include <bits/stdc++.h>
using namespace std;

template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define fi first
#define se second
#define pb push_back
#define mod(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,a,b) for(int i = a; i < b; i++)
#define forr(i,a,b) for(int i = a; i >= b; i--)
#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

const ll mod = 1e9+7;
int sum(int a, int b){return (a+b) % mod;}
int sub(int a, int b){return (a + mod - b) % mod;}
int mul(int a, int b){return (1ll * a * b) % mod;}
int power(int a,int b){
	int res = 1;
	while(b){
		if(b&1)res = mul(res,a);
		b >>= 1;
		a = mul(a,a);
	}
	return res;
}
const ll oo = (ll)1e18;
bool esPrimo(int x){
	forn(i,2,x)if(x%i == 0)return false;
	return true;
}

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	vi primos;
	forn(i,2,51){
		if(esPrimo(i))primos.pb(i);
	}
	debug(primos);
	int N; cin >> N;
	vi A(N);
	forn(i,0,N)cin >> A[i];
	ll res = oo;
	forn(mask,0,(1<<primos.size())){
		ll act = 1;
		forn(bit,0,(int)primos.size()){
			if(mask&(1<<bit)){
				act *= ll(primos[bit]);
			}
		}
		bool can = true;
		forn(i,0,N){
			if(__gcd(ll(A[i]),act) == 1){
				can = false;
				break;
			}
		}
		if(can){
			res = min(res,act);
		}
	}
	cout << res << '\n';
	return 0;
}
/*
__builtin_mul_overflow(x,y,&x)
-fsplit-stack
*/
