8334 time complexity: 3219624