#include <bits/stdc++.h>
const long long N = 4e5 + 7;
using namespace std;
long long n, m, k;
long long a[N], b[N];
long long fa[N], fb[N];
void getfa(long long f[], long long a[], long long n) {
  long long res = 0;
  for (long long i = 1; i <= n; i++) {
    if (i == 1 && a[i] == 1)
      res = 1;
    else if (a[i] == 1 && a[i - 1] == 1)
      res++;
    else if (a[i] == 1 && a[i - 1] == 0)
      res = 1;
    else {
      for (long long j = 1; j <= res; j++) f[j] += res - (j - 1);
      res = 0;
    }
  }
  for (long long j = 1; j <= res; j++) f[j] += res - (j - 1);
}
signed main() {
  cin >> n >> m >> k;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  for (long long j = 1; j <= m; j++) cin >> b[j];
  getfa(fa, a, n);
  getfa(fb, b, m);
  long long res = 0;
  for (long long i = 1; i <= min(k, n); i++) {
    if (k % i == 0 && i <= n && k / i <= m) res += fa[i] * fb[k / i];
  }
  cout << res << endl;
}
