#include <bits/stdc++.h>
using namespace std;
ifstream in("272d.in");
ofstream out("272d.out");
struct xy {
  int x, y;
};
const int N = 100010;
xy a[2 * N];
int vis[N];
int cmp(xy p, xy q) {
  if (p.x < q.x || (p.x == q.x && p.y < q.y))
    return 1;
  else
    return 0;
}
int main() {
  int n, i, j, m, doub = 0, ans = 1;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i].x;
    a[i].y = i;
  }
  for (i = 0; i < n; i++) {
    cin >> a[i + n].x;
    a[i + n].y = i;
  }
  cin >> m;
  sort(a, a + 2 * n, cmp);
  a[2 * n].x = 1000000001;
  int la = 0;
  vis[a[0].y]++;
  for (i = 1; i <= 2 * n; i++) {
    if (a[i].x != a[i - 1].x) {
      for (j = 1; j <= i - la; j++) {
        int k = j;
        if (doub && (j & 1) == 0) {
          k = k / 2;
          doub--;
        }
        ans = (long long)ans * k % m;
      }
      for (j = la; j < i; j++) vis[a[j].y]--;
      la = i;
    }
    vis[a[i].y]++;
    if (vis[a[i].y] == 2) doub++;
  }
  cout << ans << endl;
}
