#include using namespace std; using Int = long long; template inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template inline void chmax(T1 &a,T2 b){if(a v(3); for(Int i=0;i<3;i++) cin>>v[i]; Int n; cin>>n; vector e(n); for(Int i=0;i>e[i]; sort(v.rbegin(),v.rend()); v.emplace_back(1e5); sort(e.rbegin(),e.rend()); vector dp(4,0); dp[0]=1; for(Int i=0;i nx(4,0); for(Int j=0;j<4;j++){ nx[j]+=dp[j]; nx[j+(v[j]<=e[i])]+=dp[j]; } swap(dp,nx); } cout<