#include <bits/stdc++.h>
using namespace std;
long long n, m, k, a[200100], b[200100], cnt1[200100], cnt2[200100], res, p1,
    p2, q1, q2;
int main() {
  cin >> n >> m >> k;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    if (a[i]) a[i] += a[i - 1];
  }
  for (long long i = 1; i <= m; i++) {
    cin >> b[i];
    if (b[i]) b[i] += b[i - 1];
  }
  for (long long i = 1; i <= n; i++)
    if (k % i == 0) {
      p1 = i;
      p2 = k / i;
      q1 = q2 = 0;
      for (int j = 1; j <= n; j++)
        if (a[j] >= p1) q1++;
      for (int j = 1; j <= m; j++)
        if (b[j] >= p2) q2++;
      res += q1 * q2;
    }
  cout << res << endl;
}
