#include <bits/stdc++.h>
using namespace std;
const int MX = 200005, INF = 100000000;
pair<int, int> p[MX];
int main() {
  int n, m, l, x, y, w, v;
  long long int ans;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &p[i].first);
    p[i].second = i;
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &p[i + n].first);
    p[i + n].second = i;
  }
  sort(p, p + n * 2);
  scanf("%d", &m);
  l = 0;
  ans = 1;
  while (l < n * 2) {
    x = p[l].first;
    y = -1;
    w = v = 0;
    while (l < n * 2 && p[l].first == x) {
      w++;
      if (p[l].second == y) v++;
      y = p[l].second;
      l++;
    }
    for (int i = 1; i <= w; i++) {
      ans *= i;
      while (v > 0 && ans % 2 == 0) {
        ans /= 2;
        v--;
      }
      ans %= m;
    }
  }
  cout << ans << endl;
  return 0;
}
