#include <bits/stdc++.h>
using namespace std;
int n, m, k, a[40005], b[40005], y[40005] = {0}, x[40005] = {0}, cou = 0;
int main() {
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] == 1) {
      cou++;
    }
    if (a[i] == 0 || i == n - 1) {
      for (int j = 1; j <= cou; j++) {
        x[j] += cou - j + 1;
      }
      cou = 0;
    }
  }
  cou = 0;
  for (int i = 0; i < m; i++) {
    cin >> b[i];
    if (b[i] == 1) {
      cou++;
    }
    if (b[i] == 0 || i == m - 1) {
      for (int j = 1; j <= cou; j++) {
        y[j] += cou - j + 1;
      }
      cou = 0;
    }
  }
  long long ans = 0;
  for (long long i = 1; i * i <= k; i++) {
    if (k % i == 0 && i * i != k) {
      if (i <= n && k / i <= m) ans += x[i] * y[k / i];
      if (i <= m && k / i <= n) ans += x[k / i] * y[i];
    }
    if (i * i == k) {
      if (i <= n && i <= m) ans += x[i] * y[k / i];
    }
  }
  cout << ans;
  return 0;
}
