#include <bits/stdc++.h>
using namespace std;
int n, m, cur1, cur2, cur3, fac[40010];
long long ans, k, hang[40010], lie[40010];
int main() {
  scanf("%d%d%lld", &n, &m, &k);
  for (int i = 1; i * i <= k; i++) {
    if (k % i == 0) {
      fac[++cur1] = i;
      if (i != k / i) {
        fac[++cur1] = k / i;
      }
    }
  }
  for (int i = 1; i <= n; i++) scanf("%lld", hang + i);
  for (int i = 1; i <= m; i++) scanf("%lld", lie + i);
  for (int i = 1; i <= cur1; i++) {
    int a = fac[i], b = k / a, l1 = 0, cn1 = 0, cn2 = 0;
    for (int j = 1; j <= n; j++) {
      long long tmp = hang[j];
      if (tmp) {
        l1++;
        if (l1 >= a) cn1++;
      } else
        l1 = 0;
    }
    l1 = 0;
    for (int j = 1; j <= m; j++) {
      long long tmp = lie[j];
      if (tmp) {
        l1++;
        if (l1 >= b) cn2++;
      } else
        l1 = 0;
    }
    ans += (long long)cn1 * cn2;
  }
  printf("%lld\n", ans);
  return 0;
}
