#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m, k;
  cin >> n >> m >> k;
  long long int a[n + 1];
  long long int b[m + 1];
  for (long long int i = 1; i <= n; ++i) cin >> a[i];
  for (long long int i = 1; i <= m; i++) cin >> b[i];
  long long int aa[n + 1], bb[m + 1];
  memset(aa, 0, sizeof(aa));
  memset(bb, 0, sizeof(bb));
  for (long long int i = 1; i <= n; i++) {
    if (a[i] == 1) {
      long long int c = 0;
      while (i <= n && a[i] == 1) c++, aa[c]++, i++;
    }
  }
  for (long long int i = 1; i <= m; i++) {
    if (b[i] == 1) {
      long long int c = 0;
      while (i <= m && b[i] == 1) c++, bb[c]++, i++;
    }
  }
  for (long long int i = n - 1; i > 0; i--) aa[i] += aa[i + 1];
  for (long long int i = m - 1; i > 0; i--) bb[i] += bb[i + 1];
  long long int ans = 0;
  for (long long int i = 1; i <= n; i++) {
    if (k % i == 0 && k / i <= m) ans = ans + aa[i] * bb[k / i];
  }
  cout << ans << endl;
}
