#include <bits/stdc++.h>
using namespace std;
const int maxn = 200000 + 100;
long long n, m, ans = 1, c[maxn];
pair<long long, long long> a[maxn];
long long fuc(int x, int y) {
  long long res = 1;
  for (int i = 1; i <= x; i++) c[i] = i;
  for (int i = 1; i <= x; i++) {
    while (c[i] % 2 == 0 && y > 0) {
      y--;
      c[i] /= 2;
    }
  }
  for (int i = 1; i <= x; i++) {
    res *= c[i];
    res %= m;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i].first;
  for (int i = 1; i <= n; i++) cin >> a[i + n].first;
  for (int i = 1; i <= n; i++) a[i].second = i, a[i + n].second = i;
  sort(a + 1, a + 2 * n + 1);
  cin >> m;
  int f = 1, s = 1, cnt = 0;
  while (s <= 2 * n) {
    cnt = 0;
    while (f <= 2 * n && a[f].first == a[s].first) {
      if (f > s && a[f].second == a[f - 1].second) cnt++;
      f++;
    }
    ans = (ans * fuc(f - s, cnt)) % m;
    s = f;
  }
  cout << ans % m << endl;
  return 0;
}
