#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
void solve() {
  long long n, m, k;
  cin >> n >> m >> k;
  bool a[n], b[m];
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < m; i++) cin >> b[i];
  vector<pair<long long, long long> > v;
  for (long long i = 1; i * i <= k; ++i) {
    if (k % i == 0) {
      v.push_back(make_pair(i, k / i));
    }
  }
  long long c = 0;
  vector<long long> c_a(n + 1, 0), c_b(m + 1, 0);
  for (long long i = 0; i < n; i++) {
    if (a[i]) {
      ++c;
      for (long long j = c; j > 0; --j) c_a[j]++;
    } else {
      c = 0;
    }
  }
  c = 0;
  for (long long i = 0; i < m; i++) {
    if (b[i]) {
      ++c;
      for (long long j = c; j > 0; --j) c_b[j]++;
    } else {
      c = 0;
    }
  }
  long long sm = 0;
  for (auto i : v) {
    if (i.first != i.second) {
      if (i.first <= n && i.second <= m) sm += c_a[i.first] * c_b[i.second];
      if (i.first <= m && i.second <= n) sm += c_a[i.second] * c_b[i.first];
    } else if (i.first <= n && i.second <= m)
      sm += c_a[i.first] * c_b[i.second];
  }
  cout << sm;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  for (long long i = 0; i < t; i++) {
    solve();
  }
  return 0;
}
