#include <bits/stdc++.h>
std::vector<std::pair<uint64_t, uint64_t> > points;
int main() {
  int N, a, b;
  std::cin >> N;
  for (int i = 0; i < N; i++) {
    std::cin >> a;
    points.push_back(std::make_pair(a, i + 1));
  }
  for (int i = 0; i < N; i++) {
    std::cin >> a;
    points.push_back(std::make_pair(a, i + 1));
  }
  std::sort(points.begin(), points.end());
  int matches = 0;
  for (int i = 1; i < 2 * N; i++) {
    if (points[i].first == points[i - 1].first &&
        points[i].second == points[i - 1].second)
      matches++;
  }
  uint64_t m;
  std::cin >> m;
  uint64_t combinations = 1;
  for (int i = 0; i < 2 * N;) {
    uint64_t x = points[i].first;
    uint64_t count = 0;
    while (points[i].first == x && i < 2 * N) i++, count++;
    uint64_t prod = 1;
    while (count > 1) {
      prod *= count;
      while (prod % 2 == 0 && matches > 0) matches--, prod /= 2;
      prod %= m;
      count--;
    }
    combinations *= prod;
    combinations %= m;
  }
  std::cout << combinations << std::endl;
  return 0;
}
