#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, m, k;
  cin >> n >> m >> k;
  vector<long long> a(n), b(m);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < m; i++) {
    cin >> b[i];
  }
  vector<long long> suma(50004), sumb(50004);
  long long idx1 = 0, idx2 = 0;
  while (idx1 < n) {
    idx2 = idx1;
    while (idx2 < n) {
      if (a[idx2] == 0) {
        break;
      }
      idx2++;
    }
    long long c = 1;
    for (int i = idx2 - idx1; i > 0; i--) {
      suma[i] += c;
      c++;
    }
    idx1 = idx2 + 1;
  }
  idx1 = 0, idx2 = 0;
  while (idx1 < m) {
    idx2 = idx1;
    while (idx2 < m) {
      if (b[idx2] == 0) {
        break;
      }
      idx2++;
    }
    long long c = 1;
    for (int i = idx2 - idx1; i > 0; i--) {
      sumb[i] += c;
      c++;
    }
    idx1 = idx2 + 1;
  }
  long long res = 0;
  for (long long i = 1; i * i <= k; i++) {
    if (k % i == 0) {
      if (max(i, k / i) <= max(n, m)) {
        res = res + (suma[i] * sumb[k / i]);
        if (i * i != k) res = res + (suma[k / i] * sumb[i]);
      }
    }
  }
  cout << res << "\n";
  return;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
