#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, p, x, ans = 0, mk = 0;
  scanf("%d%d%d", &n, &m, &p);
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    if (x % p != 0 && mk == 0) ans += i, mk = 1;
  }
  mk = 0;
  for (int i = 0; i < m; i++) {
    scanf("%d", &x);
    if (x % p != 0 && mk == 0) ans += i, mk = 1;
    ;
  }
  printf("%d\n", ans);
  return 0;
}
