P26137 [AtCoder] [ARC026A] Dynamic Pose
入门
题目描述

Problem Description

Takahashi is about to participate in a programming contest. In this contest, there will be $ N $ simple problems. Normally, Takahashi can solve each problem in $ A $ minutes, but by assuming a dynamic pose, he can solve each problem in $ B $ minutes. However, the dynamic pose significantly drains his energy, so he can only solve up to 5 problems in this manner in a single programming contest. What is the shortest time Takahashi can solve all $ N $ problems?

Input Format

The input is given from the standard input in the following format:

$ N $ $ A $ $ B $

  • The first line contains an integer $N\ (1\ ≦\ N\ ≦\ 10)$ representing the number of problems, an integer $A\ (2\ ≦\ A\ ≦\ 60)$ representing the time in minutes Takahashi normally takes to solve one problem, and an integer $B\ (1\ ≦\ B\ <\ A)$ representing the time in minutes Takahashi takes to solve one problem while assuming a dynamic pose, all separated by spaces.

Output Format

Output the shortest time in minutes Takahashi takes to solve all the problems as an integer on one line. Ensure to include a newline at the end of the output.

Sample Input and Output

Sample Input #1

10 5 1

Sample Output #1

30

Sample Input #2

4 60 7

Sample Output #2

28

Notes/Hints

Sample Explanation 1

In this case, by solving 5 problems in the dynamic pose and the remaining 5 problems normally, Takahashi can solve all problems in a total of 30 minutes.

Sample Explanation 2

In this case, Takahashi can solve all problems in the dynamic pose.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
10 5 1
样例输出
30