#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void smin(T &a, U b) {
  if (a > b) a = b;
}
template <typename T, typename U>
inline void smax(T &a, U b) {
  if (a < b) a = b;
}
pair<int, int> a[200010];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i].first), a[i].second = i;
  for (int i = 0; i < n; i++) scanf("%d", &a[i + n].first), a[i + n].second = i;
  n *= 2;
  sort(a, a + n);
  int m;
  scanf("%d", &m);
  int ans = 1;
  for (int i = 0, j; i < n; i = j) {
    for (j = i; j < n; j++)
      if (a[i].first != a[j].first) break;
    int cnt = 0;
    for (int k = i + 1; k < j; k++) {
      if (a[k].second == a[k - 1].second) cnt++;
    }
    int mid = 1;
    for (int k = 1; k <= (j - i); k++) {
      int u = k;
      while (cnt && u % 2 == 0) u /= 2, cnt--;
      mid = (long long)mid * u % m;
    }
    ans = (long long)ans * mid % m;
  }
  cout << ans << endl;
  return 0;
}
