Greg has an array a = a_1, a_2, ..., a_{n} and m operations. Each operation looks as: l_{i}, r_{i}, d_{i}, (1 ≤ l_{i} ≤ r_{i} ≤ n). To apply operation i to the array means to increase all array elements with numbers l_{i}, l_{i} + 1, ..., r_{i} by value d_{i}.

Greg wrote down k queries on a piece of paper. Each query has the following form: x_{i}, y_{i}, (1 ≤ x_{i} ≤ y_{i} ≤ m). That means that one should apply operations with numbers x_{i}, x_{i} + 1, ..., y_{i} to the array.

Now Greg is wondering, what the array a will be after all the queries are executed. Help Greg.


-----Input-----

The first line contains integers n, m, k (1 ≤ n, m, k ≤ 10^5). The second line contains n integers: a_1, a_2, ..., a_{n} (0 ≤ a_{i} ≤ 10^5) — the initial array.

Next m lines contain operations, the operation number i is written as three integers: l_{i}, r_{i}, d_{i}, (1 ≤ l_{i} ≤ r_{i} ≤ n), (0 ≤ d_{i} ≤ 10^5).

Next k lines contain the queries, the query number i is written as two integers: x_{i}, y_{i}, (1 ≤ x_{i} ≤ y_{i} ≤ m).

The numbers in the lines are separated by single spaces.


-----Output-----

On a single line print n integers a_1, a_2, ..., a_{n} — the array after executing all the queries. Separate the printed numbers by spaces.

Please, do not use the %lld specifier to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams of the %I64d specifier.


-----Examples-----
Input
3 3 3
1 2 3
1 2 1
1 3 2
2 3 4
1 2
1 3
2 3

Output
9 18 17

Input
1 1 1
1
1 1 1
1 1

Output
2

Input
4 3 6
1 2 3 4
1 2 1
2 3 2
3 4 4
1 2
1 3
2 3
1 2
1 3
2 3

Output
5 18 31 20

Source: codeforces | Difficulty: MEDIUM
Tags: Data structures

Implementation


Solutions:
def GregAndArray():
	(lenArray, numOperations, numQueries) = map(int, input().split())
	initialArray = list(map(int, input().split()))
	instructions = [list(map(int, input().split())) for _ in range(numOperations)]
	modifiedArray = [0 for _ in range(lenArray + 1)]
	queries = [0 for _ in range(numOperations + 1)]
	for _ in range(numQueries):
		(x, y) = map(int, input().split())
		queries[x - 1] += 1
		queries[y] -= 1
	temp = 0
	for i in range(numOperations):
		temp += queries[i]
		modifiedArray[instructions[i][0] - 1] += temp * instructions[i][2]
		modifiedArray[instructions[i][1]] -= temp * instructions[i][2]
	temp = 0
	toReturn = ''
	for i in range(lenArray):
		temp += modifiedArray[i]
		toReturn += str(temp + initialArray[i]) + ' '
	print(toReturn)
GregAndArray()


