Solution to level 76 in Untrusted: http://alex.nisnevich.com/untrusted/