Esther, Alvin and Ryan had a total of 678 badges. Alvin gave half of his badges to Ryan. Ryan gave 95 badges to Esther. Esther gave 140 badges to Alvin. They then had the same number of badges.

(a) How many badges had each of them in the end?
(b) How many badges had Ryan at first?

e+a+r = 678

a/2 + 140 = r + a/2 - 95 = e+95-140
solve all that to find that
(b) r = 235
(a) 226