#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:64000000")
map<int, vector<int>> mp;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < 2 * n; i++) {
    int x;
    cin >> x;
    mp[x].push_back(i % n);
  }
  int mod;
  cin >> mod;
  long long ans = 1;
  for (auto& elem : mp) {
    vector<int> cur = elem.second;
    sort(cur.begin(), cur.end());
    int power2 = cur.end() - unique(cur.begin(), cur.end());
    for (size_t i = 1; i <= cur.size(); ++i) {
      int nowMult = i;
      while (nowMult % 2 == 0 && power2) {
        --power2;
        nowMult /= 2;
      }
      ans *= nowMult;
      ans %= mod;
    }
  }
  cout << ans << endl;
  return 0;
}
