#include <bits/stdc++.h>
using namespace std;
vector<long long> get_1(vector<int> a) {
  int n = a.size();
  vector<long long> kq(n + 1);
  int i = 0;
  while (i < n) {
    if (a[i] == 0) {
      ++i;
      continue;
    }
    int j = i;
    while (j < n && a[j] == 1) ++j;
    for (int len = 1; len <= j - i; ++len) kq[len] += j - i - len + 1;
    i = j;
  }
  return kq;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int n, m;
  long long k;
  cin >> n >> m >> k;
  vector<int> a(n), b(m);
  for (int &x : a) cin >> x;
  for (int &x : b) cin >> x;
  long long res = 0;
  vector<long long> g1a = get_1(a);
  vector<long long> g1b = get_1(b);
  for (int i = 1; i < (int)g1a.size(); ++i) {
    if ((k % i) == 0 && k / i <= m) res += g1a[i] * g1b[k / i];
  }
  cout << res;
  return 0;
}
