{
Problem:
Arithmetic Analysis:
Writer:
Data:
Remark:
AC:
}
program preparation;
const
filename='preparation';
maxn=500;
var
p,r,d,late,path:array[0..maxn] of longint;
vis:array[0..maxn] of boolean;
n,time,max,step,ans:longint;
procedure init;
var
i:longint;
begin
for i:=1 to n do read(p[i]);
readln;
for i:=1 to n do read(r[i]);
readln;
for i:=1 to n do read(d[i]);
readln;
end;
procedure solve;
var
time,max,i:longint;
begin
time:=r[path[1]]+p[path[1]];
late[1]:=time-d[path[1]];
max:=0;
for i:=2 to n do
begin
if time<r[path[i]] then time:=r[path[i]];
time:=time+p[path[i]];
late[i]:=time-d[path[i]];
if late[i]>max then max:=late[i];
end;
if max<ans then ans:=max;
end;
procedure dfs(x:longint);
var
i:longint;
begin
inc(step);
vis[x]:=true;
path[step]:=x;
if step=n then solve;
for i:=1 to n do
if not vis[i] then
dfs(i);
dec(step);
vis[x]:=false;
end;
procedure main;
var
i:longint;
begin
readln(n);
while n<>0 do
begin
init;
ans:=maxlongint;
for i:=1 to n do
begin
fillchar(vis,sizeof(vis),false);
step:=0;
dfs(i);
end;
writeln(ans);
readln(n);
end;
end;
begin
assign(input,filename+'.in'); reset(input);
assign(output,filename+'.out'); rewrite(output);
main;
close(input); close(output);
end.