from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def smp():
	return map(str, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b
S1 = 'abcdefghijklmnopqrstuvwxyz'
S2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
(n, m, k) = mp()
arr = lmp()
ml = [tuple(mp()) for i in range(m)]
quer = l1d(m + 1)
for i in range(k):
	(x, y) = mp()
	quer[x - 1] += 1
	quer[y] -= 1
for i in range(1, m + 1):
	quer[i] += quer[i - 1]
incr = l1d(n + 1)
for i in range(m):
	(x, y, z) = ml[i]
	incr[x - 1] += z * quer[i]
	incr[y] -= z * quer[i]
for i in range(1, n + 1):
	incr[i] += incr[i - 1]
for i in range(n):
	print(arr[i] + incr[i], end=' ')
print()


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
ops = [list(map(int, input().split())) for _ in range(m)]
qus = [list(map(int, input().split())) for _ in range(k)]
starts = [0] * (m + 1)
for (l, r) in qus:
	starts[l - 1] += 1
	starts[r] -= 1
opcount = [0] * m
active = 0
for i in range(m):
	active += starts[i]
	opcount[i] = active
suffixOffset = [0] * (n + 1)
for i in range(m):
	(l, r, d) = ops[i]
	suffixOffset[l - 1] += opcount[i] * d
	suffixOffset[r] -= opcount[i] * d
active = 0
for i in range(n):
	active += suffixOffset[i]
	a[i] += active
print(*a)


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions, statistics
from collections import deque, defaultdict, OrderedDict, Counter
from fractions import Fraction
from decimal import Decimal
from sys import stdout
from heapq import heappush, heappop, heapify, _heapify_max, _heappop_max, nsmallest, nlargest
sys.setrecursionlimit(111111)
INF = 99999999999999999999999999999999

def main():
	mod = 1000000007
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	tc = 1
	for _ in range(tc):
		(n, m, k) = ria()
		arr = ria()
		operations = []
		queries = []
		ansrange = [0] * (n + 5)
		oprange = [0] * (m + 5)
		for i in range(m):
			operations.append(ria())
		for i in range(k):
			(a, b) = ria()
			oprange[a - 1] += 1
			oprange[b] -= 1
		for i in range(1, len(oprange)):
			oprange[i] += oprange[i - 1]
		for i in range(len(oprange)):
			if oprange[i]:
				(l, r, d) = operations[i]
				ansrange[l] += d * oprange[i]
				ansrange[r + 1] -= d * oprange[i]
		for i in range(1, n + 1):
			ansrange[i] += ansrange[i - 1]
			arr[i - 1] += ansrange[i]
		wia(arr)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


import sys

def solve():
	(n, m, k) = map(int, input().split())
	nums = list(map(int, input().split()))
	ops = [tuple(map(int, input().split())) for _ in range(m)]
	queries = [tuple(map(int, input().split())) for _ in range(k)]
	cnt_ops = [0 for i in range(m + 1)]
	for (l, r) in queries:
		l -= 1
		r -= 1
		cnt_ops[l] += 1
		cnt_ops[r + 1] -= 1
	for i in range(1, m + 1):
		cnt_ops[i] = cnt_ops[i - 1] + cnt_ops[i]
	deltas = [0 for i in range(n + 1)]
	for (ind, (l, r, d)) in enumerate(ops):
		l -= 1
		r -= 1
		deltas[l] += d * cnt_ops[ind]
		deltas[r + 1] -= d * cnt_ops[ind]
	sum_delta = [0 for i in range(n)]
	for i in range(n):
		if i == 0:
			sum_delta[i] = deltas[0]
		else:
			sum_delta[i] = sum_delta[i - 1] + deltas[i]
	for i in range(n):
		nums[i] += sum_delta[i]
		print(nums[i], end=' ')
input = sys.stdin.readline
solve()


first_line = [int(num) for num in input().split()]
n = first_line[0]
m = first_line[1]
k = first_line[2]
initial_array = [int(num) for num in input().split()]
operations = []
for _ in range(m):
	curr_line = [int(num) for num in input().split()]
	operations.append(curr_line)
queries = []
for _ in range(k):
	curr_line = [int(num) for num in input().split()]
	queries.append(curr_line)
counter = [0] * (m + 1)
for query in queries:
	x = query[0]
	y = query[1]
	counter[x - 1] += 1
	counter[y] -= 1
res = 0
other = [0] * (n + 1)
for index in range(m):
	operation = operations[index]
	l = operation[0]
	r = operation[1]
	d = operation[2]
	res += counter[index]
	other[l - 1] += res * d
	other[r] -= res * d
res = 0
for index in range(n):
	res += other[index]
	initial_array[index] += res
print(' '.join((str(value) for value in initial_array)))


import os
import sys
from io import BytesIO, IOBase
from collections import defaultdict
import math
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
(n, m, k) = map(int, input().split(' '))
l = list(map(int, input().split(' ')))
a = [0] * (m + 1)
z = [list(map(int, input().split(' '))) for _ in range(m)]
for i in range(k):
	(x, y) = map(int, input().split(' '))
	a[x - 1] += 1
	a[y] -= 1
for i in range(1, m):
	a[i] += a[i - 1]
ans = [0] * (n + 1)
for i in range(m):
	x = z[i][0]
	ad = z[i][2]
	y = z[i][1]
	ans[x - 1] += ad * a[i]
	ans[y] -= ad * a[i]
l[0] += ans[0]
for i in range(1, n):
	ans[i] += ans[i - 1]
	l[i] = l[i] + ans[i]
print(*l)


(n, m, k) = map(int, input().strip().split())
a = [int(i) for i in input().split()]
l = [0] * m
r = [0] * m
d = [0] * m
j = m + 1
arr = [0] * j
for i in range(m):
	(t, o, v) = map(int, input().strip().split())
	l[i] = t
	r[i] = o
	d[i] = v
while k > 0:
	(x, y) = map(int, input().strip().split())
	x -= 1
	y -= 1
	pp = arr[x]
	uu = arr[y + 1]
	arr[x] = pp + 1
	arr[y + 1] = uu - 1
	k -= 1
for i in range(1, m):
	ss = arr[i]
	arr[i] = ss + arr[i - 1]
arr1 = [0] * (n + 1)
for i in range(m):
	mm = l[i]
	nn = r[i]
	mm -= 1
	nn -= 1
	arr1[mm] += arr[i] * d[i]
	arr1[nn + 1] -= arr[i] * d[i]
for i in range(1, n):
	hh = arr1[i]
	arr1[i] = hh + arr1[i - 1]
l = [0] * n
for i in range(n):
	l[i] = a[i] + arr1[i]
print(' '.join(map(str, l)))


def solve():
	(n, m, k) = map(int, input().strip().split())
	array = list(map(int, input().strip().split()))
	ops = [tuple(map(int, input().strip().split())) for _ in range(m)]
	applied = [0 for _ in range(m + 1)]
	qs = [tuple(map(int, input().strip().split())) for _ in range(k)]
	for (x, y) in qs:
		applied[x - 1] += 1
		applied[y] -= 1
	cumadds = [0 for _ in range(n + 1)]
	repeats = 0
	for (i, (l, r, d)) in enumerate(ops):
		repeats += applied[i]
		cumadds[l - 1] += repeats * d
		cumadds[r] -= repeats * d
	cum = 0
	for (i, cumadd) in zip(range(n), cumadds):
		cum += cumadd
		array[i] += cum
	print(*array)
solve()


def main():
	(n, m, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	ops = [0] * m
	ops_arr = []
	for i in range(m):
		(l, r, d) = map(int, input().split())
		ops_arr.append([l, r, d])
	for i in range(k):
		(x, y) = map(int, input().split())
		x -= 1
		y -= 1
		ops[x] += 1
		if y + 1 < m:
			ops[y + 1] -= 1
	for i in range(1, m):
		ops[i] += ops[i - 1]
	for i in range(m):
		ops_arr[i][2] *= ops[i]
	ans = [0] * n
	for op in ops_arr:
		(l, r, d) = (op[0], op[1], op[2])
		l -= 1
		r -= 1
		ans[l] += d
		if r + 1 < n:
			ans[r + 1] -= d
	for i in range(1, n):
		ans[i] += ans[i - 1]
	for i in range(n):
		ans[i] += arr[i]
	for i in ans:
		print(i, end=' ')
main()


from sys import stdin, stdout
nmbr = lambda : int(stdin.readline())
lst = lambda : list(map(int, stdin.readline().split()))
for _ in range(1):
	(n, m, q) = lst()
	a = lst()
	queries = [lst() for _ in range(m)]
	mp = [0] * (2 + m)
	for i in range(q):
		(l, r) = lst()
		mp[l] += 1
		mp[r + 1] -= 1
	for i in range(1, m + 1):
		mp[i] += mp[i - 1]
	for i in range(1, m + 1):
		queries[i - 1][2] *= mp[i]
	dp = [0] * (n + 2)
	for (l, r, cost) in queries:
		dp[l] += cost
		dp[r + 1] -= cost
	for i in range(1, n + 1):
		dp[i] += dp[i - 1]
	for i in range(n):
		stdout.write(str(dp[i + 1] + a[i]) + ' ')


import sys
input = sys.stdin.readline
(n, m, k) = map(int, input().split())
li = list(map(int, input().split()))
l = [0] * n
qe = []
for i in range(m):
	(ll, r, d) = map(int, input().split())
	qe.append((ll, r, d))
arr = [0] * m
for i in range(k):
	(ll, r) = map(int, input().split())
	if r < m:
		arr[r] -= 1
	arr[ll - 1] += 1
for i in range(1, m):
	arr[i] = arr[i] + arr[i - 1]
for i in range(m):
	(ll, r, d) = qe[i]
	if r < n:
		l[r] -= d * arr[i]
	l[ll - 1] += d * arr[i]
for i in range(1, n):
	l[i] = l[i] + l[i - 1]
for i in range(n):
	l[i] += li[i]
print(*l)


import sys

def solve(r, w):
	data = r.readline().split()
	num_elems = int(data[0])
	num_ops = int(data[1])
	num_queries = int(data[2])
	elem_list = [int(x) for x in r.readline().split()]
	a = [0] * (num_ops + 1)
	b = [0] * (num_elems + 1)
	op_list = []
	for _ in range(num_ops):
		op_list.append(tuple([int(x) for x in r.readline().split()]))
	for _ in range(num_queries):
		query = [int(x) for x in r.readline().split()]
		a[query[0] - 1] += 1
		a[query[1]] -= 1
	c = 0
	for (i, cur_op) in enumerate(op_list):
		cur_op = op_list[i]
		c += a[i]
		b[cur_op[0] - 1] += c * cur_op[2]
		b[cur_op[1]] -= c * cur_op[2]
	c = 0
	for (i, elem) in enumerate(elem_list):
		c += b[i]
		print(elem + c, end=' ')

def __starting_point():
	solve(sys.stdin, sys.stdout)
__starting_point()


import sys
(n, m, k) = [int(x) for x in sys.stdin.readline().strip().split(' ')]
arr = [int(x) for x in sys.stdin.readline().strip().split(' ')]
delta = []
delta.append(arr[0])
for i in range(1, n):
	delta.append(arr[i] - arr[i - 1])
ops = []
for i in range(m):
	(l, r, d) = [int(x) for x in sys.stdin.readline().strip().split(' ')]
	op = (l, r, d)
	ops.append(op)
num_calls = [0] * m
for i in range(k):
	(x, y) = [int(x) for x in sys.stdin.readline().strip().split(' ')]
	num_calls[x - 1] += 1
	if y < len(num_calls):
		num_calls[y] -= 1
calls = 0
for o in range(m):
	calls += num_calls[o]
	op = ops[o]
	l = op[0]
	r = op[1]
	d = op[2]
	c = calls * d
	delta[l - 1] += c
	if r < len(delta):
		delta[r] -= c
	o += 1
arr[0] = delta[0]
for i in range(1, n):
	arr[i] = delta[i] + arr[i - 1]
print(' '.join((str(x) for x in arr)))


from sys import *
rd = lambda : list(map(int, stdin.readline().split()))
(n, m, k) = rd()
a = rd()
b = [rd() for _ in range(m)]
x = [0] * (m + 1)
y = [0] * (n + 1)
for _ in range(k):
	(l, r) = rd()
	x[l - 1] += 1
	x[r] -= 1
s = 0
for i in range(m):
	(l, r, d) = b[i]
	s += x[i]
	y[l - 1] += s * d
	y[r] -= s * d
s = 0
for i in range(n):
	s += y[i]
	a[i] += s
print(*a)


import itertools
import sys
input = sys.stdin.readline

def main(args):
	(n, m, k) = map(int, input().split())
	a = list(map(int, input().split()))
	op = [0] * m
	query = [0] * m
	plus = [0] * n
	for i in range(m):
		(l, r, d) = map(int, input().split())
		op[i] = (l - 1, r - 1, d)
	for q in range(k):
		(x, y) = map(lambda x: int(x) - 1, input().split())
		query[x] += 1
		if y + 1 < m:
			query[y + 1] -= 1
	s = 0
	for i in range(m):
		(l, r, d) = op[i]
		s += query[i]
		plus[l] += s * d
		if r + 1 < n:
			plus[r + 1] -= s * d
	s = 0
	for i in range(n):
		s += plus[i]
		a[i] += s
	print(*a)
main(sys.argv[1:])


read_input = lambda : list(map(int, input().split()))
(n, m, k) = read_input()
init_array = read_input()
operations = [read_input() for _ in range(m)]
additionals = [0] * (m + 1)
sums = [0] * (n + 1)
for _ in range(k):
	(x, y) = read_input()
	additionals[x - 1] += 1
	additionals[y] -= 1
sum_so_far = 0
for i in range(m):
	(l, r, val_to_add) = operations[i]
	sum_so_far += additionals[i]
	sums[l - 1] += sum_so_far * val_to_add
	sums[r] -= sum_so_far * val_to_add
sum_so_far = 0
for i in range(n):
	sum_so_far += sums[i]
	init_array[i] += sum_so_far
print(' '.join(map(str, init_array)))


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
op = [list(map(int, input().split())) for i in range(m)]
val = [0] * (m + 2)
for i in range(k):
	(x, y) = map(int, input().split())
	val[x] += 1
	val[y + 1] -= 1
val1 = [0] * (n + 2)
for i in range(m):
	(x, y, z) = op[i]
	val[i + 1] += val[i]
	val1[x] += val[i + 1] * z
	val1[y + 1] -= val[i + 1] * z
for i in range(n):
	val1[i + 1] += val1[i]
	print(a[i] + val1[i + 1], end=' ')


from itertools import accumulate
(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
oper = [tuple(map(int, input().split())) for i in range(m)]
zapr = [tuple(map(int, input().split())) for i in range(k)]
count_ = [0 for i in range(m + 1)]
for el in zapr:
	(x, y) = el
	count_[x - 1] += 1
	count_[y] -= 1
counter_ = list(accumulate(count_))[:-1]
a.append(0)
a_count = [a[0]]
for (i, el) in enumerate(a[1:]):
	a_count.append(el - a[i])
for (i, el) in enumerate(oper):
	(l, r, d) = el
	d *= counter_[i]
	a_count[l - 1] += d
	a_count[r] -= d
a = list(accumulate(a_count))[:-1]
print(' '.join(map(str, a)))


def __starting_point():
	(n, m, k) = list(map(int, input().split()))
	nums = list(map(int, input().split()))
	operations = [tuple(map(int, input().split())) for _ in range(m)]
	op_counter = [0] * (m + 1)
	for _ in range(k):
		(x, y) = list(map(int, input().split()))
		op_counter[x - 1] += 1
		op_counter[y] -= 1
	acc = 0
	offset = [0] * (n + 1)
	for i in range(m):
		(l, r, d) = operations[i]
		acc += op_counter[i]
		offset[l - 1] += acc * d
		offset[r] -= acc * d
	acc = 0
	for i in range(n):
		acc += offset[i]
		nums[i] += acc
	print(' '.join(map(str, nums)))
__starting_point()


R = lambda : list(map(int, input().split()))

def modif(lst):
	lst[0] -= 1
	lst[1] -= 1
	return lst
(n, m, k) = R()
a = R()
op = [modif(R()) for i in range(m)]
b = [0] * n
cnt = [0] * m
for i in range(k):
	(l, r) = R()
	l -= 1
	r -= 1
	cnt[l] += 1
	try:
		cnt[r + 1] -= 1
	except:
		pass
q = [0] * m
toadd = 0
for (i, v) in enumerate(cnt):
	toadd += v
	q[i] += toadd
for (i, v) in enumerate(q):
	b[op[i][0]] += op[i][2] * v
	try:
		b[op[i][1] + 1] -= op[i][2] * v
	except:
		pass
toadd = 0
for (i, v) in enumerate(b):
	toadd += v
	a[i] += toadd
print(*a)


def main():
	(n, m, k) = list(map(int, input().split()))
	aa = list(map(int, input().split()))
	lrd = list((tuple(map(int, input().split())) for _ in range(m)))
	cnt = [0] * (m + 1)
	for _ in range(k):
		(x, y) = list(map(int, input().split()))
		cnt[x - 1] += 1
		cnt[y] -= 1
	(delta, c) = ([0] * (n + 1), 0)
	for ((l, r, d), dc) in zip(lrd, cnt):
		c += dc
		d *= c
		delta[l - 1] += d
		delta[r] -= d
	da = 0
	for (i, a, d) in zip(list(range(n)), aa, delta):
		da += d
		aa[i] = a + da
	print(' '.join(map(str, aa)))

def __starting_point():
	main()
__starting_point()


import sys
input = sys.stdin.readline
(n, m, k) = map(int, input().split())
arr = list(map(int, input().split()))
querry_arr = [list(map(int, input().split())) for _ in range(m)]
tmp_ans = [0] * n
tmp = [0] * (m + 1)
for _ in range(k):
	(l, r) = map(lambda k: int(k) - 1, input().split())
	tmp[l] += 1
	tmp[r + 1] -= 1
for x in range(1, m):
	tmp[x] += tmp[x - 1]
arr_tmp = [0] * (n + 1)
tmp.pop()
for x in range(m):
	(u, v, w) = querry_arr[x]
	u -= 1
	v -= 1
	arr_tmp[u] += w * tmp[x]
	arr_tmp[v + 1] -= w * tmp[x]
arr[0] += arr_tmp[0]
for x in range(1, n):
	arr_tmp[x] += arr_tmp[x - 1]
	arr[x] += arr_tmp[x]
print(' '.join(map(str, arr)))


def process_query(queries, m):
	n = len(queries)
	a = [0] * (m + 1)
	for q in queries:
		a[q[0] - 1] += 1
		a[q[1]] -= 1
	for i in range(1, m):
		a[i] += a[i - 1]
	return a[:-1]

def apply_query(times, updates, n):
	a = [0] * (n + 1)
	for i in range(len(updates)):
		a[updates[i][0] - 1] += times[i] * updates[i][2]
		a[updates[i][1]] -= times[i] * updates[i][2]
	for i in range(1, n):
		a[i] += a[i - 1]
	return a[:-1]

def main():
	(n, m, k) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	updates = [list(map(int, input().split())) for i in range(m)]
	queries = [list(map(int, input().split())) for i in range(k)]
	times_query = process_query(queries, m)
	updated_a = apply_query(times_query, updates, n)
	print(*[a[i] + updated_a[i] for i in range(n)])

def __starting_point():
	main()
__starting_point()


from sys import stdin
(n, nOp, nQ) = map(int, stdin.readline().split())
a = list(map(int, stdin.readline().split()))
ops = [tuple(map(int, stdin.readline().split())) for _ in range(nOp)]
times = [0] * (nOp + 1)
for _ in range(nQ):
	(l, r) = map(int, stdin.readline().split())
	times[l - 1] += 1
	times[r] -= 1
delta = [0] * (n + 1)
acc = 0
for (i, (l, r, d)) in enumerate(ops):
	acc += times[i]
	delta[l - 1] += d * acc
	delta[r] -= d * acc
acc = 0
for i in range(n):
	acc += delta[i]
	a[i] += acc
print(*a)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
l1 = [0] * (n + 1)
l2 = [0] * (m + 1)
l3 = [0] * m
for i in range(m):
	(l, r, d) = map(int, input().split())
	l3[i] = (l, r, d)
for i in range(k):
	(x, y) = map(int, input().split())
	l2[x - 1] += 1
	l2[y] -= 1
for i in range(1, m):
	l2[i] += l2[i - 1]
for i in range(m):
	l1[l3[i][0] - 1] += l3[i][2] * l2[i]
	l1[l3[i][1]] -= l3[i][2] * l2[i]
for i in range(1, n):
	l1[i] += l1[i - 1]
for i in range(n):
	print(a[i] + l1[i], end=' ')
print()


R = lambda : map(int, input().split())
(n, m, k) = R()
a = [int(x) for x in input().split()]
op = []
for _ in range(m):
	(l, r, d) = R()
	op.append((l, r, d))
b = [0] * (n + 1)
e = [0] * (m + 1)
operations = [0] * m
for _ in range(k):
	(x, y) = R()
	e[x - 1] += 1
	e[y] -= 1
cnt = 0
for i in range(m):
	cnt += e[i]
	(l, r, d) = op[i]
	b[l - 1] += cnt * d
	b[r] -= cnt * d
cnt = 0
for i in range(n):
	cnt += b[i]
	a[i] += cnt
print(' '.join(map(str, a)))


import sys
(n, m, k) = map(int, sys.stdin.readline().split())
arr = [x for x in map(int, sys.stdin.readline().split())]
ops = []
for x in range(m):
	ops.append(map(int, sys.stdin.readline().split()))
c = [0] * m
for x in range(k):
	(l, r) = map(int, sys.stdin.readline().split())
	c[l - 1] += 1
	if r < m:
		c[r] -= 1
times_used = [0] * m
times_used[0] = c[0]
for x in range(1, m):
	times_used[x] = times_used[x - 1] + c[x]
c1 = [0] * n
for x in range(m):
	(l, r, d) = ops[x]
	c1[l - 1] += times_used[x] * d
	if r < n:
		c1[r] -= times_used[x] * d
amount_added = [0] * n
amount_added[0] = c1[0]
arr[0] += amount_added[0]
for x in range(1, n):
	amount_added[x] = amount_added[x - 1] + c1[x]
	arr[x] += amount_added[x]
print(*arr, sep=' ', end='\n')


from sys import stdin, stdout
(n, m, k) = map(int, stdin.readline().split())
t = list(map(int, stdin.readline().split()))
p = [tuple(map(int, stdin.readline().split())) for i in range(m)]
(r, s) = ([0] * (m + 1), [0] * (n + 1))
(R, S) = (0, 0)
for i in range(k):
	(x, y) = map(int, stdin.readline().split())
	r[x - 1] += 1
	r[y] -= 1
for (i, (x, y, d)) in enumerate(p):
	R += r[i]
	d = d * R
	s[x - 1] += d
	s[y] -= d
for i in range(n):
	S += s[i]
	t[i] = str(t[i] + S)
stdout.write(' '.join(map(str, t)))


from sys import stdout, stdin, setrecursionlimit
from io import BytesIO, IOBase
from collections import *
from itertools import *
from bisect import *
from string import *
from queue import *
from heapq import *
from math import *
from re import *
from os import *

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = read(self._fd, max(fstat(self._fd).st_size, 8192))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = read(self._fd, max(fstat(self._fd).st_size, 8192))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(stdin, stdout) = (IOWrapper(stdin), IOWrapper(stdout))
(graph, mod, szzz) = ({}, 10 ** 9 + 7, lambda : sorted(zzz()))

def getStr():
	return input()

def getInt():
	return int(input())

def listStr():
	return list(input())

def getStrs():
	return input().split()

def isInt(s):
	return '0' <= s[0] <= '9'

def input():
	return stdin.readline().strip()

def zzz():
	return [int(i) for i in input().split()]

def output(answer, end='\n'):
	stdout.write(str(answer) + end)

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)
dx = [-1, 1, 0, 0, 1, -1, 1, -1]
dy = [0, 0, 1, -1, 1, -1, -1, 1]
daysInMounth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
(n, m, k) = zzz()
arr = zzz()
lst = []
for i in range(m):
	lst.append(zzz())
xx = [0] * (m + 1)
for i in range(k):
	(l, r) = zzz()
	xx[l - 1] += 1
	xx[r] -= 1
s = 0
yy = [0] * (n + 1)
for i in range(m):
	(l, r, d) = lst[i]
	s += xx[i]
	yy[l - 1] += s * d
	yy[r] -= s * d
s = 0
for i in range(n):
	s += yy[i]
	arr[i] += s
print(*arr)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))[:n]
s = []
x = [0] * (m + 1)
y = [0] * (n + 1)
for i in range(m):
	(l, r, d) = map(int, input().split())
	s.append((l, r, d))
