#include <bits/stdc++.h>
using namespace std;
int max(int a, int b) {
  if (a >= b)
    return a;
  else
    return b;
}
int min(int a, int b) {
  if (a <= b)
    return a;
  else
    return b;
}
bool primecheck(int n) {
  if (n == 1) return false;
  if (n == 2 || n == 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (int i = 6; i <= sqrt(n); i += 6) {
    if (n % (i - 1) == 0) return false;
    if (n % (i + 1) == 0) return false;
  }
  return true;
}
long long mod = 1e9 + 7;
vector<long long> sequonce(vector<int> a) {
  int n = a.size(), i = 0, j;
  vector<long long> r(n + 1);
  while (i < n) {
    if (a[i] == 0) {
      i++;
      continue;
    }
    j = i;
    while (j < n && a[j] == 1) j++;
    for (int len = 1; len <= j - i; len++) r[len] += j - i - len + 1;
    i = j;
  }
  return r;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  long long k, ans = 0;
  cin >> n >> m >> k;
  vector<int> a(n);
  vector<int> b(m);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) cin >> b[i];
  auto ga = sequonce(a);
  auto gb = sequonce(b);
  for (int i = 1; i < ga.size(); i++)
    if (k % i == 0 && k / i <= m) ans += ga[i] * gb[k / i];
  cout << ans;
}
