#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N;
  vector<int> A(N), B(N);
  map<int, map<int, int> > m;
  for (int j = 0; j < 2; j++)
    for (int i = 0; i < N; i++) {
      int x;
      cin >> x;
      m[x][i + 1] += 1;
    }
  cin >> M;
  long long int ans = 1;
  for (auto p : m) {
    int total = 0, cnt = 0;
    for (auto x : p.second) {
      total += x.second;
      if (x.second == 2) cnt += 1;
    }
    long long int curr = 1;
    for (int i = 1; i <= total; i++) {
      if (i % 2 == 0 && cnt > 0) {
        curr = curr * (i / 2) % M;
        cnt -= 1;
      } else
        curr = curr * i % M;
    }
    ans = ans * curr % M;
  }
  cout << ans << endl;
  return 0;
}