for i in range(k):
	(j, v) = map(int, input().split())
	x[j - 1] += 1
	x[v] -= 1
cnt = 0
for i in range(m):
	cnt += x[i]
	(l, r, d) = s[i]
	y[l - 1] += cnt * d
	y[r] -= cnt * d
cnt1 = 0
for i in range(n):
	cnt1 += y[i]
	a[i] += cnt1
print(*a[:n])


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
b = [0] * (m + 1)
c = [0] * (n + 1)
bb = []
for i in range(m):
	(l, r, d) = map(int, input().split())
	bb.append([l, r, d])
for i in range(k):
	(x, y) = map(int, input().split())
	b[x - 1] += 1
	b[y] -= 1
cnt = 0
for j in range(m):
	cnt += b[j]
	bb[j][2] *= cnt
for i in range(m):
	c[bb[i][0] - 1] += bb[i][2]
	c[bb[i][1]] -= bb[i][2]
cnt = 0
for i in range(n):
	cnt += c[i]
	a[i] += cnt
print(*a)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
operations = []
for i in range(m):
	operations.append(list(map(int, input().split())))
operations_count = [0] * (m + 1)
for i in range(k):
	(x, y) = map(int, input().split())
	operations_count[x - 1] += 1
	operations_count[y] -= 1
