#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const double err = 1e-12;
const double PI = 3.141592653589793;
const int N = 1e5 + 5;
int n, m;
vector<int> A(N), B(N);
unordered_map<int, int> cnt;
void solve() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> A[i];
  for (int i = 0; i < n; i++) cin >> B[i];
  cin >> m;
  int pairs = 0, ans = 1;
  for (int i = 0; i < n; i++) {
    if (A[i] == B[i]) pairs++;
    cnt[A[i]]++;
    cnt[B[i]]++;
  }
  for (auto p : cnt) {
    for (int i = 1; i < p.second + 1; i++) {
      int t = i;
      while (pairs > 0 && t % 2 == 0) {
        t /= 2;
        pairs--;
      }
      ans = ((long long)ans * (long long)t) % m;
    }
  }
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int T = 1;
  while (T--) solve();
  return 0;
}
