#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m, k;
  cin >> n >> m >> k;
  long long a[n + 1], b[m + 1];
  vector<pair<long long, long long>> v;
  for (long long i = 1; i * i <= k; i++) {
    if (k % i == 0) {
      v.push_back({i, k / i});
      if (i != k / i) v.push_back({k / i, i});
    }
  }
  for (long long i = 1; i <= n; i++) cin >> a[i];
  for (long long i = 1; i <= m; i++) cin >> b[i];
  long long i = 1;
  map<long long, long long> cc, cr;
  while (i <= m) {
    if (b[i] == 1) {
      long long h = 0;
      while (i <= m && b[i] == 1) {
        h++;
        i++;
      }
      cc[h]++;
    } else
      i++;
  }
  i = 1;
  while (i <= n) {
    if (a[i] == 1) {
      long long h = 0;
      while (i <= n && a[i] == 1) {
        h++;
        i++;
      }
      cr[h]++;
    } else
      i++;
  }
  long long ans = 0;
  for (auto it = cr.begin(); it != cr.end(); it++) {
    for (auto it2 = cc.begin(); it2 != cc.end(); it2++) {
      long long h = 0;
      long long x = it->first;
      long long y = it2->first;
      for (long long i = 0; i < v.size(); i++) {
        long long p = v[i].first, q = v[i].second;
        long long l = max(0LL, x - p + 1);
        long long r = max(0LL, y - q + 1);
        h += (l * r * cr[x] * cc[y]);
      }
      ans += (h);
    }
  }
  cout << ans << "\n";
}
