Anya loves to watch horror movies. In the best traditions of horror, she will be visited by m ghosts tonight. Anya has lots of candles prepared for the visits, each candle can produce light for exactly t seconds. It takes the girl one second to light one candle. More formally, Anya can spend one second to light one candle, then this candle burns for exactly t seconds and then goes out and can no longer be used.

For each of the m ghosts Anya knows the time at which it comes: the i-th visit will happen w_{i} seconds after midnight, all w_{i}'s are distinct. Each visit lasts exactly one second.

What is the minimum number of candles Anya should use so that during each visit, at least r candles are burning? Anya can start to light a candle at any time that is integer number of seconds from midnight, possibly, at the time before midnight. That means, she can start to light a candle integer number of seconds before midnight or integer number of seconds after a midnight, or in other words in any integer moment of time.


-----Input-----

The first line contains three integers m, t, r (1 ≤ m, t, r ≤ 300), representing the number of ghosts to visit Anya, the duration of a candle's burning and the minimum number of candles that should burn during each visit. 

The next line contains m space-separated numbers w_{i} (1 ≤ i ≤ m, 1 ≤ w_{i} ≤ 300), the i-th of them repesents at what second after the midnight the i-th ghost will come. All w_{i}'s are distinct, they follow in the strictly increasing order.


-----Output-----

If it is possible to make at least r candles burn during each visit, then print the minimum number of candles that Anya needs to light for that.

If that is impossible, print  - 1.


-----Examples-----
Input
1 8 3
10

Output
3

Input
2 10 1
5 8

Output
1

Input
1 1 3
10

Output
-1



-----Note-----

Anya can start lighting a candle in the same second with ghost visit. But this candle isn't counted as burning at this visit.

It takes exactly one second to light up a candle and only after that second this candle is considered burning; it means that if Anya starts lighting candle at moment x, candle is buring from second x + 1 to second x + t inclusively.

In the first sample test three candles are enough. For example, Anya can start lighting them at the 3-rd, 5-th and 7-th seconds after the midnight.

In the second sample test one candle is enough. For example, Anya can start lighting it one second before the midnight.

In the third sample test the answer is  - 1, since during each second at most one candle can burn but Anya needs three candles to light up the room at the moment when the ghost comes.

Source: codeforces | Difficulty: MEDIUM_HARD
Tags: Greedy algorithms

Constructive algorithms


Solutions:
(m, t, r) = map(int, input().split())
ghosts = [int(i) for i in input().split()]
(candles, flag) = ([0 for _ in range(ghosts[-1] + 1 + 300)], True)
for i in range(m):
	now = 0
	for j in range(ghosts[i] - 1, ghosts[i] - t - 1, -1):
		now += candles[j]
	if now < r:
		for j in range(ghosts[i] - 1, ghosts[i] - t - 1, -1):
			if not candles[j] and now < r:
				candles[j] = 1
				now += 1
	if now < r:
		flag = False
if flag:
	print(sum(candles))
else:
	print(-1)


(m, t, r) = map(int, input().split())
s = r
gt = [int(i) for i in input().split()]
cand = [gt[0] + t - r + 1 + i for i in range(r)]
for i in range(1, m):
	cand = [q for q in cand if q > gt[i]]
	d = r - len(cand)
	cand += [gt[i] + t - d + 1 + k for k in range(d)]
	s += d
print(-1 if t < r else s)


f = lambda : list(map(int, input().split()))
(m, t, r) = f()
(p, s) = ([], 0)
for w in f():
	p = [q for q in p if q > w]
	d = r - len(p)
	p += [w + t - i for i in range(d)]
	s += d
print(-1 if t < r else s)


f = lambda : input()
(m, t, r) = list(map(int, f().split()))
w = list(map(int, f().split()))
candles_at_second = [0] * 301
light_at = []

def light(time):
	global candles_at_second, num_candles, t, light_at
	light_at.append(time)
	for i in range(time + 1, time + t + 1):
		if 0 < i:
			if i > 300:
				break
			candles_at_second[i] += 1
possible = True
for i in w:
	for j in range(i - r + candles_at_second[i], i):
		if j in light_at:
			possible = False
			break
		light(j)
if possible:
	possible2 = True
	for i in w:
		if candles_at_second[i] != r:
			possible2 = False
			break
	if possible2:
		print(len(light_at))
	else:
		print(-1)
else:
	print(-1)


import collections
(m, t, r) = list(map(int, input().split()))
w = list(map(int, input().split()))
result = 0
current = collections.deque()
used = set()

