#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long N = 1e5 + 5;
map<long long, long long> freq, freq2;
void func1(long long a[], long long n) {
  int i = 0, j = 0;
  while (i < n) {
    if (a[i] == 0) {
      i++;
      continue;
    }
    j = i;
    while (j < n && a[j] != 0) {
      j++;
    }
    for (int p = 1; p <= (j - i); p++) {
      freq[p] += (j - i) - p + 1;
    }
    i = j;
  }
}
void func2(long long a[], long long n) {
  int i = 0, j = 0;
  while (i < n) {
    if (a[i] == 0) {
      i++;
      continue;
    }
    j = i;
    while (j < n && a[j] != 0) {
      j++;
    }
    for (int p = 1; p <= (j - i); p++) {
      freq2[p] += (j - i) - p + 1;
    }
    i = j;
  }
}
int main() {
  long long n, a[N], b[N], r = 0, c = 0, ans = 0, cnt = 0, sum = 0, k, m;
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) cin >> b[i];
  func1(a, n);
  func2(b, m);
  for (int p = 1; p <= sqrt(k); p++) {
    if (k % p == 0) {
      ans += freq[p] * freq2[k / p];
      if (p != (k / p)) ans += freq[k / p] * freq2[p];
    }
  }
  cout << ans;
  return 0;
}
