#include <bits/stdc++.h>
using namespace std;
long long n, m, o, p, x, y, z, k;
vector<long long> a, b, c, d;
long long giveConsec(vector<long long> arr, int size, int k) {
  long long consec = 0;
  long long curr = 0;
  for (long long i = 0; i < size; i++) {
    if (arr[i] == 1)
      curr++;
    else {
      consec += max((long long)0, curr - k + 1);
      curr = 0;
    }
  }
  consec += max((long long)0, curr - k + 1);
  return consec;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m >> k;
  a = vector<long long>(n, 0);
  ;
  b = vector<long long>(m, 0);
  ;
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < m; i++) cin >> b[i];
  long long fAns = 0;
  for (int i = 1; i <= sqrt(k); i++) {
    if (k % i == 0) {
      long long aC = giveConsec(a, n, i);
      long long bC = giveConsec(b, m, k / i);
      long long ans = aC * bC;
      if (i != k / i) {
        aC = giveConsec(a, n, k / i);
        bC = giveConsec(b, m, i);
        ans += aC * bC;
      }
      fAns += ans;
    }
  }
  cout << fAns << endl;
  return 0;
}
