#include #include #include #include #include #include #include #include using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, m, k; cin >> n >> m >> k; char op; cin >> op; vector b(m); for (int j = 0; j < m; j++) { cin >> b[j]; } sort(b.begin(), b.end(), greater<>()); vector a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a.begin(), a.end()); ll r = 0; int j = 0; for (int i = 0; i < n; i++) { while (j < m) { ll t = op == '+' ? a[i] + b[j] : (ll)a[i] * b[j]; if (t < k) break; j++; } r += j; } cout << r << endl; return 0; }