#include <algorithm>
using namespace std; 

int tempo_massimo(int N, int a[], int b[]){
    int tempo = 0;
    tempo = max(a[0],b[0]);
    for(int i = 1; i < N; i++){
        if((a[i] + a[i + 1]) < b [i]){
            somma = somma + b[i];
        } else{
            somma = somma + a[i];
        }
    }
    return somma;
}
