#include using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define req(i,n) for(int i = 1;i <= n; i++) #define rrep(i,n) for(ll i = n-1;i >= 0;i--) #define ALL(obj) begin(obj), end(obj) #define RALL(a) rbegin(a),rend(a) typedef long long ll; typedef long double ld; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } const ll INF = 1e18; ll mod = 1e9+7; int main(){ ll n,m,k;char c;cin >>n>>m>>k>>c; vector a(n),b(m); rep(i,m) cin >> b[i]; rep(i,n)cin >> a[i]; sort(ALL(a));sort(ALL(b)); int ans = 0; if(c=='+'){ rep(i,n) ans += b.end()-lower_bound(ALL(b),k-a[i]); }else { rep(i,n) { int ok = 0,ng = m-1; while(ng-ok>1){ int mid=(ok+ng)/2; if(a[i]*b[mid] < k) ok = mid; else ng = mid; }ans += m-ng; } }cout << ans << endl; }