Solution by Antonio Gamiz
