#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) {
    int n, m, k;
    cin >> n >> m >> k;
    vector<long long> a(n + 1), pref_a(n + 1);
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
      pref_a[i] = pref_a[i - 1] + a[i];
    }
    vector<long long> b(m + 1), pref_b(m + 1);
    for (int i = 1; i <= m; i++) {
      cin >> b[i];
      pref_b[i] = pref_b[i - 1] + b[i];
    }
    vector<int> divs;
    for (int i = 1; i * 1ll * i <= k; i++) {
      if (k % i == 0) {
        divs.push_back(i);
        if (k / i != i) {
          divs.push_back(k / i);
        }
      }
    }
    long long ans = 0;
    for (int x : divs) {
      int y = k / x;
      int lin = 0, col = 0;
      for (int i = x; i <= n; i++) {
        if (pref_a[i] - pref_a[i - x] == x) {
          lin++;
        }
      }
      for (int i = y; i <= m; i++) {
        if (pref_b[i] - pref_b[i - y] == y) {
          col++;
        }
      }
      ans += lin * col;
    }
    cout << ans << '\n';
  }
  return 0;
}
