#include <bits/stdc++.h>
using namespace std;
const int N = 50001;
int n, m, k;
int a[N][2];
long long cnt[N][2];
long long ans;
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> m >> k;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i][0];
  }
  for (int i = 1; i <= m; ++i) {
    cin >> a[i][1];
  }
  for (int t = 0; t < 2; ++t) {
    int s = !t ? n : m;
    for (int l = 1; l <= s;) {
      if (a[l][t] == 0) {
        ++l;
        continue;
      }
      int r = l;
      while (r + 1 <= s && a[r + 1][t] == 1) {
        ++r;
      }
      for (int j = 1; j <= r - l + 1; ++j) {
        cnt[j][t] += (r - l + 1) - j + 1;
      }
      l = r + 1;
    }
  }
  for (int i = 1; i <= min(k, n); ++i) {
    if (k % i == 0 && k / i <= m) {
      ans += cnt[i][0] * cnt[k / i][1];
    }
  }
  cout << ans;
  return 0;
}
