#include <bits/stdc++.h>
using namespace std;
const int N = 1000;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  long long int k;
  cin >> n >> m >> k;
  int now = 0, tmp;
  vector<int> a, b;
  for (int i = (0); i < (n); i++) {
    cin >> tmp;
    if (tmp)
      now++;
    else if (now)
      a.push_back(now), now = 0;
  }
  if (now) a.push_back(now);
  now = 0;
  for (int i = (0); i < (m); i++) {
    cin >> tmp;
    if (tmp)
      now++;
    else if (now)
      b.push_back(now), now = 0;
  }
  if (now) b.push_back(now);
  vector<long long int> aa(40087, 0), bb(40087, 0);
  for (int i : a) {
    int k = i;
    while (i) {
      aa[i] += k - i + 1;
      i--;
    }
  }
  for (int i : b) {
    int k = i;
    while (i) {
      bb[i] += k - i + 1;
      i--;
    }
  }
  long long int ans = 0;
  for (int i = 1; i * i <= k; ++i) {
    if (k % i) continue;
    if (k / i >= 40087 or i >= 40087) continue;
    ans += 1ll * aa[i] * bb[k / i];
    if (i * i != k) ans += 1ll * aa[k / i] * bb[i];
  }
  cout << ans << endl;
}
