#include <bits/stdc++.h>
using namespace std;
const int M = 100010;
int n, m, t, tmp, d, a, b;
map<int, int> mp;
map<int, int> cnt;
map<int, int>::iterator ii;
int rec[M];
int main() {
  ios::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> rec[i];
    mp[rec[i]]++;
  }
  for (int i = 1; i <= n; i++) {
    cin >> t;
    if (t == rec[i]) cnt[t]++;
    mp[t]++;
  }
  cin >> m;
  long long ans = 1;
  for (ii = mp.begin(); ii != mp.end(); ii++) {
    tmp = ii->first;
    a = mp[tmp];
    b = cnt[tmp];
    for (int i = 2; i <= a; i++) {
      d = i;
      if (d % 2 == 0) {
        while (b && (d % 2 == 0)) {
          b--;
          d /= 2;
        }
      }
      ans = ans * d % m;
    }
  }
  cout << ans << endl;
  return 0;
}
