SP18939 KSMALL - K-th smallest number

Description

Given an array of (pseudo) random numbers generated by the C++ function below, your task is to find the K-th smallest number of all the numbers. ``` unsigned array[5000000]; void randomize(unsigned a,unsigned b,unsigned mod) { for( int i=0 ; i> 16); b = 17508 * (b & 65535) + (b >> 16); array[i] = ((a

Input Format

One line with 4 numbers (a, b, mod, K) separated by space. 0 < a, b < 65535 2 < mod < 2 $ ^{32} $ -1 1 < K < 5x10 $ ^{6} $

Output Format

K-th smallest number of all the generated numbers.