#P1555A. PizzaForces
PizzaForces
No submission language available for this problem.
Description
PizzaForces is Petya's favorite pizzeria. PizzaForces makes and sells pizzas of three sizes: small pizzas consist of slices, medium ones consist of slices, and large pizzas consist of slices each. Baking them takes , and minutes, respectively.
Petya's birthday is today, and of his friends will come, so he decided to make an order from his favorite pizzeria. Petya wants to order so much pizza that each of his friends gets at least one slice of pizza. The cooking time of the order is the total baking time of all the pizzas in the order.
Your task is to determine the minimum number of minutes that is needed to make pizzas containing at least slices in total. For example:
- if friends come to Petya's birthday, he has to order pizzas containing at least slices in total. He can order two small pizzas, containing exactly slices, and the time to bake them is minutes;
- if friends come to Petya's birthday, he has to order pizzas containing at least slices in total. He can order a small pizza and a large pizza, containing slices, and the time to bake them is minutes;
- if friends come to Petya's birthday, he has to order pizzas containing at least slices in total. He can order small pizzas, medium pizzas and large pizzas, in total they contain slices, and the total time to bake them is minutes;
- if only one friend comes to Petya's birthday, he can order a small pizza, and the time to bake it is minutes.
The first line contains a single integer () — the number of testcases.
Each testcase consists of a single line that contains a single integer () — the number of Petya's friends.
For each testcase, print one integer — the minimum number of minutes that is needed to bake pizzas containing at least slices in total.
Input
The first line contains a single integer () — the number of testcases.
Each testcase consists of a single line that contains a single integer () — the number of Petya's friends.
Output
For each testcase, print one integer — the minimum number of minutes that is needed to bake pizzas containing at least slices in total.