Byterland Mobile, a mobile phone service provider, normally charges 10 cents per SMS (text message). In addition, it also offers monthly packs, which let you purchase a certain number of SMSs each month at a special price. You may purchase any number of these packs. If you exceed the number of SMSs covered by your monthly packs, the excess messages are charged at the normal rate.
You expect to send totalSMS SMSs each month, and you would like to minimize your monthly payment. There are two monthly packs available. The first pack costs pay1 cents and includes pack1 messages, and the second pack costs pay2 cents and includes pack2 messages. You may purchase any combination of these packs. Remember that it is sometimes cheaper to buy more SMSs than you actually need (see example #2). Return the minimal monthly payment in cents.