There are N covered bus shelters, labelled 1,…,N. The ith bus shelter can fit B_i people inside.
For each i∈1,…,N−1, there is a sidewalk connecting bus shelter i to bus shelter i+1, with an open-air market in the middle. The ith market has U_i umbrellas for sale, each costing 1$.
Right now, the ith market has P_i people inside, and every person is in a market so all the bus shelters are empty.
Suddenly, it starts raining, and everyone at market i has to decide between three possibilities:
If a person is unable to find a place in a bus shelter or buy an umbrella, they will get wet.
If everyone coordinates optimally, can they all stay dry? If so, what is the least amount of money they need to spend, and which bus shelter should each person move to?
The first line of input contains an integer N.
The second line of input contains N space-separated integers B_i (1≤i≤N), the capacity of bus shelter i.
The third line of input contains N−1 space-separated integers P_i (1≤i≤N−1), the number of people at market i.
The fourth line of input contains N−1 space-separated integers U_i (1≤i≤N−1), the number of umbrellas for sale at market i.
If every person can stay dry either under an umbrella or at a bus shelter, the output will be N+1 lines:
the first line will contain the word YES.
the second line will contain the least amount of money necessary to spend on umbrellas
the next N−1 lines will each contain three space-separated integers:
If not every person can stay dry, the output will be one line containing the word NO.
If there are multiple possible correct outputs, any correct output will be accepted.