def main():
	nonlocal result, current
	for ghost in w:
		while current and current[0] < ghost:
			current.popleft()
		required = r - len(current)
		result += required
		moment = ghost
		for i in range(required):
			moment -= 1
			while moment in used:
				moment -= 1
			if ghost - moment > t:
				print(-1)
				return
			used.add(moment)
			current.append(moment + t)
		current = collections.deque(sorted(current))
	print(result)
main()


(m, t, r) = [int(x) for x in input().split()]
x = [int(x) for x in input().split()]
if t < r:
	print(-1)
else:
	s = [-t - 1]
	w = 0
	for c in x:
		a = len(s) - 1
		k = 0
		while s[a] + t - 1 >= c:
			k += 1
			a -= 1
		if k >= r:
			continue
		else:
			for i in range(r - k):
				s.append(c - r + k + i + 1)
				w += 1
	print(w)


from sys import stdin, stdout
nmbr = lambda : int(stdin.readline())
lst = lambda : list(map(int, input().split()))
for i in range(1):
	(n, t, r) = lst()
	a = lst()
	f = 1
	if r > t:
		print(-1)
		continue
	used = [0] * 1000
	shift = 400
	p = 0
	for i in range(n):
		pt = a[i]
		cnt = 0
		for j in range(pt - 1, pt - t - 1, -1):
			if used[shift + j] == 1:
				cnt += 1
		if cnt >= r:
			continue
		p = pt - 1
		c = 0
		while cnt < r and c < t:
			if used[p + shift] == 1:
				p -= 1
				c += 1
				cnt += 1
				continue
			used[p + shift] = 1
			p -= 1
			cnt += 1
			c += 1
		if cnt >= r:
			continue
		else:
			f = 0
			break
	ans = sum(used)
	print(ans if f else -1)


(m, t, r) = map(int, input().split())
w = list(map(int, input().split()))
w.sort()
cur = set()
cur1 = set()
cnt = 0
for i in range(m):
	for j in cur:
		if j + t >= w[i]:
			cur1.add(j)
	cur = set()
	for j in cur1:
		cur.add(j)
	cur1 = set()
	j = w[i] - 1
	while j >= w[i] - t and len(cur) < r:
		if not j in cur:
			cur.add(j)
			cnt += 1
		j -= 1
	if len(cur) < r:
		print(-1)
		exit()
print(cnt)


N = int(300.0 + 3)
(m, t, r) = map(int, input().split())
a = [int(i) + N for i in input().split()]
(vis, res) = ([0] * (2 * N), 0)
for i in a:
	seg_sum = sum(vis[i - t:i])
	if seg_sum >= r:
		continue
	for j in range(1, t + 1):
		if vis[i - j] == 0:
			vis[i - j] = 1
			seg_sum += 1
			res += 1
		if seg_sum == r:
			break
	if seg_sum < r:
		print(-1)
		break
else:
	print(res)


(m, t, r) = map(int, input().split())
w = list(map(int, input().split()))
if r > t:
	print(-1)
	exit()
candles = []
for i in range(m):
	ct = 0
	for c in candles:
		if w[i] - c <= t:
			ct += 1
	for k in range(r - ct):
		candles.append(w[i] - k - 1)
print(len(candles))


(m, t, r) = map(int, input().split())
l = [int(x) for x in input().split()]
if r > t:
	print(-1)
else:
	candles = []
	total = 0
	for x in l:
		while candles and candles[0] + t - 1 < x:
			candles.pop(0)
		need = r - len(candles)
		for g in range(need):
			candles.append(x - (need - 1) + g)
			total += 1
	print(total)


from sys import stdin, stdout, stderr
import time, math
from collections import defaultdict as dd, Counter

def pn(ob):
	stdout.write(str(ob))

def inp():
	return stdin.readline()

def main():
	lit = dd(lambda : 0)
	(m, t, r) = map(int, inp().split())
	w = list(map(int, inp().split()))
	for x in w:
		cnt = 0
		for i in range(1, t + 1, 1):
			if lit[x - i] == 1:
				cnt += 1
		if cnt < r:
			for i in range(1, t + 1, 1):
				if lit[x - i] == 1:
					pass
				else:
					cnt += 1
					lit[x - i] = 1
				if cnt == r:
					break
		if cnt < r:
			pn('-1')
			return
	res = Counter(lit.values())
	pn(res[1])
main()


