#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>
void DEBUG(string label, T value) {
  cerr << "[" << label << " = " << value << "]\n";
}
vector<long long> get_vec(vector<int> &a) {
  int i = 0;
  vector<long long> ret(a.size() + 1);
  while (i < a.size()) {
    while (i < a.size() && a[i] == 0) i++;
    if (i == a.size()) break;
    int j = i + 1;
    while (j < a.size() && a[j] == a[i]) {
      j++;
    }
    int len = j - i;
    for (int k = 1; k <= len; ++k) {
      ret[k] += len - k + 1;
    }
    i = j;
  }
  return ret;
}
void solve() {
  int n, m;
  long long k;
  cin >> n >> m >> k;
  vector<int> a(n), b(m);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i < m; ++i) {
    cin >> b[i];
  }
  vector<long long> ga = get_vec(a);
  vector<long long> gb = get_vec(b);
  long long ans = 0;
  for (long long i = 1; i * i <= k; ++i) {
    if (k % i != 0) continue;
    long long j = k / i;
    if (i < ga.size() && j < gb.size()) {
      ans += 1LL * ga[i] * gb[j];
    }
    if (i != j && j < ga.size() && i < gb.size()) {
      ans += 1LL * ga[j] * gb[i];
    }
  }
  cout << ans << endl;
}
int main(int argv, char **argc) {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
}
