#include <bits/stdc++.h>
using namespace std;
long long MOD;
struct para {
  int x, y;
};
bool porownanie(para a, para b) {
  if (a.x < b.x) return true;
  if (a.x > b.x) return false;
  if (a.y < b.y) return true;
  return false;
}
long long Newton(long long n, long long k) {
  if (k == 1) return n;
  if (k == 2) return n * (n - 1) / 2 % MOD;
}
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  vector<para> a;
  for (int i = 0; i < 2 * n; ++i) {
    int x;
    cin >> x;
    int nr;
    if (i < n)
      nr = i;
    else
      nr = i - n;
    a.push_back({x, nr});
  }
  n *= 2;
  cin >> MOD;
  sort(a.begin(), a.end(), porownanie);
  long long odp = 1;
  for (long long l1 = 0; l1 < n;) {
    long long p1 = l1;
    while (p1 < n && a[p1].x == a[l1].x) ++p1;
    --p1;
    long long zostalo = p1 - l1 + 1;
    for (long long l2 = l1; l2 <= p1;) {
      long long p2 = l2;
      while (p2 <= p1 && a[p2].y == a[l2].y) ++p2;
      --p2;
      odp = (odp * Newton(zostalo, p2 - l2 + 1)) % MOD;
      zostalo -= p2 - l2 + 1;
      l2 = p2 + 1;
    }
    l1 = p1 + 1;
  }
  cout << odp;
  return 0;
}
