import strutils, sequtils, algorithm var n, m, w: int (n, m, w) = stdin.readLine.split.map(parseInt) let k = n + m var w_diff = newSeq[int]() v_diff = newSeq[int]() w_diff.add(stdin.readLine.split.map(parseInt)) v_diff.add(stdin.readLine.split.map(parseInt)) w_diff.add(stdin.readLine.split.map(parseInt).mapIt(-it)) v_diff.add(stdin.readLine.split.map(parseInt).mapIt(-it)) let inf = 1 shl 30 var dp = newSeqWith[int](1 shl k, -inf) dp[0] = 0 for i in 0..<(1 shl k): var w_sum = 0 for j in 0..