(m, t, r) = [int(x) for x in input().strip().split()]
ghosts = [int(x) for x in input().strip().split()]
candles = [ghosts[0] - 1 - x + t for x in range(0, r)]
usedTimes = [ghosts[0] - 1 - x for x in range(0, r)]
res = r
for i in range(0, m):
	for j in range(0, r):
		candleTime = candles[j]
		if candleTime < ghosts[i]:
			possibleTime = ghosts[i] - 1
			canFindTime = False
			while possibleTime >= ghosts[i] - t:
				if usedTimes.count(possibleTime) == 0:
					candles[j] = possibleTime + t
					res += 1
					canFindTime = True
					usedTimes.append(possibleTime)
					break
				else:
					possibleTime -= 1
			if not canFindTime:
				res = -1
				break
	if res == -1:
		break
print(res)


import math
import sys
debug = False
if debug:
	fin = open('input.txt', 'r')
	fout = open('output.txt', 'w')
else:
	fin = sys.stdin
	fout = sys.stdout
s = fin.readline()
(m, t, r) = list(map(int, s.split()))
if r > t:
	fout.write('-1')
	exit()
s = fin.readline()
w = list(map(int, s.split()))
ans = r
ar = [w[0] - r + i for i in range(r)]
for i in range(1, m):
	while ar and w[i] - ar[0] > t:
		ar.pop(0)
	ans += r - len(ar)
	b = r - len(ar)
	for j in range(b):
		ar.append(w[i] - b + j)
fout.write(str(ans))


from heapq import *
(m, t, r) = map(int, input().split())
w = list(map(int, input().split()))
ws = set()
for wi in w:
	ws.add(wi)
w = list(ws)
w.sort()
s = set()
pq = []
for wi in w:
	while pq:
		if pq[0] < wi:
			heappop(pq)
		else:
			break
	for i in range(max(0, r - len(pq))):
		if t > i and wi - 1 - i not in s:
			s.add(wi - 1 - i)
			heappush(pq, wi - 1 - i + t)
		else:
			print(-1)
			exit()
print(len(s))


import sys
import math
(m, t, r) = map(int, input().split())
if r > t:
	print(-1)
	exit()
candles = []
gh = list(map(int, input().split()))
for i in range(m):
	g = gh[i]
	now_on = 0
	for c in candles:
		if g - c <= t:
			now_on += 1
	for k in range(r - now_on):
		candles.append(g - 1 - k)
print(len(candles))


(M, T, R) = [int(x) for x in input().split()]
W = [int(x) for x in input().split()]
W.sort()
if T < R:
	print(-1)
	exit()
candle_cnt = 0
candles_num = [0 for i in range(601)]
for w in W:
	for i in range(R):
		if candles_num[w] < R:
			for j in range(w - i, w - i + T):
				candles_num[j] += 1
			candle_cnt += 1
		else:
			break
print(candle_cnt)


(m, t, r) = map(int, input().split())
arr = [int(x) for x in input().split()]
arr.reverse()
(ans, tmp) = (0, [0 for _ in range(620)])
for i in range(len(arr)):
	candles = 0
	for j in range(arr[i] - 1 + 310, arr[i] - t - 1 + 310, -1):
		if tmp[j] == 1:
			candles += 1
	for j in range(arr[i] - t + 310, arr[i] + 310):
		if candles >= r:
			break
		if tmp[j] == 0:
			tmp[j] = 1
			candles += 1
			ans += 1
	if candles < r:
		ans = -1
		break
print(ans)


(m, t, r) = [int(i) for i in input().split()]
w = [int(i) for i in input().split()]
if r > t:
	print(-1)
	return
candles = list(range(w[0] - r, w[0]))
ans = r
for i in range(1, len(w)):
	candles = [candle for candle in candles if candle >= w[i] - t]
	dis = r - len(candles)
	candles += list(range(w[i] - dis, w[i]))
	ans += dis
print(ans)


def main():
	(m, t, r) = list(map(int, input().split()))
	gh = sorted(map(int, input().split()), reverse=True)
	if r > t:
		print(-1)
		return
	l = [False] * 600
	for g in gh:
		g -= t
		for i in range(g, g + r - sum((l[i] for i in range(g, g + t)))):
			l[i] = True
	print(sum(l))

def __starting_point():
	main()
__starting_point()


import sys
limit = 300
(m, span, need) = list(map(int, input().split()))
visits = list(map(int, input().split()))
if need > span:
	print(-1)
	return
result = 0
count = (limit + 1) * [0]
for visit in visits:
	for i in range(need - count[visit]):
		for pos in range(max(0, visit - i), min(visit - i + span, limit + 1)):
			count[pos] += 1
		result += 1
print(result)


import os
import sys
from io import BytesIO, IOBase
import math

