#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
pair<int, int> p[2 * N];
int M, n, x, len;
long long res = 1;
void calc(int l, int r) {
  int cnt = 0;
  for (int i = l; i < r;) {
    int ptr = i;
    while (ptr < r && p[i].second == p[ptr].second) ptr++;
    if (ptr - i == 2) cnt++;
    i = ptr;
  }
  for (int i = 2; i <= r - l; i++) {
    if (cnt > 0 && i % 2 == 0) {
      res = (res * (i / 2)) % M;
      cnt--;
    } else
      res = (res * i) % M;
  }
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x;
    p[len++] = make_pair(x, i + 1);
  }
  for (int i = 0; i < n; i++) {
    cin >> x;
    p[len++] = make_pair(x, i + 1);
  }
  cin >> M;
  sort(p, p + len);
  for (int i = 0; i < len;) {
    int r = i;
    while (r < len && p[i].first == p[r].first) r++;
    calc(i, r);
    i = r;
  }
  cout << res;
  return 0;
}
