#include <bits/stdc++.h>
using namespace std;
int power(long long int m, long long int y) {
  long long int x = 2;
  long long int res = 1;
  while (y > 0) {
    if (y & 1) res = res * x;
    res %= m;
    y = y >> 1;
    x = x * x;
    x %= m;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, m;
  cin >> n;
  pair<long long int, long long int> p[2 * n];
  for (long long int i = 0; i < (2 * n); i++) {
    cin >> p[i].first;
    p[i].second = (i % n) + 1;
  }
  cin >> m;
  sort(p, p + (2 * n));
  long long int ans = 1, x = 1, v = 1, f = 0;
  for (long long int i = 1; i < (2 * n); i++) {
    x++;
    if (p[i].first != p[i - 1].first) {
      ans *= v;
      x = 1;
      v = 1;
      ans %= m;
    } else {
      if (p[i].second == p[i - 1].second) {
        f--;
      }
      if (x % 2 == 0) {
        f++;
        v *= (x / 2);
      } else
        v *= x;
    }
    v %= m;
  }
  ans *= v;
  ans %= m;
  ans *= power(m, f);
  ans %= m;
  cout << ans;
}