def main():
	(m, t, r) = map(int, input().split())
	w = list(map(int, input().split()))
	if r > t:
		print(-1)
	else:
		candles = []
		ans = 0
		for time in w:
			while candles and candles[0] + t - 1 < time:
				candles.pop(0)
			requirement = r - len(candles)
			for i in range(requirement):
				candles.append(time - (requirement - 1) + i)
				ans += 1
		print(ans)
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))

def input():
	return sys.stdin.readline().rstrip('\r\n')
main()


from collections import defaultdict, Counter, deque
import os
import sys
from io import BytesIO, IOBase
ii = lambda : int(input())
lmii = lambda : list(map(int, input().split()))
slmii = lambda : sorted(map(int, input().split()))
li = lambda : list(input())
mii = lambda : map(int, input().split())
msi = lambda : map(str, input().split())

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // gcd(a, b)

def main():
	(m, t, r) = mii()
	w = lmii()
	cnt = 0
	if t < r:
		print(-1)
	else:
		cul = []
		for i in range(m):
			n = 0
			for j in cul:
				if w[i] - j <= t:
					n += 1
			for j in range(r - n):
				cul.append(w[i] - 1 - j)
				cnt += 1
		print(cnt)
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')
main()


(m, t, r) = map(int, input().split())
ws = list(map(int, input().split()))
candles = []
s = 0
for w in ws:
	candles = [cand for cand in candles if cand > w]
	l = r - len(candles)
	candles.extend((w + t - j for j in range(l)))
	s += l
print(-1 if t < r else s)


def main():
	(m, t, r) = map(int, input().split())
	times = list(map(int, input().split()))
	candles = 0
	burn = []
	prev = 0
	for time in times:
		diff = time - prev
		for j in range(len(burn)):
			burn[j] -= diff
		new = []
		for j in burn:
			if j > 0:
				new.append(j)
		burn = new[:]
		j = 1
		while len(burn) != r:
			if j <= t:
				candles += 1
				burn.append(t - j + 1)
				j += 1
			else:
				break
		if len(burn) != r:
			print(-1)
			return
		prev = time
	print(candles)
main()


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
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')
ALPHA = 'abcdefghijklmnopqrstuvwxyz/'
M = 998244353
EPS = 1e-06

def Ceil(a, b):
	return a // b + int(a % b > 0)

def value():
	return tuple(map(int, input().split()))

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

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
(m, t, need) = value()
a = array()
have = [i + t - 1 for i in range(a[0] - need + 1, a[0] + 1)]
for i in a:
	ind = len(have) - bisect_left(have, i)
	for j in range(i - need + ind + 1, i + 1):
		have.append(j + t - 1)
if t < need:
	print(-1)
else:
	print(len(have))


(m, t, r) = map(int, input().split())
cand = []
s = 0
for i in map(int, input().split()):
	cand = [q for q in cand if q > i]
	l = r - len(cand)
	cand += [i + t - j for j in range(l)]
	s += l
print(-1 if t < r else s)


def main():
	(m, t, r) = read()
	w = read()
	if t < r:
		return -1
	covers = [0] * 1000
	ct = 0
	for i in w:
		x = covers[i]
		for j in range(r - x):
			for k in range(t):
				covers[i - j + k] += 1
			ct += 1
	return ct

def read(mode=2):
	inputs = input().strip()
	if mode == 0:
		return inputs
	if mode == 1:
		return inputs.split()
	if mode == 2:
		return list(map(int, inputs.split()))

def write(s='\n'):
	if s is None:
		s = ''
	if isinstance(s, list):
		s = ' '.join(map(str, s))
	s = str(s)
	print(s, end='')
write(main())


(m, t, r) = map(int, input().split())
if t < r:
	print(-1)
	return
(w, l, v) = (list(map(int, input().split())), [r] * m, 0)
for i in range(m):
	for j in range(l[i]):
		v += 1
		for k in range(i + 1, m):
			if w[i] - j - 1 + t < w[k]:
				break
			l[k] -= 1
print(v)


(m, t, r) = map(int, input().split())
a = [int(i) + 300 for i in input().split()]
l = [0 for i in range(600)]
ans = 0
ok = True
for x in a:
	taken = sum(l[x - t:x])
	if taken < r:
		for i in range(1, t + 1):
			if l[x - i] == 0:
				l[x - i] = 1
				taken += 1
				ans += 1
			if taken == r:
				break
		if taken < r:
			ok = False
			break
print(ans if ok else -1)


(m, t, r) = input().split(' ')
m = int(m)
t = int(t)
r = int(r)
if t < r:
	input()
	need = -1
