# import系 --- from collections import defaultdict # 入力用 --- INT = lambda: int(input()) MI = lambda: map(int, input().split()) MI_DEC = lambda: map(lambda x: int(x) - 1, input().split()) LI = lambda: list(map(int, input().split())) LI_DEC = lambda: list(map(lambda x: int(x) - 1, input().split())) LS = lambda: list(input()) LSS = lambda: input().split() INF = 1 << 60 MOD = 998244353 # コード --- N, M = MI() A_list = LI() B_list = LI() C_list = LI() sum_cost = sum(C_list) cnt = 0 diff_dict = defaultdict(int) for i, (a, c) in enumerate(zip(A_list, C_list)): cnt += B_list[(i + 1) % M] diff_dict[cnt - a] += c max_exempted_cost = 0 for exempted in diff_dict.values(): max_exempted_cost = max(exempted, max_exempted_cost) print(diff_dict) print(sum_cost - max_exempted_cost)