#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int maxn = 1e5 + 5;
ll fact[maxn];
int main() {
  int n, m;
  cin >> n;
  ll duplicates = 0;
  vector<int> a(n), b(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  cin >> m;
  map<int, int> freq;
  for (int i = 0; i < n; i++) {
    freq[a[i]]++;
    freq[b[i]]++;
    if (a[i] == b[i]) duplicates++;
  }
  ll ans = 1;
  for (auto elem : freq) {
    int j = elem.second;
    for (int i = 2; i <= j; i++) {
      int k = i;
      while (duplicates && k % 2 == 0) {
        k /= 2;
        duplicates--;
      }
      ans = ans * k;
      ans %= m;
    }
  }
  cout << ans;
  return 0;
}
