#include <bits/stdc++.h>
using namespace std;
int x, n, BASE, t, same;
pair<int, int> p[200010];
long long ans = 1;
int main() {
  cin >> n;
  for (int i = 0; i < 2 * n; i++) {
    cin >> x;
    p[i] = pair<int, int>(x, i % n);
  }
  cin >> BASE;
  sort(p, p + 2 * n);
  int i = 0, j = 0;
  while (i < 2 * n) {
    while (j <= 2 * n && p[j + 1].first == p[j].first)
      if (p[++j].second == p[j - 1].second) same++;
    for (int k = 2; k <= j - i + 1; k++) {
      t = k;
      while (!(t & 1) && same) t /= 2, same--;
      ans = (ans * t) % BASE;
    }
    i = ++j;
  }
  cout << ans << endl;
  return 0;
}
