solution for FoxAndHandleEasy, SRM 563