#include <bits/stdc++.h>
using namespace std;
int n;
pair<long long, int> arr[2 * 100010];
long long m;
long long fact(int val, int pow2) {
  long long ret = 1;
  for (int i = 1; i <= val; i++) {
    int ex = i;
    ret *= ex;
    while (pow2 > 0 && ret % 2 == 0) {
      ret /= 2;
      pow2--;
    }
    ret %= m;
  }
  return ret;
}
int main(void) {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 0; i < 2 * n; i++) {
    cin >> arr[i].first;
    arr[i].second = i % n;
  }
  cin >> m;
  sort(arr, arr + 2 * n);
  int next = 0;
  long long ans = 1;
  for (int i = 0; i < 2 * n; i = next) {
    while (next < 2 * n && arr[next].first == arr[i].first) next++;
    int p2 = 0;
    for (int j = i; j < next - 1 && j < 2 * n - 1; j++) {
      if (arr[j].second == arr[j + 1].second) p2++;
    }
    ans *= fact(next - i, p2);
    ans %= m;
  }
  cout << ans << "\n";
  return 0;
}
