#include <bits/stdc++.h>
using namespace std;
int MD;
int n;
pair<int, int> a[1020304];
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i].first), a[i].second = i;
  for (int i = 1; i <= n; ++i)
    scanf("%d", &a[i + n].first), a[i + n].second = i;
  int dv2 = 0;
  cin >> MD;
  for (int i = 1; i <= n; ++i)
    if (a[i].first == a[i + n].first) ++dv2;
  sort(a + 1, a + n + n + 1);
  int p = 0;
  int ans = 1;
  for (int i = 1; i <= n + n; ++i)
    if (a[i + 1].first != a[i].first) {
      int Tot = 0;
      for (int j = i; j > 0; j--)
        if (a[j].first == a[i].first)
          ++Tot;
        else
          break;
      for (int j = 1; j <= Tot; ++j) {
        int ml = j;
        while (ml % 2 == 0 && dv2) ml /= 2, dv2--;
        ans = (long long)ans * ml % MD;
      }
    }
  cout << ans << endl;
  return 0;
}
