#include <bits/stdc++.h>
using namespace std;
vector<int> arr;
int mod;
map<int, int> cnt;
int main() {
  int n, inp, cnt2 = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> inp;
    arr.push_back(inp);
    cnt[inp]++;
  }
  for (int i = 0; i < n; i++) {
    cin >> inp;
    cnt[inp]++;
    if (arr[i] == inp) cnt2++;
  }
  cin >> mod;
  map<int, int>::iterator itr;
  long long ans = 1;
  for (itr = cnt.begin(); itr != cnt.end(); itr++) {
    for (int j = 2; j <= (itr->second); j++) {
      long long tmp = j;
      while (tmp > 1 && (tmp % 2 == 0) && (cnt2 > 0)) {
        tmp = tmp / 2;
        cnt2--;
      }
      ans = (ans * tmp) % mod;
    }
  }
  cout << ans;
  return 0;
}
