#include using namespace std; //repetition #define FOR(i,a,b) for(ll i=(a);i<(b);++i) #define rep(i, n) for(ll i = 0; i < (ll)(n); i++) //container util #define all(x) (x).begin(),(x).end() //typedef typedef long long ll; typedef vector VI; typedef vector VVI; typedef vector VLL; typedef vector VVLL; typedef vector VS; typedef pair PII; typedef pair PLL; //const value //const ll MOD = 1e9 + 7; //const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1}; //const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1}; //conversion inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;} inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;} template inline string toString(T x) {ostringstream sout;sout<=mod) x-=mod; return *this;} mint& operator-=(const mint& a){ if((x+=mod-a.x)>=mod) x-=mod; return *this;} mint& operator*=(const mint& a){ (x*=a.x)%=mod; return *this;} mint operator+(const mint& a)const{ return mint(*this) += a;} mint operator-(const mint& a)const{ return mint(*this) -= a;} mint operator*(const mint& a)const{ return mint(*this) *= a;} bool operator<(const mint& a)const{ return x < a.x;} bool operator==(const mint& a)const{ return x == a.x;} }; istream& operator>>(istream&i,mint&a){i>>a.x;return i;} ostream& operator<<(ostream&o,const mint&a){o< vm; typedef vector vvm; // int main(){ ios::sync_with_stdio(false); cin.tie(0); char cmd; int n,m; ll k; cin >> m >> n >> k; cin >> cmd; VLL x(n); VLL y(m); rep(i,n) cin >> x[i]; rep(i,m) cin >> y[i]; sort(all(x)); sort(all(y)); if(cmd == '+'){ ll ans = 0; VLL yy; yy.push_back(-1e12); rep(i,m) yy.push_back(y[i]); rep(i,n) { ll less = k-x[i]; if(less <= 0) { ans += m; continue; } ll outCnt = (lower_bound(all(yy),less) - yy.begin()) - 1; ans += m - outCnt ; } cout << ans << endl; }else{ ll ans = 0; VLL yy; yy.push_back(-1e12); rep(i,m) yy.push_back(y[i]); rep(i,n) { if(x[i] >= k) { ans += m; continue; } ll less = (k+x[i]-1)/x[i]; ll outCnt = (lower_bound(all(yy),less) - yy.begin()) - 1; ans += m - outCnt ; } cout << ans << endl; } return 0; }