#include <bits/stdc++.h>
using namespace std;
char buf[1 << 21], *p1 = buf, *p2 = buf;
template <class T>
void read(T &x) {
  x = 0;
  int c = getchar();
  int flag = 0;
  while (c < '0' || c > '9') flag |= (c == '-'), c = getchar();
  while (c >= '0' && c <= '9')
    x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  if (flag) x = -x;
}
template <class T>
T _max(T a, T b) {
  return b < a ? a : b;
}
template <class T>
T _min(T a, T b) {
  return a < b ? a : b;
}
template <class T>
bool checkmax(T &a, T b) {
  return a < b ? a = b, 1 : 0;
}
template <class T>
bool checkmin(T &a, T b) {
  return b < a ? a = b, 1 : 0;
}
const int N = 200005;
int n, x, tot = 0, mod;
pair<int, int> a[N];
int num = 0, ans = 1;
int two[N], f[N];
vector<int> w;
void mul(int &a, int b) { a = (long long)a * b % mod; }
void init() {
  read(n);
  for (int i = 1; i <= n; ++i) read(x), a[++tot] = make_pair(x, i);
  for (int i = 1; i <= n; ++i) read(x), a[++tot] = make_pair(x, i);
  sort(a + 1, a + tot + 1);
  read(mod);
  for (int i = 1; i <= tot; ++i) {
    int t = i;
    while (t % 2 == 0) t /= 2, ++two[i];
    f[i] = t;
  }
  for (int i = 2; i <= tot; ++i) mul(f[i], f[i - 1]), two[i] += two[i - 1];
}
void calc(int l, int r) {
  mul(ans, f[r - l + 1]);
  num += two[r - l + 1];
  for (int i = l; i <= r;) {
    int j = i;
    while (j < r && a[i] == a[j + 1]) ++j;
    if (i < j) --num;
    i = j + 1;
  }
}
void solve() {
  for (int i = 1; i <= tot;) {
    int j = i;
    while (j < tot && a[j + 1].first == a[i].first) ++j;
    calc(i, j);
    i = j + 1;
  }
  for (int i = 1; i <= num; ++i) mul(ans, 2);
  printf("%d\n", ans);
}
int main() {
  init();
  solve();
  return 0;
}
