Project Euler 271 - Modular Cubes, part 1

Official link: https://projecteuler.net/problem=271