#include <bits/stdc++.h>
using namespace std;
inline void fastio() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
signed main() {
  fastio();
  long long n, m, p;
  cin >> n >> m >> p;
  vector<long long> a(n), b(m);
  for (auto &i : a) cin >> i;
  for (auto &i : b) cin >> i;
  long long x, y;
  for (long long i = (0); i < (n); i++) {
    if (a[i] % p) {
      x = i;
      break;
    }
  }
  for (long long i = (0); i < (m); i++) {
    if (b[i] % p) {
      y = i;
      break;
    }
  }
  cout << x + y;
}
