#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int a[N];
int b[N];
long long sumA[N];
long long sumB[N];
void solve() {
  long long n, m, k;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= m; ++i) cin >> b[i];
  int now = 0;
  for (int i = 1; i <= n; ++i) {
    if (a[i] == 0) {
      for (int i = 1; i <= now; ++i) {
        sumA[i] += (now - i + 1);
      }
      now = 0;
    } else {
      now++;
    }
  }
  for (int i = 1; i <= now; ++i) {
    sumA[i] += (now - i + 1);
  }
  now = 0;
  for (int i = 1; i <= m; ++i) {
    if (b[i] == 0) {
      for (int i = 1; i <= now; ++i) {
        sumB[i] += (now - i + 1);
      }
      now = 0;
    } else {
      now++;
    }
  }
  for (int i = 1; i <= now; ++i) {
    sumB[i] += (now - i + 1);
  }
  long long ans = 0;
  for (int i = 1; i <= n; ++i) {
    if (k % i) continue;
    long long j = k / i;
    if (j > m) continue;
    ans += sumA[i] * sumB[j];
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  int T = 1;
  while (T--) {
    solve();
  }
  return 0;
}
