#include <bits/stdc++.h>
using namespace std;
map<int, int> mapp;
int n, M;
int num[2 * 100010];
int arr[100010];
int main() {
  long long ans, temp;
  int x, cnt;
  while (scanf("%d", &n) != EOF) {
    mapp.clear();
    memset(num, 0, sizeof(num));
    int i, j, idx = 0;
    for (i = 0; i < n; i++) {
      scanf("%d", &x);
      if (!mapp[x]) mapp[x] = ++idx;
      num[mapp[x]]++;
      arr[i] = x;
    }
    cnt = 0;
    for (i = 0; i < n; i++) {
      scanf("%d", &x);
      if (!mapp[x]) mapp[x] = ++idx;
      num[mapp[x]]++;
      if (arr[i] == x) cnt++;
    }
    scanf("%d", &M);
    ans = 1;
    for (i = 1; i <= idx; i++)
      if (num[i]) {
        temp = 1;
        for (j = num[i]; j > 0; j--) {
          if (j % 2 == 0 && cnt) {
            temp = (temp * j / 2) % M;
            cnt--;
          } else
            temp = (temp * j) % M;
        }
        ans = (ans * temp) % M;
      }
    printf("%I64d\n", ans);
  }
}
