#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long int lint; typedef pair IP; typedef pair LLP; typedef pairCP; #define rep(i, n) for (int i = 0; i < n; i++) #define repr(i, n) for (int i = n; i >= 0; i--) #define sort(v) sort((v).begin(), (v).end()) #define reverse(v) reverse((v).begin(), (v).end()) #define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge) #define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge) #define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge) #define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge) int main() { lint N, M; long double K; cin >> N >> M >> K; char op; cin >> op; vectorB(M); rep(i, M) { cin >> B[i]; } vectorA(N); rep(i, N) { cin >> A[i]; } sort(A); sort(B); int cnt = 0; if (op == '+') { rep(i, N) { cnt += B.end() - lower(B, K - A[i]); } cout << cnt << endl; } else if (op == '*') { rep(i, N) { cnt += B.end() - lower(B, K / A[i]); } cout << cnt << endl; } }