#include <bits/stdc++.h>
using namespace std;
struct aaa {
  long long v, id;
} a[200010];
long long n, m, ans = 1;
int cmp(aaa a, aaa b) { return a.v < b.v || a.v == b.v && a.id < b.id; }
int main() {
  scanf("%I64d", &n);
  for (long long i = 1; i <= 2 * n; i++) {
    scanf("%I64d", &a[i].v);
    a[i].id = i;
    if (a[i].id > n) a[i].id -= n;
  }
  scanf("%I64d", &m);
  sort(a + 1, a + 2 * n + 1, cmp);
  long long l = 1, r = 1, sum;
  while (1) {
    while (r < 2 * n && a[r + 1].v == a[l].v) r++;
    sum = 0;
    for (long long i = l + 1; i <= r; i++)
      if (a[i].id == a[i - 1].id) sum++;
    for (long long i = 2; i <= r - l + 1; i++) {
      ans *= i;
      if (sum && i % 2 == 0) {
        sum--;
        ans /= 2;
      }
      if (ans >= m) ans %= m;
    }
    if (r == 2 * n) break;
    l = r + 1;
    r = l;
  }
  cout << ans << endl;
  return 0;
}
