#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, m, k;
  cin >> n >> m >> k;
  map<long long, long long> cnt1, cnt2;
  vector<long long> 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];
  }
  long long run = 0;
  for (long long i = 0; i < n; i++) {
    if (a[i] == 0) {
      if (run) {
        cnt1[run]++;
        run = 0;
      }
    } else {
      run++;
    }
  }
  if (run) {
    cnt1[run]++;
  }
  run = 0;
  for (long long i = 0; i < m; i++) {
    if (b[i] == 0) {
      if (run) {
        cnt2[run]++;
        run = 0;
      }
    } else {
      run++;
    }
  }
  if (run) {
    cnt2[run]++;
  }
  long long ans = 0;
  for (long long i = 1; i * i <= k; i++) {
    if (k % i == 0) {
      long long j = k / i;
      auto it1 = cnt1.lower_bound(i);
      auto it2 = cnt2.lower_bound(j);
      while (it1 != cnt1.end()) {
        auto it3 = it2;
        long long x = (it1->first - i + 1) * it1->second;
        while (it3 != cnt2.end()) {
          long long y = (it3->first - j + 1) * it3->second;
          ans += x * y;
          it3++;
        }
        it1++;
      }
      if (i != j) {
        it1 = cnt1.lower_bound(j);
        it2 = cnt2.lower_bound(i);
        while (it1 != cnt1.end()) {
          auto it3 = it2;
          long long x = (it1->first - j + 1) * it1->second;
          while (it3 != cnt2.end()) {
            long long y = (it3->first - i + 1) * it3->second;
            ans += x * y;
            it3++;
          }
          it1++;
        }
      }
    }
  }
  cout << ans;
  return 0;
}
