finish writing compute() for task 3