#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > v;
long long int solve(int n, int t, int m) {
  long long int ret = 1;
  t = -t;
  for (int i = 1; i <= n; i++) {
    int x = i;
    while (x % 2 == 0) {
      x /= 2;
      t++;
    }
    if (x > 1) ret = ret * x % m;
  }
  for (int i = 0; i < t; i++) ret = 2 * ret % m;
  return ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, x, m;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x;
    v.push_back(make_pair(x, i));
  }
  for (int i = 0; i < n; i++) {
    cin >> x;
    v.push_back(make_pair(x, i));
  }
  cin >> m;
  sort(v.begin(), v.end());
  int i = 0, j, k, c;
  n = n * 2;
  long long int ans = 1;
  while (i < n) {
    for (j = i; j < n; j++) {
      if (v[i].first != v[j].first) break;
    }
    c = 0;
    for (k = i + 1; k < j; k++)
      if (v[k].second == v[k - 1].second) c++;
    long long int x = solve(j - i, c, m);
    ans = ans * x % m;
    i = j;
  }
  cout << ans;
}