for i in range(1, m):
	operations_count[i] += operations_count[i - 1]
add = [0] * (n + 1)
for i in range(m):
	(left, right, addition) = (operations[i][0], operations[i][1], operations[i][2] * operations_count[i])
	add[left - 1] += addition
	add[right] -= addition
for i in range(1, n):
	add[i] += add[i - 1]
for i in range(n):
	a[i] += add[i]
for i in a:
	print(i, end=' ')
print('')


import sys

class Operation:

	def __init__(self, left, right, value):
		self.left = left
		self.right = right
		self.value = value

def main():
	data = [line.rstrip().split() for line in sys.stdin.readlines()]
	data = [[int(x) for x in row] for row in data]
	num_elements = data[0][0]
	num_ops = data[0][1]
	num_queries = data[0][2]
	l = [0] * 100000
	r = [0] * 100000
	d = [0] * 100000
	elements = [0] * 100000
	inc = [0] * 100001
	dInA = [0] * 100001
	for i in range(num_elements):
		elements[i] = data[1][i]
	for i in range(num_ops):
		l[i] = data[i + 2][0]
		r[i] = data[i + 2][1]
		d[i] = data[i + 2][2]
	for i in range(num_queries):
		x = data[i + num_ops + 2][0]
		y = data[i + num_ops + 2][1]
		inc[x - 1] += 1
		inc[y] -= 1
	c = 0
	for i in range(num_ops):
		c += inc[i]
		newValueD = c * d[i]
		dInA[l[i] - 1] += newValueD
		dInA[r[i]] -= newValueD
	c = 0
	for i in range(num_elements):
		c += dInA[i]
		if i:
			print(' ')
		print(str(c + elements[i]))
