#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
const int MAXR = 1;
const int MAXC = 1;
const int MAXBITS = 64;
const int INF = (int)1e9;
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, 1, 0, -1};
int dx8[] = {-1, -1, -1, 0, 0, 1, 1, 1};
int dy8[] = {-1, 0, 1, -1, 1, -1, 0, 1};
priority_queue<int, vector<int>, greater<int>> q1;
priority_queue<int, vector<int>, less<int>> q2;
void l() { ; }
vector<pair<int, int>> memo2(MAXN + 2);
pair<int, int> getFact2(int x) { return memo2[x]; }
pair<pair<int, int>, int> getNum(vector<pair<int, int>> &v, int st, int en,
                                 int m) {
  ;
  int len = (en - st + 1);
  pair<int, int> numerator = getFact2(len);
  ;
  int i = st;
  vector<int> cv;
  while (i <= en) {
    int st2 = i;
    int x = v[st2].second;
    while (i <= en && v[i].second == x) {
      i++;
    }
    int en2 = i - 1;
    cv.push_back(en2 - st2 + 1);
  };
  long long int denom = 0;
  for (int j = 0; j < cv.size(); ++j) {
    if (cv[j] == 2) {
      denom++;
    }
  };
  int denominator = denom;
  return make_pair(numerator, denominator);
}
void initMemo(int m) {
  memo2[0] = make_pair(0, 1);
  memo2[1] = make_pair(0, 1);
  int cnt = 0;
  for (int i = 2; i < MAXN; ++i) {
    int ic = i;
    while (ic > 0 && ic % 2 == 0) {
      ic = ic / 2;
      cnt++;
    }
    long long int f = ((1LL * ic) * memo2[i - 1].second) % m;
    memo2[i] = make_pair(cnt, f);
  }
}
long long int fpw(long long int a, long long int b, long long int m) {
  ;
  if (b == 0) return 1;
  long long int al = a;
  long long int a2 = (al * al) % m;
  long long int mres = fpw(a2, b / 2, m);
  if (b % 2 != 0) {
    mres *= a;
  }
  mres %= m;
  return mres;
}
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n;
  vector<int> a(n), b(n);
  vector<pair<int, int>> v(2 * n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    v[i] = make_pair(a[i], i + 1);
  }
  for (int i = 0; i < n; ++i) {
    cin >> b[i];
    v[i + n] = make_pair(b[i], i + 1);
  };
  ;
  cin >> m;
  initMemo(m);
  l();
  l();
  ;
  sort((v).begin(), (v).end());
  ;
  vector<pair<pair<int, int>, int>> num;
  int i = 0;
  int vn = v.size();
  while (i < vn) {
    l();
    int st = i;
    int x = v[st].first;
    while (i < vn && v[i].first == x) {
      i++;
    }
    int en = i - 1;
    pair<pair<int, int>, int> cnum = getNum(v, st, en, m);
    num.push_back(cnum);
  };
  long long int u, d, nu;
  u = d = 0;
  nu = 1;
  for (int j = 0; j < num.size(); ++j) {
    nu = (nu * (1LL * num[j].first.second)) % m;
    u += num[j].first.first;
    d += num[j].second;
  };
  long long int p2 = fpw(2, u - d, m);
  ;
  long long int ans = (p2 * nu) % m;
  cout << ans;
  return 0;
}
