#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 100000 + 20;
pair<long long, long long> p[2 * MAXN];
int main() {
  long long n, ans = 1;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    p[i].first = x;
    p[i].second = i + 1;
  }
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    p[i + n].first = x;
    p[i + n].second = i + 1;
  }
  long long M;
  cin >> M;
  sort(p, p + 2 * n);
  for (long long i = 0; i < 2 * n;) {
    long long cur = 1, counter = 1, tmp = p[i].first;
    long long start = i, num = 0;
    while (i < 2 * n && p[i].first == tmp) {
      if ((i - 1) >= 0 && p[i] == p[i - 1]) num++;
      i++;
    }
    i = start;
    while (i < 2 * n && p[i].first == tmp) {
      long long tmp8 = counter;
      while (tmp8 > 0 && tmp8 % 2 == 0 && num > 0) {
        tmp8 /= 2;
        num--;
      }
      cur *= (tmp8 % M);
      cur %= M;
      counter++;
      i++;
    }
    cur %= M;
    ans = (ans * cur) % M;
  }
  cout << (ans % M) << endl;
  return 0;
}
