Company: Amazon_31july
Difficulty: medium
Maximum Lucky Number An online retailer runs a loyalty draw in which members receive discount codes that the retailer calls lucky numbers , and the member holding the largest lucky number earns the best discount. A positive integer is a lucky number if its decimal representation uses only the digits x and y — every digit of the number must be equal to x or equal to y (it does not have to use both). For example, if x = 2 and y = 5 , then 2 , 552 and 5225 are lucky numbers, while 3 , 24 , 57 and 389 are not. You are given two different digits x and y and a positive integer n . Determine the maximum lucky number whose digits sum to exactly n . It is guaranteed that at least one such lucky number exists for the given x , y and n . Input Format The first line contains a single integer x . The second line contains a single integer y . The third line contains a single integer n . Output Format Print a single line containing the maximum lucky number whose digit sum is exactly n . Print it as a