Fisherman Šime caught N tunas last night. Using a special app, he offered them for sale to a well-known Japanese company that buys quality fish. How does the app estimate the value, or price, of a tuna?
From a photo of the tuna, the app returns two estimates, P1 and P2. If the difference between the estimates is less than or equal to X, the higher estimate is taken. If the difference is strictly greater than X, the app returns a third estimate P3, and that estimate is taken as the final value of the tuna.
Given the estimates for each of the N tunas (sometimes two of them, sometimes three), write a program that outputs the total value of the caught tunas.