#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; const ll mod = 1000000007; const ll INF = (1e+18) + 7; #define rep(i,n) for(int i=0;i=0;i--) #define all(x) (x).begin(),(x).end() #define stop char nyaa;cin>>nyaa; using P = pair; using LP = pair; int h, w; ll x; ll a[1 << 17], b[1 << 17]; void solvep() { sort(b, b + w); ll ans = 0; rep(i, h) { ans += b+w - lower_bound(b, b + w, x - a[i]); } cout << ans << endl; } void solvem() { sort(b, b + w); ll ans = 0; rep(i, h) { ll inf = (x + a[i] - 1) / a[i]; ans += b + w - lower_bound(b, b + w, inf); } cout << ans << endl; } void solve() { cin >> h >> w>>x; char c; cin >> c; rep(j, w)cin >> b[j]; rep(i, h)cin >> a[i]; if (c == '+') { solvep(); } else { solvem(); } } signed main() { cin.tie(0); ios::sync_with_stdio(false); //int t; cin >> t;rep(i,t) solve(); solve(); stop return 0; }