#K84497. Final Price Calculation
Final Price Calculation
Final Price Calculation
You are given the number of products \(N\), a threshold amount \(X\), a discount amount \(D\), and a list of product prices. Your task is to calculate the final total amount after applying the discount if the total price is greater than or equal to \(X\). If the total price is less than \(X\), no discount is applied.
The discount is applied only when the sum of the product prices \(\sum_{i=1}^{N} price_i\) satisfies \(\sum_{i=1}^{N} price_i \ge X\). Otherwise, the total amount remains the same.
inputFormat
The first line contains three integers (N), (X), and (D) representing the number of products, the threshold amount, and the discount amount respectively. The second line contains (N) space-separated integers representing the prices of the products.
outputFormat
Output a single integer which is the final amount after applying the discount if applicable.## sample
5 2000 300
150 300 400 700 500
1750