Selfie Restriction

Limits: 2s, 256 MB

Do you know the boy named Amlan? The only dream of his life is taking selfies. He takes selfies even in contests. Hence there are new rules in programming contests. These rules are like “You can take at most x selfies in y minutes”. If you break such rule and take a selfie, your team will get a penalty. That doesn’t stop Amlan from taking selfies. His teammates are angry but you know, he is a brilliant contestant. They cannot just replace him. Being this much helpless, they just want to know the total amount of penalty they will receive for Amlan’s selfies. You will be given all the rules and the times at which Amlan takes the selfies. You need to help his team to calculate the total penalty. To their great relief, the judges decided to delete all the records of Amlan’s selfies when his team receives some penalty. The contest runs for 300 minutes.

This is a companion discussion topic for the original entry at