JBMO 2024  | Problem 4 - Official Solution