#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100010;
int n, m;
int a[MAXN], b[MAXN];
pair<int, int> c[2 * MAXN];
int mult(int *a, int b) {
  int c2 = 0;
  while (b % 2 == 0) b /= 2, ++c2;
  *a = ((long long)(*a) * b) % m;
  return c2;
}
int main() {
  cin >> n;
  int ans = 1;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    c[i] = make_pair(a[i], i + 1);
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    c[n + i] = make_pair(b[i], i + 1);
  }
  cin >> m;
  sort(c, c + 2 * n);
  for (int i = 1; i < 2 * n; i++) {
    int fac = 1, cn = 1, c2 = 0;
    while (c[i].first == c[i - 1].first) {
      if (c[i].second != c[i - 1].second) {
        c2 += mult(&fac, ++cn);
      } else
        c2 += mult(&fac, ++cn) - 1;
      i++;
    }
    ans = ((long long)ans * fac) % m;
    for (int j = 0; j < c2; j++) ans = (ans * 2) % m;
  }
  cout << ans << '\n';
  return 0;
}
