#K37762. Minimum Total Task Completion Time

    ID: 26049 Type: Default 1000ms 256MiB

Minimum Total Task Completion Time

Minimum Total Task Completion Time

You are given (N) tasks. For the (i)-th task, Arjun can complete it in (A_i) time, Bhavana in (B_i) time, and they can complete it together in (C_i) time. The goal is to determine the minimum total time required to complete all tasks. Specifically, for each task, you should choose the fastest option, and the total time is given by $$T = \sum_{i=1}^{N} \min(A_i,; B_i,; C_i).$$

inputFormat

The input is read from standard input (stdin) and has the following format:

• The first line contains an integer (N), the number of tasks.
• The second line contains (N) space-separated integers (A_1, A_2, \ldots, A_N) representing the time Arjun takes for each task.
• The third line contains (N) space-separated integers (B_1, B_2, \ldots, B_N) representing the time Bhavana takes for each task.
• The fourth line contains (N) space-separated integers (C_1, C_2, \ldots, C_N) representing the time taken if both work together.

outputFormat

Output a single integer to standard output (stdout) representing the minimum total time required to complete all tasks.## sample

3
7 5 12
4 3 10
5 8 6
13