solve 1006 untwist and 1007 numerical summation