#include <bits/stdc++.h>
using namespace std;
int n, m;
const int MAXN = 100010;
int x;
vector<pair<int, int> > v;
long long ans;
int ok[MAXN];
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &x);
    v.push_back(make_pair(x, i + 1));
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", &x);
    v.push_back(make_pair(x, i + 1));
  }
  scanf("%d", &m);
  sort(v.begin(), v.end());
  ans = 1;
  for (int i = 0; i < v.size(); ++i) {
    int j = i;
    while (i < v.size() && v[i].first == v[j].first) ++i;
    int x = i - j;
    --i;
    long long a = 0;
    for (int k = j; k <= i; ++k) {
      ++ok[v[k].second];
      if (ok[v[k].second] == 2) ++a;
    }
    for (int k = j; k <= i; ++k) ok[v[k].second] = 0;
    long long add = 1;
    for (int i = 1; i <= x; ++i) {
      int p = i;
      if (p % 2 == 0 && a) {
        while (p % 2 == 0 && a && p) --a, p /= 2;
      }
      add = (add * p) % m;
    }
    ans = (ans * add) % m;
  }
  cout << (ans % m) << endl;
}
