#include using namespace std; using ll = long long; int main(){ cin.tie(0); ios::sync_with_stdio(0); ll n, m, k; cin >> n >> m >> k; string op; cin >> op; vector a(n), b(m); for(int i = 0; i < m; ++i) cin >> b[i]; for(int i = 0; i < n; ++i) cin >> a[i]; sort(b.begin(), b.end()); ll ans = 0; if(op == "+"){ for(int i = 0; i < n; ++i){ ll x = k-a[i]; ll cnt = lower_bound(b.begin(), b.end(), x)-b.begin(); cnt = m-cnt; ans += cnt; } }else{ for(int i = 0; i < n; ++i){ ll x = (k+a[i]-1)/a[i]; ll cnt = lower_bound(b.begin(), b.end(), x)-b.begin(); cnt = m-cnt; ans += cnt; } } cout << ans << '\n'; return 0; }