#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  vector<pair<int, int> > p;
  for (int i = 1; i <= sqrt(k); i++) {
    if (k % i == 0) {
      p.push_back(make_pair(i, k / i));
      if (k / i != i) {
        p.push_back(make_pair(k / i, i));
      }
    }
  }
  long long int res = 0;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<int> b(m);
  for (int i = 0; i < m; i++) cin >> b[i];
  for (int i = 0; i < p.size(); i++) {
    int n1 = p[i].first;
    int m1 = p[i].second;
    int d = 0;
    int k1 = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] == 1)
        d++;
      else
        d = 0;
      if (d >= n1) k1++;
    }
    d = 0;
    int k2 = 0;
    for (int j = 0; j < m; j++) {
      if (b[j] == 1)
        d++;
      else
        d = 0;
      if (d >= m1) k2++;
    }
    res += (k1 * k2);
  }
  cout << res << endl;
}
