#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int a[maxn], b[maxn], c[maxn];
long long fun(int n, int m, int k) {
  int i, t = 0;
  for (i = 1; i * i <= k; i++) {
    int x = k % i;
    if (x == 0) {
      c[t++] = i;
      if (i * i == k) continue;
      c[t++] = k / i;
    }
  }
  int num = 0, j = 0;
  long long x, y, sum = 0;
  for (i = 0; i < t; i++) {
    x = 0;
    y = 0;
    num = 0;
    for (j = 0; j < n; j++) {
      num = (a[j] != 1 ? 0 : num + 1);
      if (c[i] == num) {
        x++;
        num--;
      }
    }
    num = 0;
    for (j = 0; j < m; j++) {
      num = (b[j] != 1 ? 0 : num + 1);
      if (k / c[i] == num) {
        y++, num--;
      }
    }
    sum += x * y;
  }
  return sum;
}
int main() {
  long long d;
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < m; i++) scanf("%d", &b[i]);
  d = fun(n, m, k);
  printf("%lld", d);
  return 0;
}
