#include <bits/stdc++.h>
using namespace std;
struct node {
  int x, y;
} a[100020 * 2];
int n, mo;
long long ans = 1, Same;
inline void Get_int(int &Ret) {
  char ch;
  bool flag = false;
  for (; ch = getchar(), ch < '0' || ch > '9';)
    if (ch == '-') flag = true;
  for (Ret = ch - '0'; ch = getchar(), ch >= '0' && ch <= '9';
       Ret = Ret * 10 + ch - '0')
    ;
  flag && (Ret = -Ret);
}
inline void Get_llt(long long &Ret) {
  char ch;
  bool flag = false;
  for (; ch = getchar(), ch < '0' || ch > '9';)
    if (ch == '-') flag = true;
  for (Ret = ch - '0'; ch = getchar(), ch >= '0' && ch <= '9';
       Ret = Ret * 10 + ch - '0')
    ;
  flag && (Ret = -Ret);
}
bool cmp(node a, node b) { return a.x < b.x || (a.x == b.x && a.y < b.y); }
int main() {
  Get_int(n);
  int i, j, k, t;
  for (i = 1; i <= n; i++) {
    Get_int(a[i].x);
    a[i].y = i;
  }
  for (i = n + 1; i <= n * 2; i++) {
    Get_int(a[i].x);
    a[i].y = i - n;
  }
  Get_int(mo);
  sort(a + 1, a + 1 + n * 2, cmp);
  j = 1;
  for (i = 1; i <= n * 2;) {
    while (j <= n * 2 + 1 && a[j + 1].x == a[j].x)
      if (a[++j].y == a[j - 1].y) Same++;
    for (k = 2; k <= j - i + 1; k++) {
      t = k;
      while (!(t & 1) && Same) t /= 2, Same--;
      ans = (ans * t) % mo;
    }
    i = ++j;
  }
  printf("%I64d\n", ans);
}
