Hackerman

아직 제출이 없습니다시간 제한1초메모리 제한512 MB

문제

You, Mr. Hackerman, have gained access to the servers of a secure messaging app. They use a new ciphering method based on the difficulty of factoring the numbers that are products of three big primes.

You are reading the source code and found out how they actually generate these numbers. They define three recurrences:

  • x_n=(11x_n1+7)mod611,953n>0x\_n = (11 \cdot x\_{n-1} + 7) \bmod 611\\,953 \quad \forall n > 0
  • y_n=(13y_n1+5)mod746,773n>0y\_n = (13 \cdot y\_{n-1} + 5) \bmod 746\\,773 \quad \forall n > 0
  • z_n=(53z_n1+3)mod882,389n>0z\_n = (53 \cdot z\_{n-1} + 3) \bmod 882\\,389 \quad \forall n > 0

The seeds x_0,y_0,z_0x\_0, y\_0, z\_0 seem to be stored in a secure file.

Now they get the three primes p_k,q_k,r_kp\_k, q\_k, r\_k for the kk-th user:

  • p_kp\_k is x_kx\_k-th number in a secure file X.axx (all its numbers are different primes with exactly 3131 decimal digits).
  • q_kq\_k is y_ky\_k-th number in a secure file Y.axx (all its numbers are different primes with exactly 3232 decimal digits).
  • r_kr\_k is z_kz\_k-th number in a secure file Z.axx (all its numbers are different primes with exactly 3333 decimal digits).

Then, they compute the public key n_k=p_kq_kr_kn\_k = p\_k \cdot q\_k \cdot r\_k.

You have temporary access to the public key database, and you can query up to 5 public keys for any user.

You are given two integers uu and vv. You have to intercept communications between the uu-th user and the vv-th user. For this task, you will need to compute p_u,q_u,r_u,p_v,q_v,r_vp\_u, q\_u, r\_u, p\_v, q\_v, r\_v; having these values will allow you to completely manipulate communication.

For the sake of input/output simplicity, we ask you to output p_u+q_u+r_u+p_v+q_v+r_vp\_u + q\_u + r\_u + p\_v + q\_v + r\_v as your answer.

힌트

Solution to the example (u=10u = 10 and v=20v = 20):

p_10=6745719728113484794920696767881p\_{10} = 6745719728113484794920696767881

q_10=54398126832702965410665141463513q\_{10} = 54398126832702965410665141463513

r_10=523986762172023700466774225430947r\_{10} = 523986762172023700466774225430947

p_20=6899037085323900149383957179569p\_{20} = 6899037085323900149383957179569

q_20=76607972465670150189802211467309q\_{20} = 76607972465670150189802211467309

r_20=520033106839239897778822214813477r\_{20} = 520033106839239897778822214813477

p_10+q_10+r_10+p_20+q_20+r_20=1188670725123074098790368447122696p\_{10} + q\_{10} + r\_{10} + p\_{20} + q\_{20} + r\_{20} = 1188670725123074098790368447122696