x=number of girls.
y=number of boys.
We can suggest this system of equations:
2/7 x=3/5 y ⇒10x=21y ⇒x=21/10 y
y=x-165
We can solve this problem by substitution method:
x=(21/10)(x-165)
10x=21x-3465
10x-21x=-3465
-11x=-3465
x=-3465 /-11=315
y=x-165=315-165=150
Number of children=number of girls + number of boys
Number of children=315 +150=465
Answer: there were 465 children at the festival.