#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;
int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  ull n, m, k;
  cin >> n >> m >> k;
  vector<ull> a;
  ull acc = 0;
  for (ull i = 0; i < n; ++i) {
    ull tmp;
    cin >> tmp;
    if (tmp == 1) {
      ++acc;
    } else {
      if (acc != 0) {
        a.emplace_back(acc);
        acc = 0;
      }
    }
  }
  if (acc != 0) {
    a.emplace_back(acc);
  }
  vector<ull> b;
  acc = 0;
  for (ull i = 0; i < m; ++i) {
    ull tmp;
    cin >> tmp;
    if (tmp == 1) {
      ++acc;
    } else {
      if (acc != 0) {
        b.emplace_back(acc);
        acc = 0;
      }
    }
  }
  if (acc != 0) {
    b.emplace_back(acc);
  }
  vector<ull> l;
  for (ull i = 1; i * i <= k; ++i) {
    if (k % i == 0) {
      l.emplace_back(i);
    }
  }
  sort(a.begin(), a.end());
  vector<pair<ull, ull>> aa;
  int idx = -1;
  for (int i = 0; i < (int)a.size(); ++i) {
    if (idx < 0 || aa[idx].first != a[i]) {
      aa.emplace_back(a[i], 1);
      ++idx;
    } else {
      aa[idx].second += 1;
    }
  }
  sort(b.begin(), b.end());
  vector<pair<ull, ull>> bb;
  idx = -1;
  for (int i = 0; i < (int)b.size(); ++i) {
    if (idx < 0 || bb[idx].first != b[i]) {
      bb.emplace_back(b[i], 1);
      ++idx;
    } else {
      bb[idx].second += 1;
    }
  }
  ull cnt = 0;
  for (auto& aaa : aa) {
    for (auto& bbb : bb) {
      for (auto ll : l) {
        if (aaa.first >= ll && bbb.first >= (k / ll)) {
          cnt += ((aaa.first - ll + 1) * (bbb.first - (k / ll) + 1)) *
                 (aaa.second * bbb.second);
        }
        if (ll * ll != k) {
          if (aaa.first >= (k / ll) && bbb.first >= ll) {
            cnt += (aaa.first - (k / ll) + 1) * (bbb.first - ll + 1) *
                   (aaa.second * bbb.second);
          }
        }
      }
    }
  }
  cout << cnt << '\n';
  return EXIT_SUCCESS;
}
