#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll inf = 1000000001, INF = (ll)1e18 + 1;
const int maxn = 1e6;
int n, m;
vector<int> a, b;
pair<ll, ll> fact[maxn];
ll power(ll a, ll b) {
  ll result = 1;
  while (b) {
    if (b % 2) result = (result * a) % m;
    a = (a * a) % m;
    b /= 2;
  }
  return result;
}
void precalc() {
  fact[0].first = 1;
  fact[0].second = 0;
  for (int i = 1; i < maxn; i++) {
    int d = i;
    fact[i].second = fact[i - 1].second;
    while (d % 2 == 0) {
      fact[i].second++;
      d /= 2;
    }
    (fact[i].first = fact[i - 1].first * d) %= m;
  }
}
void solve() {
  map<int, int> u;
  for (int i = 0; i < n; i++) {
    u[a[i]]++;
    u[b[i]]++;
  }
  ll ans = 1, cntws = 0;
  for (auto i : u) {
    (ans *= fact[i.second].first) %= m;
    cntws += fact[i.second].second;
  }
  for (int i = 0; i < n; i++)
    if (a[i] == b[i]) cntws--;
  (ans *= power(2, cntws)) %= m;
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  a.resize(n), b.resize(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  cin >> m;
  precalc();
  solve();
  return 0;
}
