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