#include <bits/stdc++.h>
using namespace std;
int n, m, k;
int a[40008], b[40008];
long long cnta[40008], cntb[40008];
long long suma[40008], sumb[40008];
int main() {
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (int i = 1; i <= m; ++i) scanf("%d", &b[i]);
  long long c = 0;
  for (int i = 1; i <= n + 1; ++i) {
    if (a[i])
      c++;
    else {
      if (c) {
        cnta[c]++;
      }
      c = 0;
    }
  }
  c = 0;
  for (int i = 1; i <= m + 1; ++i) {
    if (b[i])
      c++;
    else {
      if (c) {
        cntb[c]++;
      }
      c = 0;
    }
  }
  long long cur = 0;
  for (int i = n; i >= 1; --i) {
    cur += cnta[i];
    suma[i] = suma[i + 1] + cur;
  }
  cur = 0;
  for (int i = m; i >= 1; --i) {
    cur += cntb[i];
    sumb[i] = sumb[i + 1] + cur;
  }
  long long ans = 0;
  for (int i = 1; i <= n; ++i) {
    if (k % i || k / i > m) continue;
    ans += suma[i] * sumb[k / i];
  }
  cout << ans << endl;
}
