#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n, m, k;
  cin >> n >> m >> k;
  vector<int> a(n + 1), b(m + 1);
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < m; ++i) cin >> b[i];
  a[n] = 0;
  b[m] = 0;
  n += 1;
  m += 1;
  vector<int> divs;
  for (int i = 1; i * i <= k; ++i)
    if (k % i == 0) {
      divs.push_back(i);
      if (i * i != k) divs.push_back(k / i);
    }
  sort(divs.begin(), divs.end());
  ;
  long long ma[40111] = {0};
  int curr = 0;
  for (int i = 0; i < n; ++i) {
    if (a[i] == 1) {
      ++curr;
    }
    if (a[i] == 0) {
      for (int d : divs) {
        if (curr < d) break;
        ma[d] += curr - d + 1;
      }
      curr = 0;
    }
  }
  long long ans = 0;
  curr = 0;
  for (int i = 0; i < m; ++i) {
    if (b[i] == 1) {
      ++curr;
    };
    if (b[i] == 0 && 0 < curr) {
      for (int d : divs) {
        if (curr < d) break;
        if (k / d <= n) {
          ;
          ans += ma[k / d] * (curr - d + 1);
        }
      }
      curr = 0;
    }
  }
  cout << ans << "\n";
  return 0;
}
