#include <bits/stdc++.h>
using namespace std;
const int SIZE = 4e4 + 10;
int a[SIZE], b[SIZE];
int s[SIZE], t[SIZE];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= m; i++) cin >> b[i];
  int sum = 0;
  for (int i = 1; i <= n; i++) {
    s[1]++, s[sum + 1]--;
    if (a[i] == 0)
      sum = 0;
    else
      sum++;
  }
  s[1]++;
  s[sum + 1]--;
  sum = 0;
  for (int i = 1; i <= m; i++) {
    t[1]++, t[sum + 1]--;
    if (b[i] == 0)
      sum = 0;
    else
      sum++;
  }
  t[1]++;
  t[sum + 1]--;
  sum = 0;
  for (int i = 1; i <= n + 5; i++) s[i] += s[i - 1];
  for (int i = 1; i <= m + 5; i++) t[i] += t[i - 1];
  long long ans = 0;
  for (int i = 1; i * i <= k; i++) {
    if (k % i) continue;
    if (i * i == k && i <= n && i <= m) {
      ans += s[i] * t[i];
      continue;
    }
    if (k / i <= m) ans += s[i] * t[k / i];
    if (k / i <= n) ans += s[k / i] * t[i];
  }
  cout << ans;
  return 0;
}
