#include <bits/stdc++.h>
using namespace std;
pair<int, int> a[111111], b[111111];
int n;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i].first);
    a[i].second = i;
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &b[i].first);
    b[i].second = i;
  }
  int m;
  scanf("%d", &m);
  sort(a + 1, a + 1 + n);
  sort(b + 1, b + 1 + n);
  long long ret = 1;
  for (int i = 1, j = 1; i <= n || j <= n;) {
    int val;
    if (i <= n && (j > n || a[i].first <= b[j].first))
      val = a[i].first;
    else
      val = b[j].first;
    int cnt = 0, l2 = 0;
    map<int, bool> f;
    f.clear();
    for (; i <= n && a[i].first == val; i++) {
      cnt++;
      f[a[i].second] = 1;
    }
    for (; j <= n && b[j].first == val; j++) {
      cnt++;
      if (f[b[j].second]) l2++;
    }
    for (int k = 2; k <= cnt; k++) {
      int now = k;
      while (now % 2 == 0 && l2) {
        now /= 2;
        l2--;
      }
      ret = (ret * now) % m;
    }
  }
  printf("%I64d", ret);
  return 0;
}
