#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  long long n, m, k;
  cin >> n >> m >> k;
  long long a[n];
  long long b[m];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long i = 0; i < m; i++) {
    cin >> b[i];
  }
  set<long long> divs;
  for (long long i = 1; i <= sqrt(k); i++) {
    if (k % i == 0) {
      if (k / i == i) {
        divs.insert(i);
      } else {
        divs.insert(i);
        divs.insert(k / i);
      }
    }
  }
  vector<long long> ones;
  vector<long long> twos;
  long long l = 0;
  for (long long i = 0; i < n; i++) {
    if (a[i] == 0) {
      if (l != 0) {
        ones.push_back(l);
      }
      l = 0;
    } else {
      l++;
    }
  }
  if (l != 0) {
    ones.push_back(l);
  }
  l = 0;
  for (long long i = 0; i < m; i++) {
    if (b[i] == 0) {
      if (l != 0) {
        twos.push_back(l);
      }
      l = 0;
    } else {
      l++;
    }
  }
  if (l != 0) {
    twos.push_back(l);
  }
  map<long long, long long> m1;
  map<long long, long long> m2;
  for (auto it = divs.begin(); it != divs.end(); it++) {
    for (long long i = 0; i < ones.size(); i++) {
      if (*it > ones[i]) {
      } else {
        auto it1 = m1.find(*it);
        if (it1 == m1.end()) {
          m1[*it] = ones[i] - *it + 1;
        } else {
          m1[*it] += ones[i] - *it + 1;
        }
      }
    }
    for (long long i = 0; i < twos.size(); i++) {
      if (*it > twos[i]) {
      } else {
        auto it1 = m2.find(*it);
        if (it1 == m2.end()) {
          m2[*it] = twos[i] - *it + 1;
        } else {
          m2[*it] += twos[i] - *it + 1;
        }
      }
    }
  }
  l = 0;
  long long ans = 0;
  for (auto it = divs.begin(); it != divs.end(); it++) {
    long long cur = *it;
    long long tofind = k / cur;
    auto it1 = m1.find(tofind);
    auto it2 = m2.find(cur);
    long long add = 0;
    if (it1 != m1.end() && it2 != m2.end()) {
      add += it1->second * it2->second;
    }
    ans += add;
  }
  cout << ans;
  return 0;
}
