#!/usr/bin/env python3 def arrange(n, xs, ys): width = min(x + y for x, y in zip(xs, ys)) zs = [0] for x in xs: zs.append(min(x, width)) zs.append(width) return width, zs def main(): n = int(input()) xs = [int(z) for z in input().split()] ys = [int(z) for z in input().split()] width, zs = arrange(n, xs, ys) print(width) print(*zs, sep="\n") if __name__ == "__main__": main()