#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, m, p;
  cin >> n >> m >> p;
  vector<int> arr(n), brr(m);
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int i = 0; i < m; i++) cin >> brr[i];
  int i = 0, j = 0;
  while (arr[i] % p == 0) i++;
  while (brr[j] % p == 0) j++;
  cout << i + j << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  return 0;
}
