#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long N, cnt = 0, M, ans = 1;
  cin >> N;
  long long A[N + 1], B[N + 1];
  map<long long, long long> mp;
  for (long long i = 1; i <= N; i++) {
    cin >> A[i];
    mp[A[i]]++;
  }
  for (long long i = 1; i <= N; i++) {
    cin >> B[i];
    mp[B[i]]++;
    cnt += (A[i] == B[i]);
  }
  cin >> M;
  for (auto k : mp) {
    for (long long i = 1; i <= k.second; i++) {
      long long x = i;
      while (cnt && x % 2 == 0) {
        cnt--;
        x = x / 2;
      }
      ans = ans * x % M;
    }
  }
  cout << ans << endl;
}
