Good morning, I.v.

Vasya has 100 bank cards. Vasya knows that one of the cards has 1 ruble, another has 2 rubles, and so on, with the last card having 100 rubles, but he does not know how much money is on which card. Vasya can insert a card into an ATM and request a certain amount. The ATM dispenses the requested amount if it is available on the card, and does nothing if the money is not there, while swallowing the card in either case. The ATM does not show how much money was on the card. What is the largest amount of money Vasya can guarantee to get?
This is the amount Vasya will receive if he requests 50 rubles 100 times (or 51 rubles 100 times). Let's prove that Vasya cannot guarantee himself a larger amount. Imagine that next to Vasya stands a banker Kolya, who knows the denominations of the cards. Vasya names a sum, and Kolya selects one of the cards and inserts it into the ATM.

It is sufficient to find a strategy for Kolya under which Vasya cannot receive more than 2550 rubles. Indeed, suppose such a strategy exists. Let's return to the conditions of the original problem, where Vasya has the cards. No matter how Vasya acts, circumstances can unfold as if an adversary (Kolya, "evil force") is playing against him, and then Vasya will receive no more than 2550 rubles. Let's propose the following strategy for Kolya. When Vasya names a sum, Kolya inserts a card with a denomination less than the named sum, if such a card exists, and a card with the highest denomination from those he has on hand otherwise. In the first case, the card is called discarded, and in the second case, it is called realized. Clearly, Vasya receives money only from the realized cards, and the cards are realized in descending order of denominations. Let the largest payment be $n$ rubles and this payment realizes a card with a denomination of $m$ rubles, $m \geq n$. Let's make two observations. First, by the time of this payment, cards with a denomination less than $n$ rubles have already been eaten (otherwise, Kolya would have inserted one of these into the ATM instead of the card with a denomination of $m$ rubles). Second, all these cards have been discarded. Indeed, a card with a denomination of $k$ rubles for $k < n$ could not have been realized before the card with a denomination of $m$ rubles, since $k < m$. Thus, the total number of realized cards does not exceed $100 - n + 1$. From each realized card, Vasya receives no more than $n$ rubles, so the total amount received by Vasya does not exceed $n \times (100 - n + 1)$; the maximum is achieved at $n = 50$ and $n = 51$.

## Answer

2550 rubles.