#include <bits/stdc++.h>
using namespace std;
const long long LINF = 0x3f3f3f3f3f3f3f3f;
const long long NLINF = 0xf7f7f7f7f7f7f7f7;
const int INF = 0x3f3f3f3f, NINF = 0xf7f7f7f7;
const int MOD1 = 1e9 + 7, MOD2 = 1e9 + 9;
const int N = 2e5 + 10;
int n, m, ans = 1;
vector<pair<int, int> > gr;
pair<int, int> a[N];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= 2 * n; i++)
    scanf("%d", &a[i].first), a[i].second = (i > n ? i - n : i);
  scanf("%d", &m);
  sort(a + 1, a + 2 * n + 1), a[2 * n + 1] = {0, 0};
  for (int i = 2, cur[2] = {1, 0}; i <= 2 * n + 1; i++) {
    if (a[i].first != a[i - 1].first)
      gr.emplace_back(cur[0], cur[1]), cur[0] = 1, cur[1] = 0;
    else
      cur[0]++, cur[1] += (a[i].second == a[i - 1].second);
  }
  for (auto &[x, y] : gr) {
    int k = y, cur = 1;
    for (int i = 1, j; i <= x; i++) {
      j = i;
      while (j % 2 == 0 && k) j /= 2, k--;
      cur = (1ll * cur * j) % m;
    }
    ans = (ans * 1ll * cur) % m;
  }
  printf("%d\n", ans);
}
