#include <bits/stdc++.h>
using namespace std;
vector<pair<long long int, long long int> > get_factor(long long int k) {
  vector<pair<long long int, long long int> > v;
  for (long long int i = 1; i <= sqrt(k); i++) {
    if (k % i == 0) {
      v.push_back({i, k / i});
    }
  }
  return v;
}
void solve() {
  long long int n, m, k;
  cin >> n >> m >> k;
  long long int a[n], b[m];
  for (long long int i = 0; i < n; i++) cin >> a[i];
  for (long long int i = 0; i < m; i++) cin >> b[i];
  vector<pair<long long int, long long int> > v = get_factor(k);
  vector<long long int> p, q;
  long long int c = 0;
  for (long long int i = 0; i < n; i++) {
    if (a[i] == 1)
      c++;
    else {
      if (c) p.push_back(c);
      c = 0;
    }
  }
  if (c) p.push_back(c);
  c = 0;
  for (long long int i = 0; i < m; i++) {
    if (b[i] == 1)
      c++;
    else {
      if (c) q.push_back(c);
      c = 0;
    }
  }
  if (c) q.push_back(c);
  sort(p.begin(), p.end());
  sort(q.begin(), q.end());
  long long int ans = 0;
  for (auto ll : v) {
    long long int l = ll.first, r = ll.second;
    long long int i = 0, j = 0;
    for (auto t : p) {
      i += max(t - l + 1, 0LL);
    }
    for (auto t : q) {
      j += max(t - r + 1, 0LL);
    }
    ans += i * j;
    if (l == r) continue;
    i = 0;
    j = 0;
    for (auto t : q) {
      i += max(t - l + 1, 0LL);
    }
    for (auto t : p) {
      j += max(t - r + 1, 0LL);
    }
    ans += i * j;
  }
  cout << ans;
  cout << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
