#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, m;
long long k, ans;
int cnt[N], cnt2[N], a[N], b[N];
void calc(int* a, int* cnt, int n) {
  memset(cnt, 0, sizeof cnt);
  int last = -1;
  a[n + 1] = 0;
  for (int i = 1; i <= n + 1; i++) {
    if (last == -1 && a[i])
      last = i;
    else if (last != -1 && !a[i]) {
      for (int j = last; j < i; j++) cnt[i - j] += j - last + 1;
      last = -1;
    }
  }
}
int main() {
  scanf("%d %d %I64d", &n, &m, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= m; i++) scanf("%d", &b[i]);
  calc(a, cnt, n);
  calc(b, cnt2, m);
  for (int i = 1; i * i <= k; i++)
    if (k % i == 0) {
      if (i <= n && k / i <= m) ans += (long long)cnt[i] * cnt2[k / i];
      if (i != k / i && k / i <= n && i <= m)
        ans += (long long)cnt[k / i] * cnt2[i];
    }
  printf("%I64d\n", ans);
  return 0;
}
