#include <bits/stdc++.h>
using namespace std;
using namespace std;
vector<long long> util(vector<long long> v) {
  long long siz = v.size();
  vector<long long> res(siz + 1);
  long long i = 0;
  while (i < siz) {
    while (v[i] == 0) {
      ++i;
      continue;
    }
    long long j = i;
    while (v[j] == 1) ++j;
    for (long long len = 1; len <= j - i; len++) {
      res[len] += j - i - len + 1;
    }
    i = j;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long n, m, k;
  cin >> n >> m >> k;
  vector<long long> a(n), b(m);
  for (int i = 0; i < int(n); i++) cin >> a[i];
  for (int i = 0; i < int(m); i++) cin >> b[i];
  long long ans = 0;
  auto arr = util(a);
  auto brr = util(b);
  for (long long i = 1; i <= arr.size() - 1; i++) {
    if (k % i == 0 && k / i <= m) {
      ans += arr[i] * brr[k / i];
    }
  }
  cout << ans << "\n";
  return 0;
}
