#include <bits/stdc++.h>
using namespace std;
bool findi(vector<int> vv, int u) {
  for (int x : vv)
    if (x == u) return true;
  return false;
}
bool check(long long x, long long y, long long a, long long b) {
  if (b < x || a > y) return false;
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, m, k;
  cin >> n >> m >> k;
  int aa[n];
  int bb[m];
  for (int i = 0; i < n; i++) cin >> aa[i];
  for (int i = 0; i < m; i++) cin >> bb[i];
  vector<long long> cc;
  vector<long long> dd;
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (aa[i] == 0 && cnt > 0) {
      cc.push_back(cnt);
      cnt = 0;
    } else if (aa[i])
      cnt++;
  }
  if (cnt) cc.push_back(cnt);
  cnt = 0;
  for (int i = 0; i < m; i++) {
    if (bb[i] == 0 && cnt > 0) {
      dd.push_back(cnt);
      cnt = 0;
    } else if (bb[i])
      cnt++;
  }
  if (cnt) dd.push_back(cnt);
  long long ans = 0;
  dd.push_back(0);
  sort(dd.begin(), dd.end());
  int sz = dd.size();
  long long aq[sz];
  aq[0] = dd[0];
  for (int i = 1; i < sz; i++) aq[i] = aq[i - 1] + dd[i];
  int sz2 = cc.size();
  long long on = 1;
  for (long long i = 1; i * i <= k; i++) {
    if (k % i == 0) {
      for (int j = 0; j < sz2; j++) {
        if (cc[j] - i + 1 > 0) {
          long long val1 =
              lower_bound(dd.begin(), dd.end(), k / i) - dd.begin();
          long long sm = aq[sz - 1] - (val1 > 0 ? aq[val1 - 1] : (long long)0);
          long long cn = sz - val1;
          ans += (cc[j] - i + on) * (sm - cn * (k / i) + cn);
        }
        if (i != (k / i) && cc[j] - (k / i) + 1 > 0) {
          long long val1 = lower_bound(dd.begin(), dd.end(), i) - dd.begin();
          long long sm = aq[sz - 1] - (val1 > 0 ? aq[val1 - 1] : (long long)0);
          long long cn = sz - val1;
          ans += (cc[j] - (k / i) + on) * (sm + cn * (on - i));
        }
      }
    }
  }
  cout << ans << endl;
}
