#B3669. Minimum Cost for Exact Notebook Purchase
Minimum Cost for Exact Notebook Purchase
Minimum Cost for Exact Notebook Purchase
A store sells notebooks in two types of packages. The first type is a single notebook sold at a price of \(x\) per notebook. The second type is a discounted pack of 10 notebooks sold at a price of \(y\) per pack.
During the Double Eleven promotion, both types receive a discount of 1 unit. Thus, the discounted prices become \(x-1\) for a single notebook and \(y-1\) for a pack of 10.
Given that Xiao Ming wants to purchase exactly \(n\) notebooks (i.e. he cannot buy less or more than \(n\) notebooks), determine the minimum amount of money required.
Note: You must purchase exactly \(n\) notebooks by choosing some number of packs and some number of individual notebooks such that \(10k + r = n\) where \(k\) is the number of packs and \(r\) is the number of singles.
inputFormat
The input consists of a single line containing three space-separated integers \(n\), \(x\), and \(y\), where:
- \(n\) is the total number of notebooks to purchase,
- \(x\) is the original price of a single notebook, and
- \(y\) is the original price of a 10-notebook pack.
outputFormat
Output a single integer representing the minimum cost to buy exactly \(n\) notebooks under the promotion.
sample
13 3 20
25