#include <bits/stdc++.h>
using namespace std;
map<long long, long long> mp;
int cnt;
int n;
int num[100008];
int main() {
  scanf("%d", &n);
  int tmp;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &tmp);
    num[i] = tmp;
    mp[tmp]++;
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &tmp);
    if (num[i] == tmp) {
      cnt++;
    }
    mp[tmp]++;
  }
  long long ans = 1;
  long long m;
  scanf("%I64d", &m);
  for (auto it : mp) {
    for (int i = 1; i <= it.second; i++) {
      long long t = i;
      while (cnt > 0 && t % 2 == 0) {
        t /= 2;
        cnt--;
      }
      ans = ans * t % m;
    }
  }
  cout << ans << endl;
  return 0;
}
