1068A.md (1751B)
1 Source: https://codeforces.com/problemset/problem/1068/A 2 3 A. Birthday 4 5 time limit per test 6 7 1 second 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 standard input 16 17 output 18 19 standard output 20 21 Ivan is collecting coins. There are only $N$ different collectible coins, Ivan has $K$ of them. He will be celebrating his birthday soon, so all his $M$ freinds decided to gift him coins. They all agreed to three terms: 22 23 * Everyone must gift as many coins as others. 24 * All coins given to Ivan must be different. 25 * Not less than $L$ coins from gifts altogether, must be new in Ivan's collection. 26 27 But his friends don't know which coins have Ivan already got in his collection. They don't want to spend money so they want to buy minimum quantity of coins, that satisfy all terms, irrespective of the Ivan's collection. Help them to find this minimum number of coins or define it's not possible to meet all the terms. 28 29 Input 30 31 The only line of input contains 4 integers $N$, $M$, $K$, $L$ ($1 \le K \le N \le 10^{18}$; $1 \le M, \,\, L \le 10^{18}$) — quantity of different coins, number of Ivan's friends, size of Ivan's collection and quantity of coins, that must be new in Ivan's collection. 32 33 Output 34 35 Print one number — minimal number of coins one friend can gift to satisfy all the conditions. If it is impossible to satisfy all three conditions print "-1" (without quotes). 36 37 Examples 38 39 Input 40 41 ``` 42 20 15 2 3 43 ``` 44 45 Output 46 47 ``` 48 1 49 ``` 50 51 Input 52 53 ``` 54 10 11 2 4 55 ``` 56 57 Output 58 59 ``` 60 -1 61 ``` 62 63 Note 64 65 In the first test, one coin from each friend is enough, as he will be presented with 15 different coins and 13 of them will definitely be new. 66 67 In the second test, Ivan has 11 friends, but there are only 10 different coins. So all friends can't present him different coins.