#pragma GCC optimize("Ofast") #include using namespace std; #define rep(i, n) for(int i = 0; i < (int)(n); ++i) #define all(x) x.begin(),x.end() #define ln '\n' const long double PI = acos(-1.0L); const long long MOD = 1000000007LL; // const long long MOD = 998244353LL; typedef long long ll; typedef pair pii; typedef pair pll; template inline bool chmax(T &a, T b) { if (a < b) { a = b; return true;} return false; } template inline bool chmin(T &a, T b) { if (a > b) { a = b; return true;} return false; } //////////////////////////////////////////////////////////////////////////////////////////////////////////// int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll N,M,K; cin >> N >> M >> K; char c; cin >> c; vector B(M),A(N); rep(i,M) cin >> B[i]; rep(i,N) cin >> A[i]; sort(all(A)); sort(all(B)); if (c == '+') { ll ans = 0; rep(i,N) { ll k = B.end() - lower_bound(all(B),K-A[i]); ans += k; } cout << ans << ln; } else { ll ans = 0; rep(i,N) { ll k = B.end() - lower_bound(all(B),(K+A[i]-1)/A[i]); ans += k; } cout << ans << ln; } }