#include #include #include using namespace std; #define REP(i,m,n) for(int i=(m);i<(n);i++) #define rep(i,n) REP(i,0,n) #define pb push_back #define all(a) a.begin(),a.end() #define rall(c) (c).rbegin(),(c).rend() #define mp make_pair #define double long double typedef long long ll; typedef pair pii; typedef pair pll; typedef vector vec; typedef vector mat; const ll inf=1e9+7; const ll mod=1e9+7; int main(){ ll n,m,k;cin>>n>>m>>k; vectora(n),b(m); char c;cin>>c; bool f=c=='+'; rep(i,m)cin>>b[i]; rep(i,n)cin>>a[i]; sort(all(a)); sort(all(b)); ll ans=0; if(f){ rep(i,n){ auto itr=lower_bound(all(b),k-a[i]); ans+=b.end()-itr; } }else{ rep(i,n){ auto itr=lower_bound(all(b),(k-1)/a[i]+1); ans+=b.end()-itr; } } cout<