#include <bits/stdc++.h>
using namespace std;
long long n, m, k;
long long a[40005], b[40005];
long long coa[40005], cob[40005];
void calc(long long *ar, long long *co, long long length) {
  long long h = 1, t = 1;
  while (!ar[h] && h <= length) h++;
  while (h <= length) {
    t = h;
    while (ar[t]) t++;
    co[(t - h)]++;
    h = t;
    while (!ar[h] && h <= length) h++;
  }
  return;
}
void fd(long long *co, long long length) {
  long long now = length, cot = 0, pre = 0;
  long long sum = 0;
  while (now && !co[now]) now--;
  sum = co[now], cot = co[now], pre = now;
  now--;
  while (now > 0) {
    sum += co[now];
    sum += cot * (pre - now);
    cot += co[now];
    co[now] = sum;
    pre = now;
    now--;
  }
  return;
}
int main() {
  scanf("%I64d%I64d%I64d", &n, &m, &k);
  for (long long i = 1; i <= n; i++) scanf("%I64d", &a[i]);
  for (long long i = 1; i <= m; i++) scanf("%I64d", &b[i]);
  calc(a, coa, n);
  calc(b, cob, m);
  fd(coa, n);
  fd(cob, m);
  long long ans = 0;
  for (long long i = 1; i <= n; i++) {
    if (k % i == 0 && k / i <= m) ans += coa[i] * cob[k / i];
  }
  printf("%I64d", ans);
  return 0;
}
