#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, m, k;
  cin >> n >> m >> k;
  vector<long long> a(n), b(m);
  for (long long& i : a) {
    cin >> i;
  }
  for (long long& i : b) {
    cin >> i;
  }
  vector<long long> factorize;
  for (long long i = 1; i * i <= k; i++) {
    if (!(k % i)) {
      factorize.push_back(i);
      if (i * i < k) factorize.push_back(k / i);
    }
  }
  sort(factorize.begin(), factorize.end());
  vector<long long> result(factorize.size(), 0);
  long long counter = 0, value = 0;
  for (long long i = 0; i < n; i++) {
    if (a[i] == 1)
      counter++;
    else if (counter) {
      for (long long j = 0; j < factorize.size(); j++) {
        result[j] +=
            (counter - factorize[j] + 1 < 0 ? 0 : counter - factorize[j] + 1);
      }
      counter = 0;
    }
  }
  if (counter) {
    for (long long j = 0; j < factorize.size(); j++) {
      result[j] +=
          (counter - factorize[j] + 1 < 0 ? 0 : counter - factorize[j] + 1);
    }
    counter = 0;
  }
  for (long long i = 0; i < m; i++) {
    if (b[i] == 1)
      counter++;
    else if (counter) {
      for (long long j = 0; j < factorize.size(); j++) {
        value +=
            (counter - factorize[j] + 1 < 0 ? 0 : counter - factorize[j] + 1) *
            result[factorize.size() - j - 1];
      }
      counter = 0;
    }
  }
  if (counter) {
    for (long long j = 0; j < factorize.size(); j++) {
      value +=
          (counter - factorize[j] + 1 < 0 ? 0 : counter - factorize[j] + 1) *
          result[factorize.size() - j - 1];
    }
    counter = 0;
  }
  cout << value;
}
