#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef pair P; typedef pair Pid; typedef pair Pdi; typedef pair Pl; typedef pair> PP; const double PI = 3.1415926535897932; // acos(-1) const double EPS = 1e-15; const int INF = 1001001001; const int mod = 1e+9 + 7; #define chmax(x, y) x = max(x, y) #define chmin(x, y) x = min(x, y) #define chadd(x, y) x = (x + y) % mod int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n, m; ll k; char op; cin >> n >> m >> k >> op; vector b(m); for(int i = 0; i < m; ++i) cin >> b[i]; vector a(n); for(int i = 0; i < n; ++i) cin >> a[i]; sort(b.begin(), b.end()); ll res = 0; if(op == '+'){ for(int i = 0; i < n; ++i){ res += b.end() - lower_bound(b.begin(), b.end(), k - a[i]); } } else{ for(int i = 0; i < n; ++i){ ll comparision = ceil((double)k / a[i]); res += b.end() - lower_bound(b.begin(), b.end(), comparision); } } cout << res << endl; }