#include <bits/stdc++.h>
using namespace std;
map<int, int> cnt, cnt1;
map<int, int>::iterator it;
long long int fact[200002], p[200002];
int p2[200002], a[100002], b[100002];
void pre(int m) {
  fact[0] = 1;
  p[0] = 1;
  int i, j;
  for (i = 1; i < 200002; i++) {
    j = i;
    p2[i] = p2[i - 1];
    while (j % 2 == 0) p2[i]++, j /= 2;
    fact[i] = (fact[i - 1] * j) % m;
    p[i] = (p[i - 1] * 2) % m;
  }
}
int main() {
  int n, i, j, m;
  scanf("%d", &n);
  ;
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    ;
    cnt[a[i]]++;
  }
  for (i = 0; i < n; i++) {
    scanf("%d", &b[i]);
    ;
    cnt[b[i]]++;
  }
  for (i = 0; i < n; i++) {
    if (a[i] == b[i]) cnt1[a[i]]++;
  }
  scanf("%d", &m);
  ;
  pre(m);
  long long int ans = 1;
  for (it = cnt.begin(); it != cnt.end(); it++) {
    if (it->second < 2) continue;
    int num = fact[it->second],
        den = (cnt1.find(it->first) != cnt1.end()) ? cnt1[it->first] : 0;
    int power2 = p2[it->second] - den;
    ans = (ans * num) % m;
    ans = (ans * p[power2]) % m;
  }
  cout << ans << endl;
  return 0;
}
