CF724E Goods transportation

Description

There are $ n $ cities located along the one-way road. Cities are numbered from $ 1 $ to $ n $ in the direction of the road. The $ i $ -th city had produced $ p_{i} $ units of goods. No more than $ s_{i} $ units of goods can be sold in the $ i $ -th city. For each pair of cities $ i $ and $ j $ such that $ 1

Input Format

The first line of the input contains two integers $ n $ and $ c $ ( $ 1

Output Format

Print the maximum total number of produced goods that can be sold in all cities after a sequence of transportations.