/* -*- coding: utf-8 -*- * * 989.cc: No.989 N×Mマス計算(K以上) - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ const int MAX_N = 100000; const int MAX_M = 100000; /* typedef */ typedef long long ll; /* global variables */ int as[MAX_N], bs[MAX_M]; /* subroutines */ /* main */ int main() { int n, m, k; scanf("%d%d%d", &n, &m, &k); char s[4]; scanf("%s", s); char op = s[0]; int asum = 0, bsum = 0; for (int j = 0; j < m; j++) scanf("%d", bs + j); for (int i = 0; i < n; i++) scanf("%d", as + i); sort(bs, bs + m); ll sum = 0; for (int i = 0; i < n; i++) { int ka = (op == '+') ? k - as[i] : k / as[i]; int l = lower_bound(bs, bs + m, ka) - bs; sum += m - l; } printf("%lld\n", sum); return 0; }