main()


from sys import stdout as out

def solve():
	(n, m, k) = map(int, input().rstrip().split())
	ls = list(map(int, input().rstrip().split()))
	q = [tuple(map(int, input().rstrip().split())) for _ in range(m)]
	o = [tuple(map(int, input().rstrip().split())) for _ in range(k)]
	counter = [0 for i in range(m + 1)]
	for (l, r) in o:
		counter[l - 1] += 1
		counter[r] -= 1
	running = [0 for i in range(n + 1)]
	total = 0
	index = 0
	for (l, r, d) in q:
		total += counter[index]
		running[l - 1] += total * d
		running[r] -= total * d
		index += 1
	dp = 0
	for i in range(n):
		dp += running[i]
		out.write(str(dp + ls[i]) + ' ')
	print()
solve()


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
(n, m, k) = map(int, input().split())
l = list(map(int, input().split()))
op = []
for i in range(m):
	op.append(list(map(int, input().split())))
kk = []
for i in range(k):
	kk.append(list(map(int, input().split())))
da1 = [0] * (1 + m)
for (s, e) in kk:
	da1[s] += 1
	if e + 1 < m + 1:
		da1[e + 1] -= 1
r = 0
for i in range(1, m + 1):
	r += da1[i]
	op[i - 1][2] *= r
