Solved 00497.cpp