output_description: Print |a - b|.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      P_1 P_2 ... P_N
      Q_1 Q_2 ... Q_N
attempt: import fractions
  import math
  
  N, M = map(int, input().split())
  a = list(map(int, input().split()))
  a_uniq = list(set(a))
  
  len_a = len(a_uniq)
  
  # find lcm
  gcd_a = a_uniq[0]
  for i in range(1, len_a):
      gcd_a = fractions.gcd(gcd_a, a_uniq[i])
  
  lcm = 1
  for j in range(len_a):
      lcm *= a_uniq[j]
  
  lcm = lcm / gcd_a
  lcm /= 2
  
  print(math.ceil((M / lcm) / 2), lcm, M)
  
problem_description: Statement
  
  We have two permutations P and Q of size N (that is, P and Q are both
  rearrangements of (1,~2,~...,~N)).
  
  There are N! possible permutations of size N. Among them, let P and Q be the
  a-th and b-th lexicographically smallest permutations, respectively. Find |a -
  b|.
samples: [{"input": "3\n    1 3 2\n    3 1 2", "output": "3\n    \n\nThere are 6 permutations of size 3: (1,~2,~3), (1,~3,~2), (2,~1,~3),\n(2,~3,~1), (3,~1,~2), and (3,~2,~1). Among them, (1,~3,~2) and (3,~1,~2) come\n2-nd and 5-th in lexicographical order, so the answer is |2 - 5| = 3.\n\n* * *"}, {"input": "8\n    7 3 5 4 2 1 6 8\n    3 8 2 5 4 6 7 1", "output": "17517\n    \n\n* * *"}, {"input": "3\n    1 2 3\n    1 2 3", "output": "0"}]