da2 = [-1] + [l[0]]
for i in range(n - 1):
	da2.append(l[i + 1] - l[i])
for (s, e, w) in op:
	da2[s] += w
	if e + 1 < n + 1:
		da2[e + 1] -= w
r = 0
for i in range(1, n + 1):
	r += da2[i]
	print(r, end=' ')


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
ope = []
for _ in range(m):
	(l, r, d) = map(int, input().split())
	ope.append((l - 1, r - 1, d))
app = [0 for _ in range(m)]
for _ in range(k):
	(x, y) = map(int, input().split())
	x -= 1
	y -= 1
	app[x] += 1
	if y + 1 < m:
		app[y + 1] -= 1
arr = [0] * n
val = 0
for i in range(m):
	val += app[i]
	(l, r, d) = ope[i]
	arr[l] += d * val
	if r + 1 < n:
		arr[r + 1] -= d * val
val = 0
for i in range(n):
	val += arr[i]
	a[i] += val
print(' '.join(map(str, a)))


import sys
(n, m, k) = map(int, sys.stdin.readline().split())
arr = list(map(int, sys.stdin.readline().split()))
d = {}
for i in range(m):
	d[i] = list(map(int, sys.stdin.readline().split()))
op_count = [0] * (m + 5)
for i in range(k):
	(x, y) = map(int, sys.stdin.readline().split())
	op_count[x - 1] += 1
	op_count[y] -= 1
c = len(op_count)
for i in range(1, c):
	op_count[i] += op_count[i - 1]
inc_arr = [0] * (n + 5)
for i in range(c):
	if op_count[i] > 0:
		(l, r, inc) = d[i]
		inc *= op_count[i]
		inc_arr[l - 1] += inc
		inc_arr[r] -= inc
for i in range(1, len(inc_arr)):
	inc_arr[i] += inc_arr[i - 1]
for i in range(n):
	arr[i] += inc_arr[i]
print(*arr)


maxn = 100000.0
(n, m, k) = input().split(' ')
n = int(n)
m = int(m)
k = int(k)
a = input().split(' ')
for i in range(len(a)):
	a[i] = int(a[i])
for i in range(len(a) - 1, 0, -1):
	a[i] -= a[i - 1]
a.append(0)
L = []
R = []
d = []
cnt = []
for i in range(m):
	t = input().split(' ')
	L.append(int(t[0]))
	R.append(int(t[1]))
	d.append(int(t[2]))
	cnt.append(0)
cnt.append(0)
for i in range(k):
	(x, y) = input().split(' ')
	x = int(x)
	y = int(y)
	cnt[x - 1] += 1
	cnt[y] -= 1
for i in range(1, m):
	cnt[i] += cnt[i - 1]
for i in range(m):
	a[L[i] - 1] += d[i] * cnt[i]
	a[R[i]] -= d[i] * cnt[i]
for i in range(1, n):
	a[i] += a[i - 1]
for i in range(n):
	print(a[i], end=' ')
print('')


from sys import stdin, stdout
(n, m, k) = map(int, stdin.readline().split())
a = [0]
a = a + list(map(int, stdin.readline().split()))
op = [0]
mn = [0] * (m + 2)
kp = [0] * (n + 2)
for i in range(m):
	op.append(list(map(int, stdin.readline().split())))
for i in range(k):
	(x, y) = map(int, stdin.readline().split())
	mn[x] += 1
	mn[y + 1] -= 1
for i in range(1, m + 1):
	mn[i] += mn[i - 1]
	op[i][2] *= mn[i]
	kp[op[i][0]] += op[i][2]
	kp[op[i][1] + 1] -= op[i][2]
for i in range(1, n + 1):
	kp[i] += kp[i - 1]
for i in range(1, n + 1):
	print(str(a[i] + kp[i]), end=' ')


(n, m, k) = map(int, input().split())
a = [int(q) for q in input().split()]
p = []
u = [0] * m
for i in range(m):
	r = [int(w) for w in input().split()]
	p.append(r)
for i in range(k):
	(x, y) = map(int, input().split())
	u[x - 1] += 1
	if y <= m - 1:
		u[y] -= 1
for i in range(1, len(u)):
	u[i] += u[i - 1]
ans = [0 for i in range(n)]
for i in range(m):
	(l, r, d) = p[i]
	ans[l - 1] += d * u[i]
	if r <= n - 1:
		ans[r] -= d * u[i]
for i in range(1, n):
	ans[i] += ans[i - 1]
for i in range(n):
	a[i] += ans[i]
print(*a)


(n, m, k) = list(map(int, input().split()))
arr = list(map(int, input().split()))
val = []
for i in range(m):
	(l, r, d) = list(map(int, input().split()))
	val.append([l, r, d])
queries = [0 for i in range(m)]
for i in range(k):
	(x, y) = list(map(int, input().split()))
	queries[x - 1] += 1
	if y <= m - 1:
		queries[y] -= 1
for i in range(1, len(queries)):
	queries[i] += queries[i - 1]
ans = [0 for i in range(n)]
for i in range(m):
	(l, r, d) = val[i]
	ans[l - 1] += d * queries[i]
	if r <= n - 1:
		ans[r] -= d * queries[i]
for i in range(1, n):
	ans[i] += ans[i - 1]
for i in range(n):
	arr[i] += ans[i]
print(*arr)


import sys

def answer(n, m, k, a, ops, q):
	cnt_m = [0 for i in range(m + 1)]
	for i in range(k):
		l = q[i][0]
		r = q[i][1]
		cnt_m[l - 1] += 1
		cnt_m[r] -= 1
	summ_a = [0 for i in range(n + 1)]
	s = 0
	for i in range(m):
		d = ops[i][2]
		s += cnt_m[i]
		summ = s * d
		l = ops[i][0]
		r = ops[i][1]
		summ_a[l - 1] += summ
		summ_a[r] -= summ
	s = 0
	for i in range(n):
		s += summ_a[i]
		a[i] += s
	return ' '.join(map(str, a))

