#B3960. Minimum Payment with Supermarket Coupons

    ID: 11617 Type: Default 1000ms 256MiB

Minimum Payment with Supermarket Coupons

Minimum Payment with Supermarket Coupons

gza wants to minimize the final payment after applying discount coupons optimally. The supermarket offers two coupons:

1. Coupon 1: If the current amount ( \geq 100 ) then subtract (20) from the amount (i.e. final amount becomes ( n-20 )).
2. Coupon 2: If the current amount ( \geq 200 ) then subtract (50) from the amount (i.e. final amount becomes ( n-50 )).

The coupons can be used in any order. However, the first coupon used affects the eligibility of the second one. For instance, if ( n = 210 ) and coupon 1 is applied first, the amount becomes ( 210-20 = 190 ), making it ineligible for coupon 2. On the other hand, if coupon 2 is applied first (since (210 \geq 200)), the amount becomes ( 210-50 = 160 ), and then coupon 1 can be applied because ( 160 \geq 100 ), resulting in ( 160-20 = 140 ).

Your task is to compute the minimum final amount that needs to be paid after optimally applying the coupons.

inputFormat

The input consists of one integer ( n ) ((0 \leq n \leq 10^9)), representing the initial amount to be paid.

outputFormat

Print the minimum final amount after optimally applying the discount coupons.

sample

90
90