#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100001;
int N;
int M;
long long int Mods;
pair<int, int> data[MAXN * 2 + 10];
int biao[MAXN * 2 + 10];
long long int calcit(int N, int same) {
  long long int ans = 1;
  for (int i = 1; i <= N; i++) {
    if (same && i % 2 == 0) {
      same--;
      ans *= (i / 2);
      ans %= Mods;
    } else
      ans *= (long long int)i, ans %= Mods;
  }
  return ans;
}
long long int solve() {
  long long int ans = 1;
  int cnt, scnt;
  for (int i = 1; i < N; i++) {
    scnt = 0, cnt = 0;
    while (data[i].first == data[i + 1].first) {
      cnt++;
      if (data[i].second == data[i + 1].second) scnt++;
      i++;
    }
    if (cnt) {
      cnt++;
      ans = ans * calcit(cnt, scnt);
      ans = ans % Mods;
    }
  }
  return ans;
}
int main(int argc, char *argv[]) {
  for (int i = 1; i <= MAXN; i++) biao[i] = i;
  scanf("%d", &N);
  M = N * 2;
  for (int i = 1; i <= N; ++i) {
    scanf("%d", &data[i].first);
    data[i].second = i;
  }
  for (int i = 1 + N; i <= M; ++i) {
    scanf("%d", &data[i].first);
    data[i].second = i - N;
  }
  scanf("%I64d", &Mods);
  N = M;
  sort(&data[1], &data[N + 1]);
  cout << solve() << endl;
  return 0;
}
