#include <bits/stdc++.h>
using namespace std;
const int MAXN = 40000 + 10;
int a[MAXN], b[MAXN], suma[MAXN], sumb[MAXN], n, m, k;
inline void init(void) {
  scanf("%d%d%d", &n, &m, &k);
  for (register int i = 1; i <= n; ++i)
    scanf("%d", &a[i]), suma[i] = suma[i - 1] + a[i];
  for (register int i = 1; i <= m; ++i)
    scanf("%d", &b[i]), sumb[i] = sumb[i - 1] + b[i];
}
inline int calc(int sum[], int n, int len) {
  int ret = 0;
  for (register int i = len; i <= n; ++i)
    if (sum[i] - sum[i - len] == len) ret++;
  return ret;
}
long long ans;
inline void work(void) {
  for (register int i = 1; i * i <= k; ++i) {
    if (k % i) continue;
    int u = i, v = k / i;
    ans += 1ll * calc(suma, n, u) * calc(sumb, m, v);
    if (i * i == k) continue;
    ans += 1ll * calc(suma, n, v) * calc(sumb, m, u);
  }
  printf("%lld", ans);
}
int main() {
  init();
  work();
  return 0;
}
