#include <bits/stdc++.h>
using namespace std;
long long int m;
struct sort_pred {
  bool operator()(const pair<int, int> &left, const pair<int, int> &right) {
    if (left.first == right.first) return left.second < right.second;
    return left.first < right.first;
  }
};
vector<pair<int, int> > a;
int p[200010];
int pot(int a) {
  int count = 0;
  while (a % 2 == 0) {
    count++;
    a >>= 1;
  }
  return count;
}
void calc_pot(int max) {
  int i;
  for (i = 1; i <= max; i++) p[i] = pot(i);
}
long long int count_num(long long int start, long long int counter) {
  long long int j;
  long long int x = 1;
  for (j = 1; j <= start; j++) {
    long long int r = j;
    if (counter)
      if (p[j]) {
        if (counter >= p[j]) {
          counter -= p[j];
          r >>= p[j];
        } else {
          r >>= counter;
          counter = 0;
        }
      }
    x = (x * r) % m;
  }
  return x % m;
}
int main() {
  int n, i, s;
  scanf("%d", &n);
  calc_pot(2 * n + 2);
  for (i = 1; i <= n; i++) {
    scanf("%d", &s);
    a.push_back(make_pair(s, i));
  }
  for (i = 1; i <= n; i++) {
    scanf("%d", &s);
    a.push_back(make_pair(s, i));
  }
  cin >> m;
  sort(a.begin(), a.end(), sort_pred());
  a.push_back(make_pair(1 << 30, -1));
  long long int start = 0;
  long long int count = 0;
  long long int ans = 1;
  for (int j = 1; j <= 2 * n; j++) {
    if (a[j].first != a[j - 1].first) {
      ans = (ans * count_num(j - start, count)) % m;
      start = j;
      count = 0;
    } else if (a[j].second == a[j - 1].second)
      count++;
  }
  cout << ans;
  return 0;
}
