#include #include int asc(const void* a, const void* b) { if (*(long long int*)a < * (long long int*)b)return 1; if (*(long long int*)a > *(long long int*)b)return -1; return 0; } int main() { long long int n, m, k; scanf("%lld %lld %lld", &n, &m, &k); char op; scanf(" %c", &op); long long int i; long long int a[100005], b[100005]; for (i = 0; i < m; i++) scanf("%lld", &b[i]); for (i = 0; i < n; i++) scanf("%lld", &a[i]); qsort(b, m, sizeof(long long int), asc); long long int ans = 0; long long int min, mid, max; for (i = 0; i < n; i++) { min = -1; max = m; while (max - min > 1) { mid = (max + min) / 2; if (op == '+') { if (a[i] + b[mid] < k) max = mid; else min = mid; } else { if (a[i] * b[mid] < k) max = mid; else min = mid; } } ans += max; } printf("%lld\n", ans); return 0; }