HINT :
Question : Where the cost is same ?
Let's say at a distance $a$ from $Y$ and at a distance $b$ from $X$.
Then $60a = 40 b\Rightarrow \frac ab = \frac 23$
Let $(p,q)$ be a moving point on a plane such that distance from $X$ is $b$ and from $Y$ is $a$.
then $\frac ab =\frac {p^2+(30-q)^2}{(40-p)^2+q^2}= \frac 23$
Locus of $(p,q)$ is a circle.
On that circle cost is same . Where do you think it is cheaper for $X$ ?