pub fn part2(input: &[Input]) -> u64
Similar to part one, the logic is broken out into a separate function to enable testing.