#include <bits/stdc++.h>
using namespace std;
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int WHITE = 0, GRAY = 1, BLACK = 2, GREEN = 3, BLUE = 4;
const int LIM = 1e+6, LIM1 = 1e+3;
const long long INF = 1e+9, MOD = 1e+9 + 7;
const double PI = 3.141592653589793, EPS = 1e-7;
long long n, m, ans = 1, f[LIM];
pair<long long, long long> a[LIM], b[LIM], c[LIM];
map<long long, long long> size_equal, size;
map<long long, set<long long> > uniq;
set<long long> x;
long long count__(long long x, long long cnt_equal, long long size) {
  long long res = 1;
  vector<long long> del, not_del;
  for (long long i = 1; i <= size; i++) {
    if (cnt_equal > 0 && i % 2 == 0) {
      long long d = i;
      while (d % 2 == 0 && cnt_equal > 0) {
        d /= 2;
        cnt_equal--;
      }
      del.push_back(d);
    } else {
      not_del.push_back(i);
    }
  }
  for (auto i : del) {
    res *= i;
    res %= m;
  }
  res %= m;
  for (auto i : not_del) {
    res *= i;
    res %= m;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> a[i].first;
    x.insert(a[i].first);
    a[i].second = i;
  }
  for (long long i = 0; i < n; i++) {
    cin >> b[i].first;
    x.insert(b[i].first);
    b[i].second = i;
  }
  cin >> m;
  for (long long i = 0; i < n; i++) {
    size[a[i].first]++;
    if (uniq[a[i].first].find(a[i].second) != uniq[a[i].first].end()) {
      size_equal[a[i].first]++;
    } else {
      uniq[a[i].first].insert(a[i].second);
    }
  }
  for (long long i = 0; i < n; i++) {
    size[b[i].first]++;
    if (uniq[b[i].first].find(b[i].second) != uniq[b[i].first].end()) {
      size_equal[b[i].first]++;
    } else {
      uniq[b[i].first].insert(b[i].second);
    }
  }
  for (auto i : x) {
    ans *= count__(i, size_equal[i], size[i]);
    ans %= m;
  }
  cout << ans;
  return 0;
}
