#include <bits/stdc++.h>
using namespace std;
int read() {
  int res = 0, f = 1;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-') f = -1, c = getchar();
  while (isdigit(c)) res = (res << 3) + (res << 1) + (c ^ 48), c = getchar();
  return res * f;
}
const int maxn = 4e4 + 10;
int n, m, k, a[maxn], b[maxn], r[maxn], c[maxn];
long long ans;
void work(int u, int v) {
  int x = 0, y = 0;
  for (int i = u; i <= n; i++) x += r[i] * (i - u + 1);
  for (int i = v; i <= m; i++) y += c[i] * (i - v + 1);
  ans += x * y;
}
int main() {
  n = read();
  m = read();
  k = read();
  int x = 0, flag = 0;
  for (int i = 1; i <= n + 1; i++) {
    a[i] = i > n ? 0 : read();
    if (a[i] == 0 && flag) r[i - x]++, flag = 0;
    if (a[i] == 1 && !flag) x = i, flag = 1;
  }
  x = 0, flag = 0;
  for (int i = 1; i <= m + 1; i++) {
    b[i] = i > m ? 0 : read();
    if (b[i] == 0 && flag) c[i - x]++, flag = 0;
    if (b[i] == 1 && !flag) x = i, flag = 1;
  }
  int top = sqrt(k);
  for (int i = 1; i <= top; i++)
    if (k % i == 0) {
      work(i, k / i);
      if (i * i != k) work(k / i, i);
    }
  printf("%I64d\n", ans);
  return 0;
}
