#include using ll = long long; using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll n, m, k; string op; cin >> n >> m >> k >> op; vector va(n), vb(m); for (int i = 0; i < m; ++i) cin >> vb[i]; for (int i = 0; i < n; ++i) cin >> va[i]; sort(va.begin(), va.end()); ll res{ 0 }; if (op == "+") { for (int i = 0; i < m; ++i) { vector::iterator it = lower_bound(va.begin(), va.end(), k - vb[i]); res += distance(it, va.end()); } } else { for (int i = 0; i < m; ++i) { vector::iterator it = lower_bound(va.begin(), va.end(), (k + vb[i] - 1) / vb[i]); res += distance(it, va.end()); } } cout << res << "\n"; return 0; }