#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k;
  long long res = 0;
  cin >> n >> m >> k;
  map<int, long long> dp;
  bool arr[n + 1], s[m + 1];
  for (int i = 0; i < n; i++) cin >> arr[i];
  arr[n] = 0;
  for (int i = 0; i < m; i++) cin >> s[i];
  s[m] = 0;
  int ones = 0;
  for (int i = 0; i < n + 1; i++) {
    if (arr[i])
      ones++;
    else if (ones) {
      if (dp.find(ones) != dp.end()) {
        res += dp[ones];
        ones = 0;
        continue;
      }
      int tones = 0;
      long long dpres = 0;
      long long prev = 0;
      for (int j = 0; j < m + 1; j++) {
        if (s[j]) {
          tones++;
          dpres += prev;
          if (k % tones == 0 && tones * ones >= k) {
            dpres += ones - (k / tones) + 1;
            prev += ones - (k / tones) + 1;
          }
        } else {
          tones = 0;
          prev = 0;
        }
      }
      dp[ones] = dpres;
      res += dpres;
      ones = 0;
    }
  }
  cout << res;
  return 0;
}
