#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long rand_seed() {
  long long a = rng();
  return a;
}
vector<pair<int, int> > v;
long long fact[300002], p2[300002], pw[300002];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n;
  for (int i = 1; i <= n + n; ++i) {
    int x;
    cin >> x;
    v.push_back({x, i - n * (i > n)});
  }
  sort(v.begin(), v.end());
  cin >> m;
  fact[0] = 1;
  pw[0] = 1;
  for (int i = 1; i <= 300000; ++i) {
    int x = i;
    while (x % 2 == 0) x /= 2, ++p2[i];
    fact[i] = (fact[i - 1] * x) % m;
    p2[i] += p2[i - 1];
    pw[i] = pw[i - 1] + pw[i - 1];
    pw[i] %= m;
  }
  long long ans = 1;
  for (int i = 0; i < v.size();) {
    int j = i;
    int x = 0;
    set<int> s;
    int rp = 0;
    while (j < v.size() && v[j].first == v[i].first) {
      if (s.find(v[j].second) != s.end()) ++rp;
      s.insert(v[j].second);
      ++j, ++x;
    }
    ans = ans * fact[x];
    ans %= m;
    ans = ans * pw[p2[j - i] - rp];
    ans %= m;
    i = j;
  }
  cout << ans;
  return 0;
}
