#include<bits/stdc++.h>
using namespace std;
struct GNode {
unsigned long long pos;
vector<unsigned long long> childs;
};
struct Node {
unsigned long long pos;
vector<unsigned long long> childs;
unsigned long long g;
unsigned long long h;
unsigned long long f;
Node(unsigned long long _pos, vector<unsigned long long> _childs, unsigned long long _g, unsigned long long _h, unsigned long long _f) {
pos = _pos;
childs = _childs;
g = _g;
h = _h;
f = _f;
}
};
struct find_pos {
unsigned long long pos;
find_pos(unsigned long long pos) : pos(pos) {}
bool operator () (const Node &n) const {
return n.pos == pos;
}
};
bool compareNodes(const Node &a, const Node &b) {
return !(a.f < b.f);
}
int main() {
unsigned long long n;
cin >> n;
vector<unsigned long long> d;
vector<unsigned long long> c;
for (unsigned long long i = 0; i < n; i++) {
unsigned long long t;
cin >> t;
d.push_back(t);
}
for (unsigned long long i = 0; i < n-1; i++) {
unsigned long long t;
cin >> t;
c.push_back(t);
}
d.push_back(0);
c.push_back(0);
vector<GNode> graph;
for (unsigned long long i = 0; i < d.size(); i++) {
GNode t;
t.pos = i;
for (unsigned long long j = 1; j < d[i] + 1; j++) {
if (i + j <= n) {
t.childs.push_back(i + j);
}
}
graph.push_back(t);
}
vector<Node> oNodes;
vector<Node> cNodes;
Node t(0, graph[0].childs, 0, 0, 0);
oNodes.push_back(t);
bool done = false;
while (oNodes.size() != 0 && !done) {
sort(oNodes.begin(), oNodes.end(), compareNodes);
Node current = oNodes.back();
oNodes.pop_back();
cNodes.push_back(current);
if (current.pos == n) {
cout << current.g;
done = true;
break;
}
vector<unsigned long long> childs = current.childs;
for (auto child : childs) {
Node newNode(child, graph[child].childs, current.g + c[child - 1], n - child, (current.g + c[child - 1]) + (n - child));
auto it = find_if(oNodes.begin(), oNodes.end(), find_pos(child));
if (it != oNodes.end()) {
if (it->g < newNode.g) {
continue;
}
}
oNodes.push_back(newNode);
}
}
}