def main():
	(n, m, k) = map(int, sys.stdin.readline().split())
	a = list(map(int, sys.stdin.readline().split()))
	ops = [0 for i in range(m)]
	q = [0 for i in range(k)]
	for i in range(m):
		ops[i] = list(map(int, sys.stdin.readline().split()))
	for j in range(k):
		q[j] = list(map(int, sys.stdin.readline().split()))
	print(answer(n, m, k, a, ops, q))
	return
main()


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
arr = []
b = [0] * (n + 1)
B = [0] * (m + 1)
for _ in range(m):
	arr.append(list(map(int, input().split())))
for _ in range(k):
	(x, y) = map(int, input().split())
	B[x - 1] += 1
	B[y] -= 1
c = 0
for i in range(len(arr)):
	(x, y, d) = arr[i]
	c += B[i]
	b[x - 1] += d * c
	b[y] -= d * c
a[0] = a[0] + b[0]
for i in range(1, n):
	b[i] += b[i - 1]
	a[i] += b[i]
print(*a)


int_list = lambda s: [int(n) for n in s.split(' ')]
(n, m, k) = int_list(input())
arr = int_list(input())
operations = [int_list(input()) for _ in range(m)]
incrs = [0] * len(arr)
freq = [0] * m
for _ in range(k):
	(l, r) = int_list(input())
	freq[l - 1] += 1
	if r < len(freq):
		freq[r] -= 1
times = 0
for (i, op) in enumerate(operations):
	(l, r, d) = op
	times += freq[i]
	incrs[l - 1] += times * d
	if r < len(incrs):
		incrs[r] -= times * d
prev = 0
for (i, n) in enumerate(arr):
	arr[i] = prev + n + incrs[i]
	prev += incrs[i]
print(' '.join([str(n) for n in arr]))


(n, m, k) = [int(n) for n in input().split()]
a = [int(n) for n in input().split()]
instructions = []
temp = []
for i in range(n + 1):
	temp.append(0)
for i in range(m):
	instructions.append([int(n) for n in input().split()])
queries = []
for i in range(m + 1):
	queries.append(0)
for i in range(k):
	(x, y) = [int(n) for n in input().split()]
	x -= 1
	y -= 1
	queries[x] += 1
	queries[y + 1] -= 1
num_queries = 0
for i in range(m):
	num_queries += queries[i]
	temp[instructions[i][0] - 1] += num_queries * instructions[i][2]
	temp[instructions[i][1]] -= num_queries * instructions[i][2]
x = temp[0]
print(x + a[0], end=' ')
for i in range(1, n):
	x += temp[i]
	print(x + a[i], end=' ')
print()


