#include <bits/stdc++.h>
using namespace std;
map<int, int> cnt;
int a[100010], b[100010];
int main() {
  int n;
  int m;
  int x;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", a + i);
    cnt[a[i]] += 1;
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", b + i);
    cnt[b[i]] += 1;
  }
  int c = 0;
  for (int i = 0; i < n; i++)
    if (a[i] == b[i]) ++c;
  cin >> m;
  unsigned long long ans = 1LL;
  for (map<int, int>::iterator it = cnt.begin(); it != cnt.end(); ++it) {
    unsigned long long fct = 1LL;
    int x = it->second;
    for (unsigned long long i = 1LL; i <= x; i++) {
      if (c && i % 2 == 0) {
        c--;
        fct *= (i / 2) % m;
      } else {
        fct *= (i % m);
      }
      fct %= m;
    }
    ans *= fct % m;
    ans %= m;
  }
  cout << ans << endl;
}
