#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
struct Node {
  long long x;
  long long y;
};
vector<Node> v;
int a[maxn];
int b[maxn];
int main() {
  long long n, m, k;
  v.clear();
  cin >> n >> m >> k;
  memset(a, 0, sizeof(a));
  memset(b, 0, sizeof(b));
  vector<long long> ve;
  vector<long long> vv;
  for (long long i = 1; i * i <= k; ++i) {
    if (k % i) {
      ve.push_back(i);
    } else {
      v.push_back({i, k / i});
      if (i * i != k) v.push_back({k / i, i});
    }
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &a[i]);
    if (a[i] == 1) {
      a[i] += a[i - 1];
    }
  }
  for (int i = 1; i <= m; ++i) {
    scanf("%lld", &b[i]);
    if (b[i] == 1) {
      b[i] += b[i - 1];
    }
  }
  long long now = 0;
  for (int k = 0; k < v.size(); ++k) {
    long long x = 0, y = 0;
    for (int i = v[k].x; i <= n; i++) {
      if (v[k].x <= a[i]) {
        x++;
      }
    }
    for (int i = v[k].y; i <= m; i++) {
      if (v[k].y <= b[i]) {
        y++;
      }
    }
    now = now + x * y;
  }
  printf("%lld\n", now);
}
