#include <bits/stdc++.h>
using namespace std;
long long n, m, x, ans = 1, k;
vector<pair<int, int> > a;
int main() {
  cin >> n;
  for (int i = 0; i < 2 * n; i++) {
    cin >> x;
    a.push_back(pair<int, int>(x, i % n));
  }
  cin >> m;
  sort(a.begin(), a.end());
  n <<= 1;
  x = 0;
  for (int i = 0; i < n; i++)
    for (k = 2; i + 1 < n && a[i].first == a[i + 1].first; i++, k++) {
      if (a[i].second == a[i + 1].second) x++;
      if (((ans *= k) & 1) == 0 && x) ans >>= 1, x--;
      ans %= m;
    }
  cout << ans;
}
