#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m, result = 1;
  cin >> n;
  map<pair<int, int>, int> point_count;
  map<int, int> count;
  for (int i = 1, j; i <= n; i++) {
    cin >> j;
    ++count[j];
    ++point_count[make_pair(j, i)];
  }
  for (int i = 1, j; i <= n; i++) {
    cin >> j;
    ++count[j];
    ++point_count[make_pair(j, i)];
  }
  cin >> m;
  int same = 2 * n - point_count.size();
  for (auto i : count) {
    auto factorial = 1;
    for (auto j = 2; j <= i.second; j++) {
      auto current = j;
      while (current % 2 == 0 && same > 0) {
        current /= 2;
        same--;
      }
      factorial = (long long)factorial * current % m;
    }
    result = (long long)result * factorial % m;
  }
  cout << result;
  return 0;
}
