#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 5e6 + 5;
const long long MOD = 1e9 + 7;
const long double eps = 1e-6;
const long long INF = 1e15;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, m;
  cin >> n;
  vector<long long> a(n + 1), b(n + 1);
  map<long long, long long> cnt;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    cnt[a[i]]++;
  }
  long long x = 0;
  for (int i = 0; i < n; ++i) {
    cin >> b[i];
    cnt[b[i]]++;
    if (a[i] == b[i]) x++;
  }
  cin >> m;
  long long ans = 1;
  for (auto it = begin(cnt); it != end(cnt); ++it) {
    long long N = it->second;
    for (long long i = 1; i <= N; ++i) {
      long long p = i;
      while (p % 2 == 0 && x > 0) {
        p /= 2;
        x--;
      }
      ans *= p;
      ans %= m;
    }
  }
  cout << ans;
  return 0;
}
