O(n) time algorithm for maximum earnings
You can use DP for solving this problem.

Let's iterate $i$ from $1$ to $n$ and calculate next values for each $i$:


$m_{i,0}$ - biggest sum of money from plates $j \le i$ which is divisible by 3
$m_{i,1}$ - biggest sum of money from plates $j \le i$ which have reminder 1 after division by 3
$m_{i,2}$ - biggest sum of money from plates $j \le i$ which have reminder 2 after division by 3


Base case:
$m_{0,0} = 0, m_{0,1} = -\infty, m_{0,2} = -\infty$

Iteration:


$k \in [0, 1, 2]: m_{i, k} = m_{i-1, k}$
$k \in [0, 1, 2], m_{i-1,k} \ne -\infty: m_{i, (m_{i-1,k} + a_i)\%3} = max(m_{i, (m_{i-1,k} + a_i)\%3}, m_{i-1,k} + a_i)$


And result will be $m_{n,0}$.