# On a certain type of card game

Suppose two players are playing a card game, which is described as follow. Each player is allowed to construct their own decks of exactly $n$ cards with an additional repeatable card, where each non-repeatable card has a value between $0$ and $m$, where $m > 0$ is fixed positive integer and the repeatable card has value $p$. Here 'repeatable' means that the repeatable card may be played each turn, as long as the constraints below are satisfied. Each player has a budget of $r_k$ on turn $k$, where $r_i = i$ for $1 \leq i \leq m$ and $r_i = m$ for all $i \geq m$. Each player can only play cards on turn $k$ so that the total value of the cards played is at most $r_k$ (including the repeatable card).

The game begins after each player shuffles their deck, after choosing their cards. Each player is to draw the top 4 cards on their deck, and may keep or reject any number of them. For each card rejected, they select a random card from their deck. The repeatable card is always in the initial hand. Each player draws one card at the beginning of their turn. The game terminates on turn $\lfloor n/2 \rfloor$.

Define the waste $w_k$ to be the difference $r_k - s_k$, where $s_k$ denotes the total value of cards played by a player on turn $k$.

The game is won by minimizing the total waste $w = w_1 + \cdots$. How should each player construct their decks to maximize their chances of winning, as a function of $m,n,p$?