#include <bits/stdc++.h>
using namespace std;
const int MAX = 200000 + 10;
int Mod;
int n, d[MAX], top = 0;
pair<int, int> a[MAX];
int main() {
  int i, j;
  scanf("%d", &n);
  for (i = 1; i <= n; ++i) {
    scanf("%d", &a[i].first);
    a[i].second = i;
  }
  for (i = n + 1; i <= 2 * n; ++i) {
    scanf("%d", &a[i].first);
    a[i].second = i - n;
  }
  n *= 2;
  sort(a + 1, a + n + 1);
  scanf("%d", &Mod);
  long long ans = 1;
  for (i = 1; i <= n;) {
    int first = a[i].first;
    top = 0;
    while (a[i].first == first && i <= n) {
      d[++top] = a[i].second;
      ++i;
    }
    for (j = 1; j <= top;) {
      long long now = top - j + 1, nowans = 1;
      int c = d[j], num = 0;
      while (j <= top && d[j] == c) {
        ++num;
        ++j;
      }
      for (int j = 1; j <= num; ++j) nowans *= now, now--;
      for (int j = 1; j <= num; ++j) nowans /= j;
      nowans %= Mod;
      ans = ans * nowans % Mod;
    }
  }
  cout << ans << endl;
  return 0;
}
