#include <bits/stdc++.h>
using namespace std;
const int N = 5e4;
int arr1[N], arr2[N];
long long count1(int d, int n) {
  if (d > n) return 0;
  long long ans = 0;
  int cur = 0;
  for (int i = 0; i < n; i++) {
    if (arr1[i])
      cur++;
    else {
      ans += (cur >= d ? cur - d + 1 : 0);
      cur = 0;
    }
  }
  ans += (cur >= d ? cur - d + 1 : 0);
  return ans;
}
long long count2(int d, int n) {
  if (d > n) return 0;
  long long ans = 0;
  int cur = 0;
  for (int i = 0; i < n; i++) {
    if (arr2[i])
      cur++;
    else {
      ans += (cur >= d ? cur - d + 1 : 0);
      cur = 0;
    }
  }
  ans += (cur >= d ? cur - d + 1 : 0);
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(10);
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) cin >> arr1[i];
  for (int i = 0; i < m; i++) cin >> arr2[i];
  long long ans = 0;
  for (int i = 1; i * i <= k; i++) {
    if (k % i == 0) {
      int div1 = i, div2 = k / i;
      ans += count1(div1, n) * count2(div2, m);
      if (div1 != div2) ans += count1(div2, n) * count2(div1, m);
    }
  }
  cout << ans << endl;
  return 0;
}
