#include <bits/stdc++.h>
using namespace std;
map<int, int> dup;
long long f1[200005], f2[200005], p2[100005];
long long arr[2][100005];
map<int, int> c;
vector<int> val;
int main() {
  long long n;
  cin >> n;
  for (int i = 0; i < 2; i++)
    for (int j = 0; j < n; j++) {
      cin >> arr[i][j];
      if (c[arr[i][j]] == 0) val.push_back(arr[i][j]);
      c[arr[i][j]]++;
      if (i && arr[i][j] == arr[i - 1][j]) dup[arr[i][j]]++;
    }
  long long m;
  cin >> m;
  long long ans = 1;
  f1[0] = f1[1] = f2[0] = f2[1] = p2[0] = 1;
  p2[1] = 2;
  for (int i = 2; i < 200005; i++) {
    f1[i] = (f1[i - 1] * i) % m;
    f2[i] = f2[i - 1] * i;
    if (i % 2 == 0) f2[i] /= 2;
    f2[i] %= m;
    if (i < 100005) p2[i] = (p2[i - 1] * 2) % m;
  }
  for (int i = 0; i < val.size(); i++) {
    long long z = c[val[i]], x = dup[val[i]];
    long long t = f2[z];
    long long tt = z / 2 - x;
    t = (t * p2[tt]) % m;
    ans = (ans * t) % m;
  }
  cout << ans << endl;
}
