Peter, Joel and Alan shared 1260 marbles. Alan gave half of his marbles to Peter. Peter gave some of his marbles to Joel and Joel's number of marbles doubled. Then Joel gave some of his marbles to Alan and Alan's number of marbles doubled. In the end, all the three boys had the same number of marbles. How many marbles did Peter have at first?

Can someone help me solve this pls? Thank you!

If they started out with p,j,a marbles, respectively, then we have

p+j+a = 1260
Peter gave j marbles to Joel, so now they have
p-j, 2j, a
Then Joel gave a marbles to Alan, and they now have
p-j, 2j-a, 2a
Now they all have the same number of marbles, so
p-j = 2a
2j-a = 2a
so 2j=3a, and
p = j+2a = 7/2 a
So now, we have
3/2 a + 7/2 a + a = 1260
a = 210
So to start with,
Peter had 735
Joel had 315
Alan had 210