Parabolic motion (motion in two dimension)

Question
A stone is thrown from ground level over horizontal ground. It just clears three walls, the successive distances between them being r and 2r. The inner wall is 15/7 times as high as the outer walls which are equal in height. The total horizontal range is nr, where n is an integer. Find n.
Solution
Let us just assume that both the outer walls are equal in height say $h$ and they are at equal distance $x$ from the end points of the parabolic trajectory as can be shown below in the figure.

Now equation of the parabola is
$y = bx - c{x^2}$                                       (1)
$y = 0$ at $x = nr = R$
where $R$ is the range of the parabola.
Putting these values in equation (1) we get
$b = cnr$                                                       (2)
Now the range $R$ of the parabola is
$R = a + r + 2r + a = nr$
This gives
$a = \left( {n - 3} \right)\frac{r}{2}$               (3)
The trajectory of the stone passes through the top of the three walls whose coordinates are
$\left( {a,h} \right),\left( {a + r,\frac{{15}}{7}h} \right),\left( {a + 3r,h} \right)$
Using these co-ordinates in equation 1 we get
$h = ab - c{a^2}$                                           (4)
$\frac{{15}}{7}h = b(a + r) - c{(a + r)^2}$                              (5)
$h = b(a + 3r) - c{(a + 3r)^2}$                                      (6)
After combining (2), (3), (4), (5) and (6) and solving them we get n = 4.