1210: 语文成绩

文件提交:无需freopen 内存限制:128 MB 时间限制:1.000 S
评测方式:普通裁判 命题人:
提交:1 解决:1

题目描述

语文老师总是写错成绩,所以当她修改成绩的时候,总是累得不行。她总是要一遍遍地给某些同学增加分数,又要注意最低分是多少。你能帮帮她吗?


输入

第一行有两个整数 n,p,代表学生数与增加分数的次数。
第二行有 n 个数,a1∼an,代表各个学生的初始成绩。
接下来 p 行,每行有三个数,x,y,z,代表给第 x 个到第 y 个学生每人增加 z 分。

输出

输出仅一行,代表更改分数后,全班的最低分。

样例输入

3 2
1 1 1
1 2 1
2 3 1

样例输出

2

提示

对于 lns="http://www.w3.org/1998/Math/MathML">40% 的数据,有 lns="http://www.w3.org/1998/Math/MathML">103

对于 lns="http://www.w3.org/1998/Math/MathML">60% 的数据,有 lns="http://www.w3.org/1998/Math/MathML">104

对于 lns="http://www.w3.org/1998/Math/MathML">80% 的数据,有 lns="http://www.w3.org/1998/Math/MathML">105

对于 lns="http://www.w3.org/1998/Math/MathML">100% 的数据,有 lns="http://www.w3.org/1998/Math/MathML">5×106lns="http://www.w3.org/1998/Math/MathML">,学生初始成绩 lns="http://www.w3.org/1998/Math/MathML">100lns="http://www.w3.org/1998/Math/MathML">100