#include <bits/stdc++.h>
using namespace std;
int ns[40010], ms[40010];
int main() {
  long long int n, m, k, sqk, tmp, ans = 0, x, y, nit, mit;
  cin >> n >> m >> k;
  sqk = sqrt(k);
  x = 0;
  nit = 0;
  for (int i = 0; i < n; i++) {
    cin >> tmp;
    if (tmp == 1) {
      x++;
    } else if (x > 0) {
      ns[nit++] = x;
      x = 0;
    }
  }
  if (x > 0) {
    ns[nit++] = x;
    x = 0;
  }
  x = 0;
  mit = 0;
  for (int i = 0; i < m; i++) {
    cin >> tmp;
    if (tmp == 1) {
      x++;
    } else if (x > 0) {
      ms[mit++] = x;
      x = 0;
    }
  }
  if (x > 0) {
    ms[mit++] = x;
    x = 0;
  }
  for (int i = 1; i <= sqk; i++) {
    if (k % i == 0) {
      x = 0;
      y = 0;
      for (int j = 0; j < nit; j++) {
        if (ns[j] - i + 1 > 0) x += ns[j] - i + 1;
      }
      for (int j = 0; j < mit; j++) {
        if (ms[j] - k / i + 1 > 0) y += ms[j] - k / i + 1;
      }
      ans += x * y;
      x = 0;
      y = 0;
      for (int j = 0; j < nit; j++) {
        if (k / i != i && ns[j] - k / i + 1 > 0) x += ns[j] - k / i + 1;
      }
      for (int j = 0; j < mit; j++) {
        if (k / i != i && ms[j] - i + 1 > 0) y += ms[j] - i + 1;
      }
      ans += x * y;
    }
  }
  cout << ans;
  return 0;
}