(n, m, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
l = []
for i in range(m):
	l.append(list(map(int, input().split())))
r = [0] * (m + 1)
for i in range(k):
	(x, y) = input().split()
	(x, y) = (int(x), int(y))
	r[x - 1] += 1
	r[y] -= 1
for i in range(1, m):
	r[i] += r[i - 1]
ad = [0] * (n + 1)
for i in range(m):
	ad[l[i][0] - 1] += l[i][2] * r[i]
	ad[l[i][1]] -= l[i][2] * r[i]
for i in range(1, n):
	ad[i] += ad[i - 1]
for i in range(n):
	print(a[i] + ad[i], end=' ')


def fastio():
	import sys
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
(n, m, k) = I()
l = I()
a = [0] * 100005
q = []
b = [0] * 100005
for i in range(m):
	o = I()
	o[0] -= 1
	q.append(o)
for i in range(k):
	(x, y) = I()
	b[x - 1] += 1
	b[y] -= 1
for i in range(m):
	b[i] += b[i - 1]
for i in range(m):
	(x, y, z) = q[i]
	a[x] += b[i] * z
	a[y] -= b[i] * z
for i in range(n):
	a[i] += a[i - 1]
	print(a[i] + l[i], end=' ')


from sys import stdin
from sys import stdout
inputLine = lambda : list(map(int, stdin.readline().split()))
(initialArray, operations, queries) = inputLine()
executing = inputLine()
operate = [inputLine() for i in range(operations)]
first = [0] * (operations + 1)
second = [0] * (initialArray + 1)
for p in range(queries):
	(temp, temp2) = inputLine()
	first[temp - 1] += 1
	first[temp2] -= 1
count = 0
for p in range(operations):
	(temp, temp2, temp3) = operate[p]
	count += first[p]
	second[temp - 1] += count * temp3
	second[temp2] -= count * temp3
count = 0
for p in range(initialArray):
	count += second[p]
	executing[p] += count
stdout.write(' '.join(map(str, executing)))


import sys
(n, m, k) = map(int, sys.stdin.readline().split())
a = list(map(int, sys.stdin.readline().split()))
s = sum(a)
m1 = []
for i in range(m):
	g = list(map(int, sys.stdin.readline().split()))
	m1.append(g)
k1 = []
for i in range(k):
	g = list(map(int, sys.stdin.readline().split()))
	k1.append(g)
cnt = [0] * (m + 1)
for i in range(k):
	cnt[k1[i][0] - 1] += 1
	cnt[k1[i][1]] += -1
s = 0
for i in range(m + 1):
	s += cnt[i]
	cnt[i] = s
cnt1 = [0] * (n + 1)
for i in range(m):
	cnt1[m1[i][0] - 1] += cnt[i] * m1[i][2]
	cnt1[m1[i][1]] += -cnt[i] * m1[i][2]
s = 0
for i in range(n):
	s += cnt1[i]
	a[i] += s
	print(a[i], end=' ')


import sys
input = sys.stdin.readline
(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
query = []
times = []
x = [0] * (m + 2)
y = [0] * (n + 2)
for i in range(m):
	query.append(list(map(int, input().split())))
for i in range(k):
	times.append(list(map(int, input().split())))
for i in range(k):
	(l, r) = times[i]
	x[l] += 1
	x[r + 1] -= 1
s = 0
for i in range(m + 2):
	s += x[i]
	x[i] = s
for i in range(m):
	query[i][2] *= x[i + 1]
for i in range(m):
	(l, r, d) = query[i]
	y[l] += d
	y[r + 1] -= d
s = 0
for i in range(n + 2):
	s += y[i]
	y[i] = s
for i in range(n):
	a[i] += y[i + 1]
print(*a)


import sys
(n, m, k) = list(map(int, sys.stdin.readline().split(' ')))
a = list(map(int, sys.stdin.readline().split(' ')))
b = [0] * (int(100000.0) + 1)
c = [0] * (int(100000.0) + 1)
l = []
r = []
d = []
for i in range(m):
	(li, ri, di) = list(map(int, sys.stdin.readline().split(' ')))
	l.append(li)
	r.append(ri)
	d.append(di)
for i in range(k):
	(xi, yi) = list(map(int, sys.stdin.readline().split(' ')))
	c[xi - 1] += 1
	c[yi] -= 1
cur = 0
for i in range(0, m):
	cur += c[i]
	b[l[i] - 1] += cur * d[i]
	b[r[i]] -= cur * d[i]
ret = []
cur = 0
for i in range(n):
	cur += b[i]
	ret.append(str(cur + a[i]))
sys.stdout.write(' '.join(ret) + '\n')


(n, m, k) = map(int, input().split())
t = list(map(int, input().split()))
p = [tuple(map(int, input().split())) for i in range(m)]
(r, s) = ([0] * (m + 1), [0] * (n + 1))
(R, S) = (0, 0)
for i in range(k):
	(x, y) = map(int, input().split())
	r[x - 1] += 1
	r[y] -= 1
for (i, (x, y, d)) in enumerate(p):
	R += r[i]
	d = d * R
	s[x - 1] += d
	s[y] -= d
for i in range(n):
	S += s[i]
	t[i] = str(t[i] + S)
print(' '.join(map(str, t)))


import os
from sys import stdin, stdout

def solve(tc):
	(n, m, k) = map(int, stdin.readline().split())
	seq = list(map(int, stdin.readline().split()))
	ops = []
	for i in range(m):
		ops.append(list(map(int, stdin.readline().split())))
	opsAcc = [0 for i in range(m + 1)]
	for i in range(k):
		(l, r) = map(int, stdin.readline().split())
		opsAcc[l - 1] += 1
		opsAcc[r] -= 1
	seqAcc = [0 for i in range(n + 1)]
	seqAcc[ops[0][0] - 1] += ops[0][2] * opsAcc[0]
	seqAcc[ops[0][1]] -= ops[0][2] * opsAcc[0]
	for i in range(1, m + 1):
		opsAcc[i] += opsAcc[i - 1]
		if i < m:
			seqAcc[ops[i][0] - 1] += ops[i][2] * opsAcc[i]
			seqAcc[ops[i][1]] -= ops[i][2] * opsAcc[i]
	seq[0] += seqAcc[0]
	for i in range(1, n + 1):
		seqAcc[i] += seqAcc[i - 1]
		if i < n:
			seq[i] += seqAcc[i]
	print(*seq)
tcs = 1
tc = 1
while tc <= tcs:
	solve(tc)
	tc += 1


import os.path
from math import gcd, floor, ceil
from collections import *
import sys
mod = 1000000007
INF = float('inf')

def st():
	return list(sys.stdin.readline().strip())

def li():
	return list(map(int, sys.stdin.readline().split()))

def mp():
	return map(int, sys.stdin.readline().split())

def inp():
	return int(sys.stdin.readline())

def pr(n):
	return sys.stdout.write(str(n) + '\n')

def prl(n):
	return sys.stdout.write(str(n) + ' ')
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
(n, m, k) = mp()
arr = li()
l = [li() for i in range(m)]
cur = [0] * m
for i in range(k):
	(a, b) = mp()
	cur[a - 1] += 1
	if b < m:
		cur[b] -= 1
for i in range(1, m):
	cur[i] += cur[i - 1]
ans = [0] * n
for (i, ele) in enumerate(cur):
	(left, right, val) = l[i]
	ans[left - 1] += val * ele
	if right < n:
		ans[right] -= val * ele
for i in range(1, n):
	ans[i] += ans[i - 1]
for i in range(n):
	ans[i] += arr[i]
print(*ans)


from sys import stdin, stdout, setrecursionlimit
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log, log2
from random import seed, randint
from datetime import datetime
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
from collections import defaultdict as dd
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def smp():
	return map(str, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b

def def_value():
	return 0

def def_inf():
	return inf
(n, m, k) = mp()
a = lmp()
op = []
for i in range(m):
	(l, r, d) = mp()
	op.append((l, r, d))
c = l1d(m + 2)
b = l1d(n + 2)
for i in range(k):
	(x, y) = mp()
	c[x] += 1
	c[y + 1] -= 1
for i in range(1, m + 1):
	c[i] += c[i - 1]
for i in range(1, m + 1):
	(l, r, d) = (op[i - 1][0], op[i - 1][1], op[i - 1][2])
	b[l] += d * c[i]
	b[r + 1] -= d * c[i]
for i in range(1, n + 1):
	b[i] += b[i - 1]
for i in range(n):
	a[i] += b[i + 1]
print(*a)


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def main():
	(n, m, k) = map(int, input().split())
	arr = list(map(int, input().split()))[:n]
	l = [0] * m
	r = [0] * m
	d = [0] * m
	incrA = [0] * 100002
	dInA = [0] * 100002
	for i in range(m):
		(l[i], r[i], d[i]) = map(int, input().split())
	for i in range(k):
		(x, y) = map(int, input().split())
		x -= 1
		incrA[x] += 1
		incrA[y] -= 1
	c = 0
	for i in range(0, m):
		c += incrA[i]
		newD = c * d[i]
		dInA[l[i] - 1] += newD
		dInA[r[i]] -= newD
	c = 0
	for i in range(0, n):
		c += dInA[i]
		print(c + arr[i], end=' ')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys

def main():
	(n, m, k) = map(int, input().split())
	nums = list(map(int, input().split()))
	pre_reps = [0] * (m + 1)
	ops = []
	for _ in range(m):
		(l, r, d) = map(int, input().split())
		ops.append((l - 1, r - 1, d))
	for _ in range(k):
		(x, y) = map(int, input().split())
		x -= 1
		y -= 1
		pre_reps[x] += 1
		pre_reps[y + 1] -= 1
	cur = 0
	add = [0] * (n + 1)
	for (i, (l, r, d)) in enumerate(ops):
		cur += pre_reps[i]
		add[l] += d * cur
		add[r + 1] -= d * cur
	cur = 0
	ans = []
	for (i, num) in enumerate(nums):
		cur += add[i]
		ans.append(num + cur)
	print(' '.join(map(str, ans)))
main()