Added fourth option as mode in the input parameter to handle 2.a