else:
	candles = []
	need = r
	ghosts = input().split(' ')
	for i in range(r):
		candles.append(t - i)
	for i in range(len(ghosts) - 1):
		dead = []
		diff = int(ghosts[i + 1]) - int(ghosts[i])
		for j in range(len(candles)):
			candles[j] = max(candles[j] - diff, 0)
			if candles[j] is 0:
				dead.append(candles[j])
		for candle in dead:
			candles.remove(0)
		need += r - len(candles)
		for k in range(r - len(candles)):
			candles.append(t - k)
print(need)


import sys
(ghosts, duration, candles) = input().split()
arrival = input().split()
burn = []
for j in range(len(arrival)):
	time = int(arrival[len(arrival) - 1 - j])
	candle = int(candles)
	if len(burn) != 0:
		for k in range(len(burn)):
			if burn[k] <= time:
				candle -= 1
	for i in range(candle):
		burn.append(time - int(duration) + 1 + i)
	if burn[-1] > time:
		print('-1')
		sys.exit()
print(len(burn))


import sys
input = sys.stdin.readline
(m, t, r) = map(int, input().split())
w = list(map(int, input().split()))
cnt = [0] * 1200
ans = 0
for i in range(m):
	c = 0
	for j in range(w[i] - t, w[i]):
		c += cnt[j]
	if c >= r:
		continue
	else:
		res = r - c
		for j in range(w[i] - 1, w[i] - t - 1, -1):
			if res > 0 and cnt[j] == 0:
				cnt[j] = 1
				ans += 1
				res -= 1
		if res > 0:
			print(-1)
			exit()
print(ans)


(m, t, r) = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
if r > t:
	print(-1)
	exit(0)
burn = [0] * 1000
for i in a:
	l = i
	l -= t
	for j in range(l, l + r - sum((burn[k] for k in range(l, l + t)))):
		burn[j] = 1
print(sum(burn))


def fill(ind, y):
	global pole
	ind1 = ind - y + 1
	ind2 = ind + t - 1
	k = 1
	for i in range(ind1, ind):
		pole[i] += k
		k += 1
	k = t
	for i in range(ind, ind2 + 1):
		if k < y:
			pole[i] += k
		else:
			pole[i] += y
		k -= 1
(m, t, r) = map(int, input().split())
mas = list(map(int, input().split()))
if t < r:
	print(-1)
else:
	pole = [0] * 1000
	answer = 0
	for i in range(m):
		answer += r - pole[mas[i]]
		fill(mas[i], r - pole[mas[i]])
	print(answer)


def tandem(s):
	n = len(s) // 2
	for i in range(n):
		if s[i] != s[i + n] and s[i] != '#' and (s[i + n] != '#'):
			return False
	return True

def main():
	candlelit = [False] * 1000
	numofcan = [0] * 1000
	(m, t, r) = map(int, input().split())
	midnight = 300
	if t < r:
		print(-1)
		return
	l = list(map(int, input().split()))
	for i in range(m):
		l[i] += midnight
	for i in l:
		j = i - 1
		while numofcan[i] < r:
			if not candlelit[j]:
				candlelit[j] = True
				for dt in range(1, t + 1):
					numofcan[j + dt] += 1
			j -= 1
	ans = 0
	for i in candlelit:
		if i:
			ans += 1
	print(ans)
main()


(m, t, r) = map(int, input().split())
data = list(map(int, input().split()))
if r > t:
	print(-1)
else:
	candles = []
	total = 0
	for x in data:
		while candles and candles[0] + t - 1 < x:
			candles.pop(0)
		need = r - len(candles)
		for n in range(need):
			candles.append(x - (need - 1) + n)
			total += 1
	print(total)


(a, b, c) = map(int, input().split())
t = sorted(map(int, input().split()), reverse=True)
if c > b:
	print('-1')
else:
	q = [False] * 600
	for k in t:
		k = k - b
		for j in range(k, k + c - sum((q[i] for i in range(k, k + b)))):
			q[j] = True
	print(sum(q))


(m, t, r) = input().split(sep=None, maxsplit=300)
(m, T, r) = (int(m), int(t), int(r))
x = input().split(sep=None, maxsplit=m)
k = r
out = set([])
u = [int(x[0]) + T - 1 - i for i in range(r)]
out |= set(u)
key = True
for i in range(m):
	if not key:
		break
	v = int(x[i])
	t = v + T - 1
	for j in range(r):
		if v <= u[j]:
			continue
		while t in out and t >= v:
			t -= 1
		if t < v:
			key = False
			break
		else:
			out |= set([t])
			u[j] = t
			k += 1
			t -= 1
if key:
	print(k)
else:
	print(-1)