#include <bits/stdc++.h>
using namespace std;
long long int n, m;
pair<long long int, long long int> p[200005];
bool comparison(const pair<long long int, long long int> &p1,
                const pair<long long int, long long int> &p2) {
  if (p1.first < p2.first) {
    return true;
  } else if (p1.first == p2.first) {
    return (p1.second < p2.second);
  }
  return false;
}
int main() {
  long long int i, j, a, b, c, ans;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a;
    p[i].first = a, p[i].second = i;
  }
  for (i = 1; i <= n; i++) {
    cin >> a;
    p[i + n].first = a, p[i + n].second = i;
  }
  cin >> m;
  sort(&p[1], &p[2 * n + 1], comparison);
  ans = 1;
  for (i = 1; i <= 2 * n; i++) {
    j = i + 1;
    a = 1;
    b = 0;
    while ((j <= 2 * n) && (p[j].first == p[i].first)) {
      if (p[j].second == p[j - 1].second) {
        b++;
      }
      j++;
      a++;
    }
    i = j - 1;
    c = 1;
    for (j = 1; j <= a; j++) {
      if ((j % 2 == 0) && (b > 0)) {
        c = (c * (j / 2)) % m;
        b--;
      } else {
        c = (c * j) % m;
      }
    }
    ans = (ans * c) % m;
  }
  cout << ans;
  return 0;
}
