Company: Ion_17nov
Difficulty: medium
Min Upgradation Time Problem Description Two servers both need a software upgrade. The first needs t1 seconds of upgrade work in total, the second needs t2 seconds. Time is counted in whole seconds, numbered 1, 2, 3, ... , and in any one second at most one of the two servers may be upgraded - the engineer can only work on one machine at a time. Seconds in which nobody is upgraded are allowed. The servers also serve traffic. The first server receives a request in every second that is a multiple of req1 , and the second server in every second that is a multiple of req2 . A server cannot be upgraded in a second in which it receives a request. Implement minUpgradationTime so that it returns the smallest T such that both upgrades can be finished within the seconds 1 through T . Input Format A single line containing four space-separated integers req1 , t1 , req2 , t2 , in that order. Output Format A single line containing one integer: the minimum number of seconds. Constraints 2 <= req1,