#include <bits/stdc++.h>
using namespace std;
const int maxn = 4e4 + 7;
const long long INF = 1e12;
const long long mod = 1e9 + 7;
int a[maxn], b[maxn];
long long vis1[maxn], vis2[maxn];
int main() {
  int n, m;
  long long k;
  while (~scanf("%d%d%lld", &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]);
    a[n + 1] = b[m + 1] = 0;
    memset(vis1, 0, sizeof(vis1));
    memset(vis2, 0, sizeof(vis2));
    int res = 0;
    int i = 1;
    for (int i = 1; i <= n + 1; i++) {
      if (a[i] == 1) {
        res++;
      } else {
        int len = res;
        for (int j = 1; j <= len; j++) {
          vis1[j] += res--;
        }
      }
    }
    for (int i = 1; i <= m + 1; i++) {
      if (b[i] == 1) {
        res++;
      } else {
        int len = res;
        for (int j = 1; j <= len; j++) {
          vis2[j] += res--;
        }
      }
    }
    long long ans = 0;
    for (long long i = 1; i * i <= k; i++) {
      if (k % i == 0) {
        if (i <= n && k / i <= m) {
          ans += vis1[i] * vis2[k / i];
        }
        if (i <= m && k / i <= n) {
          ans += vis1[k / i] * vis2[i];
        }
        if (i == k / i && i <= m && i <= n) {
          ans -= vis1[i] * vis2[i];
        }
      }
    }
    printf("%lld\n", ans);
  }
  return 0;
}
