An array $b$ is called to be a subarray of $a$ if it forms a continuous subsequence of $a$, that is, if it is equal to $a_l$, $a_{l + 1}$, $\ldots$, $a_r$ for some $l, r$.

Suppose $m$ is some known constant. For any array, having $m$ or more elements, let's define it's beauty as the sum of $m$ largest elements of that array. For example:   For array $x = [4, 3, 1, 5, 2]$ and $m = 3$, the $3$ largest elements of $x$ are $5$, $4$ and $3$, so the beauty of $x$ is $5 + 4 + 3 = 12$.

 For array $x = [10, 10, 10]$ and $m = 2$, the beauty of $x$ is $10 + 10 = 20$.

You are given an array $a_1, a_2, \ldots, a_n$, the value of the said constant $m$ and an integer $k$. Your need to split the array $a$ into exactly $k$ subarrays such that:

  Each element from $a$ belongs to exactly one subarray.

 Each subarray has at least $m$ elements.

 The sum of all beauties of $k$ subarrays is maximum possible.


-----Input-----

The first line contains three integers $n$, $m$ and $k$ ($2 \le n \le 2 \cdot 10^5$, $1 \le m$, $2 \le k$, $m \cdot k \le n$) — the number of elements in $a$, the constant $m$ in the definition of beauty and the number of subarrays to split to.

The second line contains $n$ integers $a_1, a_2, \ldots, a_n$ ($-10^9 \le a_i \le 10^9$).


-----Output-----

In the first line, print the maximum possible sum of the beauties of the subarrays in the optimal partition.

In the second line, print $k-1$ integers $p_1, p_2, \ldots, p_{k-1}$ ($1 \le p_1 < p_2 < \ldots < p_{k-1} < n$) representing the partition of the array, in which:



 All elements with indices from $1$ to $p_1$ belong to the first subarray.

 All elements with indices from $p_1 + 1$ to $p_2$ belong to the second subarray.

 $\ldots$.

 All elements with indices from $p_{k-1} + 1$ to $n$ belong to the last, $k$-th subarray.

If there are several optimal partitions, print any of them.


-----Examples-----
Input
9 2 3
5 2 5 2 4 1 1 3 2

Output
21
3 5 
Input
6 1 4
4 1 3 2 2 3

Output
12
1 3 5 
Input
2 1 2
-1000000000 1000000000

Output
0
1 


-----Note-----

In the first example, one of the optimal partitions is $[5, 2, 5]$, $[2, 4]$, $[1, 1, 3, 2]$.

  The beauty of the subarray $[5, 2, 5]$ is $5 + 5 = 10$.  The beauty of the subarray $[2, 4]$ is $2 + 4 = 6$.  The beauty of the subarray $[1, 1, 3, 2]$ is $3 + 2 = 5$. 

The sum of their beauties is $10 + 6 + 5 = 21$.

In the second example, one optimal partition is $[4]$, $[1, 3]$, $[2, 2]$, $[3]$.

Source: codeforces | Difficulty: MEDIUM
Tags: Greedy algorithms

Sorting

Constructive algorithms


Solutions:
(n, m, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
indexed_a = zip(a, list(range(n)))
sorted_indexed_a = list(reversed(sorted(indexed_a)))
sorted_a = list(reversed(sorted(a)))
partition = list(sorted([y for (x, y) in sorted_indexed_a[:m * k]]))
print(sum(sorted_a[:m * k]))
result = [x + 1 for x in partition[m - 1::m]]
print(' '.join([str(x) for x in result[:-1]]))


(n, m, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
for i in range(n):
	a[i] = [a[i], i]
num_required = m * k
a.sort()
candidate = a[n - num_required:n]
len_cand = len(candidate)
beauty = 0
for x in range(len_cand):
	beauty += candidate[x][0]
	(candidate[x][0], candidate[x][1]) = (candidate[x][1], candidate[x][0])
print(beauty)
candidate.sort()
ans = []
for x in range(m - 1, len_cand - 1, m):
	ans.append(str(candidate[x][0] + 1))
print(' '.join(ans))


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
b = []
for i in range(n):
	b.append([-a[i], i])
b = sorted(b)
u = [0] * n
ans = 0
for i in range(k * m):
	u[b[i][1]] = 1
	ans -= b[i][0]
c = 0
print(ans)
for i in range(n):
	c += u[i]
	if c == m and k > 1:
		print(i + 1)
		c = 0
		k -= 1


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
b = sorted(enumerate(a), key=lambda x: (x[1], x[0]), reverse=True)
b = b[:m * k]
b = sorted(b)
rec = []
s = 0
tmp = 0
for i in range(len(b)):
	tmp += 1
	if tmp == m:
		rec.append(b[i][0] + 1)
		tmp = 0
	s += b[i][1]
print(s)
print(' '.join(map(str, rec[:-1])))


R = lambda : map(int, input().split())
(n, m, k) = R()
(a, b) = zip(*sorted(zip(R(), range(1, n + 1)))[-m * k:])
print(sum(a), *sorted(b)[m - 1:-1:m])


(n, m, k) = map(int, input().split())
arr = enumerate(list(map(int, input().split())), 1)
arr = sorted(arr, key=lambda x: x[1], reverse=True)
ind = [arr[i][0] for i in range(m * k)]
ind.sort()
ans = [ind[i] for i in range(m - 1, m * (k - 1), m)]
print(sum((arr[i][1] for i in range(m * k))))
print(*ans)


list_int_input = lambda inp: list(map(int, inp.split()))
int_input = lambda inp: int(inp)
string_to_list_input = lambda inp: list(inp)
(n, m, k) = map(int, input().split())
a = list_int_input(input())
a = [(ind, val) for (ind, val) in enumerate(a)]
a.sort(key=lambda x: x[1])
a = a[n - m * k:]
a.sort(key=lambda x: x[0])
summ = sum([pair[1] for pair in a])
i = m
print(summ)
while i != k * m:
	print(a[i][0], end=' ')
	i += m
print()


from collections import defaultdict
(n, m, k) = map(int, input().split())
arr = list(map(int, input().split()))
temp = sorted(arr, reverse=True)
num = m * k
d = defaultdict(int)
for i in temp[:num]:
	d[i] += 1
partition = []
count = 0
for i in range(n):
	if arr[i] in d and d[arr[i]] > 0:
		count += 1
		d[arr[i]] -= 1
	if count == m:
		partition.append(i + 1)
		count = 0
print(sum(temp[:num]))
print(*partition[:k - 1])


(n, m, k) = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
B = sorted(A, reverse=True)
b = int(1000000000000000.0)
cnt = 0
ans = sum(B[:m * k])
for i in range(m * k):
	if b == B[i]:
		cnt += 1
	else:
		cnt = 1
		b = B[i]
P = []
cnt_e = 0
cnt_b = 0
for (i, a) in enumerate(A):
	if len(P) >= k - 1:
		break
	if a > b:
		cnt_e += 1
	elif a == b and cnt_b < cnt:
		cnt_e += 1
		cnt_b += 1
	if cnt_e >= m:
		P.append(i + 1)
		cnt_e = 0
print(ans)
print(*P)


import math
s = input().split()
(n, m, k) = (int(s[0]), int(s[1]), int(s[2]))
a = input().split()
a = [int(x) for x in a]
a = [(a[i], i) for i in range(n)]
maxcal = 0
s = sorted(a)[::-1]
b = [0] * n
for i in range(m * k):
	b[s[i][1]] = 1
	maxcal += s[i][0]
cur = 0
ans = []
for kk in range(k):
	cnt = 0
	while cnt < m:
		if b[cur]:
			cnt += 1
		cur += 1
	ans.append(cur)
ans = ans[:-1]
print(maxcal)
print(' '.join([str(x) for x in ans]))


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
li = [[val, ind] for (ind, val) in enumerate(a, 1)]
li.sort(reverse=True)
ans = 0
res = []
for i in range(m * k):
	ans += li[i][0]
	res.append(li[i][1])
res.sort()
print(ans)
for i in range(m - 1, len(res) - 1, m):
	print(res[i], end=' ')


(n, m, k) = [int(item) for item in input().split()]
a = [int(item) for item in input().split()]
best = {key: 0 for key in sorted(a)[-m * k:]}
for x in sorted(a)[-m * k:]:
	best[x] += 1
print(sum((x * best[x] for x in best)))
cnt = 0
parts = 1
for i in range(n):
	if parts == k:
		break
	if a[i] in best and best[a[i]] > 0:
		cnt += 1
		best[a[i]] -= 1
	if cnt == m:
		print(i + 1, end=' ')
		parts += 1
		cnt = 0
print()


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
ind = list(sorted(range(n), key=lambda i: a[i], reverse=True))
ind2 = list(sorted(ind[:m * k]))
print(sum((a[i] for i in ind2)))
for i in range(k - 1):
	print(ind2[i * m + m - 1] + 1, end=' ')
print()


lin = [int(i) for i in input().split()]
n = lin[0]
m = lin[1]
k = lin[2]
a = [int(i) for i in input().split()]
vet = []
for i in range(n):
	vet.append([a[i], i])
vet.sort(reverse=True)
sp = [False] * n
ans = 0
for i in range(k * m):
	sp[vet[i][1]] = True
	ans += vet[i][0]
ini = []
cnt = 0
for i in range(n):
	if sp[i] == True:
		cnt += 1
	if cnt == m:
		ini.append(i + 1)
		cnt = 0
print(ans)
print(*ini[0:k - 1:1], sep=' ')


(n, m, k) = map(int, input().split())
arr = list(zip(range(n), map(int, input().split())))
arr.sort(key=lambda x: x[1], reverse=True)
arr = arr[:m * k]
arr.sort(key=lambda x: x[0])
ans = []
for i in range(m, m * k, m):
	ans.append(arr[i][0])
print(sum([x[1] for x in arr]))
print(*ans)


def rli():
	return list(map(int, input().split()))

def main():
	(n, m, k) = rli()
	nums = rli()
	x = []
	for i in range(len(nums)):
		x.append((nums[i], i))
	choosed = [0] * len(nums)
	tot = 0
	x.sort()
	x = x[-1::-1]
	for i in range(m * k):
		tot += x[i][0]
		choosed[x[i][1]] = 1
	ans = []
	cnt = 0
	for i in range(len(nums)):
		if choosed[i]:
			cnt += 1
			cnt %= m
			if cnt == 0:
				ans.append(i + 1)
	print(tot)
	print(' '.join(map(str, ans[:-1])))
main()


(n, m, k) = map(int, input().split())
lista = sorted(map(lambda x: (x[1], x[0]), enumerate(map(int, input().split()))))[-m * k:]
[l1, l2] = zip(*lista)
print(sum(l1))
print(*list(map(lambda x: x + 1, sorted(l2)[m - 1::m]))[:k - 1])


from operator import itemgetter
(n, m, k) = list(map(int, input().split()))
l = list(map(int, input().split()))
for i in range(n):
	l[i] = [l[i], i]
cnt = []
l.sort(reverse=True)
for i in range(k * m):
	cnt.append(l[i])
cnt.sort(key=itemgetter(1))
r = 0
for i in range(m * k):
	r += l[i][0]
print(r)
for i in range(m - 1, len(cnt) - 1, m):
	print(cnt[i][1] + 1, end=' ')


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
v = sorted(enumerate(a), key=lambda x: x[1], reverse=True)[:m * k]
v = list(sorted(v))
print(sum(map(lambda x: x[1], v)))
for i in range(m, m * k, m):
	print(v[i][0], end=' ')
print()


def cin():
	return map(int, input().split())
import collections
(n, m, k) = cin()
a = list(cin())
b = sorted(a, reverse=True)
dic = {}
for i in range(m * k):
	dic[b[i]] = dic.get(b[i], 0) + 1
ans = [0]
for i in range(k - 1):
	cnt = 0
	j = ans[-1]
	while cnt < m:
		if a[j] in dic:
			cnt += 1
			dic[a[j]] -= 1
			if not dic[a[j]]:
				del dic[a[j]]
		j += 1
	ans.append(j)
print(sum(b[:m * k]))
print(*ans[1:])


import copy

def main():
	xt = list(map(int, input().split(' ')))
	arr = list(map(int, input().split(' ')))
	if xt[0] / xt[2] == xt[1] and xt[0] % xt[2] == 0:
		(i, m) = (0, xt[1])
		beauty = []
		for i in range(0, len(arr), m):
			arr[i:i + m].sort()
			sum1 = 0
			for i in range(i, i + m, 1):
				sum1 += arr[i]
			beauty.append(sum1)
		print(sum(beauty))
		for i in range(0, len(arr), m):
			if i != 0:
				print(i, end=' ')
	else:
		total = xt[1] * xt[2]
		left = len(arr) - total
		newArr = copy.deepcopy(arr)
		newArr.sort()
		newArr = newArr[:left]
		di = {}
		for i in newArr:
			if i not in di:
				di[i] = 0
			di[i] += 1
		(index, skip, i) = ([], 1, 0)
		beauty = []
		while i < len(arr):
			if len(beauty) == xt[2]:
				break
			index.append(i)
			(sum1, scount) = (0, 0)
			while i < len(arr):
				if arr[i] in di and di[arr[i]] != 0:
					di[arr[i]] -= 1
				else:
					sum1 += arr[i]
					scount += 1
				i += 1
				if scount == xt[1]:
					beauty.append(sum1)
					break
		print(sum(beauty))
		for i in index:
			if i != 0:
				print(i, end=' ')
main()


def do_task(a, n, m, k):
	a_sorted = sorted(enumerate(a), key=lambda x: x[1])
	s = [x[0] for x in a_sorted]
	s = s[::-1]
	s = s[:m * k]
	s.sort()
	result = 0
	for i in range(m * k):
		result += a[s[i]]
	print(result)
	splits = []
	for i in range(m - 1, k * m - 1, m):
		splits.append(s[i] + 1)
	print_s = ''
	for i in range(len(splits)):
		print_s += str(splits[i]) + ' '
	print(print_s)
splits = input().split(' ')
n = int(splits[0])
m = int(splits[1])
k = int(splits[2])
a = n * [0]
splits = input().split(' ')
for i in range(n):
	a[i] = int(splits[i])
do_task(a, n, m, k)


def main():
	(n, m, k) = map(int, input().split())
	a = list(map(int, input().split()))
	if n == k:
		print(sum(a))
		print(' '.join([str(i) for i in range(1, n)]))
		return
	r = sorted(a, reverse=True)[:m * k]
	target = r[-1]
	r = r.count(r[-1])
	obj = 0
	tmp = []
	result = 0
	result2 = []
	ks = 0
	for i in range(len(a)):
		if obj == m:
			if ks == k - 1:
				pass
			else:
				result += sum(sorted(tmp, reverse=True)[:m])
				tmp = []
				obj = 0
				ks += 1
				result2.append(str(i))
		if a[i] == target and r > 0:
			r -= 1
			obj += 1
		if a[i] > target:
			obj += 1
		tmp.append(a[i])
	result += sum(sorted(tmp, reverse=True)[:m])
	print(result)
	print(' '.join(result2))
main()


(n, m, k) = map(int, input().split())
arr = list(map(int, input().split()))
c = [i for i in range(n)]
c.sort(key=lambda x: arr[x])
res = c[n - m * k:]
res.sort()
total = 0
for i in res:
	total += arr[i]
print(total)
for i in range(m - 1, len(res) - 1, m):
	print(res[i] + 1, end=' ')


from operator import itemgetter
from itertools import accumulate
from sys import stdin, stdout
(n, m, k) = [int(x) for x in stdin.readline().split()]
a = [int(x) for x in stdin.readline().split()]
id = [x for x in range(n)]
b = list(zip(a, id))
a.sort(reverse=True)
b.sort(reverse=True)
c = [p[1] for p in b[:m * k]]
c.sort()
print(list(accumulate(a[:m * k]))[-1])
for x in [x + 1 for x in c][m - 1::m][:k - 1]:
	print(x, end=' ')


(n, m, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = sorted(range(len(a)), key=lambda k: a[k])
b.reverse()
b = b[:m * k]
b.sort()
sum = 0
for i in b:
	sum += a[i]
print(sum)
b = b[m - 1:-1:m]
for i in b:
	print(i + 1)


import math, sys
from sys import stdin, stdout
from collections import Counter, defaultdict, deque
input = stdin.readline
I = lambda : int(input())
li = lambda : list(map(int, input().split()))

def case():
	(n, m, k) = li()
	a = li()
	b = a.copy()
	b.sort(reverse=True)
	b = b[:m * k]
	c = Counter(b)
	ans = []
	f = 0
	s = 0
	p = 0
	for i in range(n):
		if a[i] in c and c[a[i]] > 0:
			c[a[i]] -= 1
			f += 1
			s += a[i]
		if f == m:
			if p != k - 1:
				ans.append(i + 1)
			f = 0
			p += 1
	print(s)
	print(*ans)
for _ in range(1):
	case()


s = input().split()
n = int(s[0])
m = int(s[1])
k = int(s[2])
s = input().split()
a = [int(i) for i in s]
a_descend = []
for (index, num) in enumerate(a):
	a_descend.append((num, index))
a_descend = sorted(a_descend, reverse=True)
ans_sum = 0
flg = [False for _ in range(n)]
for i in range(m * k):
	flg[a_descend[i][1]] = True
	ans_sum += a_descend[i][0]
print(ans_sum)
cnt = 0
j = 0
for i in range(n):
	if flg[i]:
		cnt += 1
	if cnt == m:
		print(i + 1, end=' ')
		cnt = 0
		j += 1
		if j == k - 1:
			exit(0)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
x = []
for i in range(n):
	x.append((a[i], i))
x.sort(reverse=True)
total = 0
check = []
len = 0
for i in range(k * m):
	total += x[i][0]
	check.append(x[i][1])
	len += 1
check.sort()
print(total)
temp = k - 1
count = 0
for i in range(len):
	count += 1
	if count == m:
		count = 0
		print(check[i] + 1, end=' ')
		temp -= 1
	if temp == 0:
		break


(n, m, k) = input().split()
n = int(n)
m = int(m)
k = int(k)
a = [int(x) for x in input().split()]
b = a.copy()
a.sort(reverse=True)
sp = sum(a[0:m * k])
temp = a[0:m * k]
start = 0
print(sp)
t = 0
c = 0
temp2 = dict()
for i in range(len(temp)):
	if temp[i] in temp2:
		temp2[temp[i]] += 1
	else:
		temp2[temp[i]] = 1
for i in range(n):
	if b[i] in temp2 and temp2[b[i]] > 0:
		t += 1
		temp2[b[i]] -= 1
	if t == m and i - start >= m - 1:
		print(i + 1, end=' ')
		start = i + 1
		t = 0
		c += 1
		if c == k - 1:
			break


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
check = [False] * n
res = 0
for i in range(n):
	a[i] = (a[i], i)
a.sort(reverse=True)
for i in range(m * k):
	check[a[i][1]] = True
	res += a[i][0]
print(res)
ht = 0
for i in range(n):
	if check[i]:
		ht += 1
	if ht == m:
		k -= 1
		if k == 0:
			break
		print(i + 1, end=' ', flush=False)
		ht = 0


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
a = [[a[i], i] for i in range(n)]
a.sort(key=lambda x: x[0], reverse=True)
a = a[:m * k]
a.sort(key=lambda x: x[1])
s = 0
for i in range(m * k):
	s += a[i][0]
print(s)
for i in range(m - 1, m * k - 1, m):
	print(a[i][1] + 1, 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()
s = l[:]
for i in range(n):
	s[i] = [s[i], i]
s.sort(reverse=True)
s = s[:m * k]
s.sort(key=lambda x: x[1])
ans = 0
for i in s:
	ans += i[0]
print(ans)
j = 0
for i in range(m - 1, m * k, m):
	j += 1
	if j == k:
		break
	print(s[i][1] + 1, end=' ')


(n, m, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = a.copy()
b.sort(reverse=True)
msum = sum(b[:m * k])
count = {}
for i in range(m * k):
	count[b[i]] = count.get(b[i], 0) + 1
if n == 2:
	if k == 2:
		print(sum(a))
		print(1)
	elif m == 1:
		print(max(a))
		print(n)
	else:
		print(sum(a))
		print(2)
else:
	print(msum)
	size = 0
	c = 0
	ind = []
	for i in range(n):
		if len(ind) == k - 1:
			break
		if a[i] in count:
			size += 1
			count[a[i]] -= 1
			if count[a[i]] == 0:
				del count[a[i]]
		if size == m:
			size = 0
			ind.append(i + 1)
	for i in range(len(ind)):
		print(ind[i], end=' ')
	print()


(n, m, k) = map(int, input().split())
l = [int(i) for i in input().split()]
z = m * k
l1 = [[l[i], i] for i in range(n)]
l1.sort(key=lambda x: -x[0])
req = []
sm = 0
for i in range(z):
	req.append(l1[i][1])
	sm += l1[i][0]
req.sort()
print(sm)
cnt = 0
for i in range(len(req)):
	cnt += 1
	if cnt % m == 0 and i != z - 1:
		print(req[i] + 1, end=' ')
		cnt = 0


from collections import Counter
(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
sorted_a = sorted(a, reverse=True)[:m * k]
total = sum(sorted_a)
counter = Counter(sorted_a)
ans = []
current_m = 0
for (i, n) in enumerate(a, start=1):
	if counter[n]:
		current_m += 1
		counter[n] -= 1
		if current_m == m:
			ans.append(i)
			current_m = 0
print(total)
print(*ans[:-1])


(n, m, k) = map(int, input().split())
p = list(([x, i] for (i, x) in enumerate(map(int, input().split()), 1)))
p.sort(reverse=True)
l = []
s = 0
for i in range(m * k):
	s += p[i][0]
	l.append(p[i][1])
print(s)
l.sort()
for i in range(m - 1, len(l) - 1, m):
	print(l[i], end=' ')


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
x = sorted(sorted(range(1, n + 1), key=lambda i: a[i - 1], reverse=True)[:m * k])
print(sum((a[i - 1] for i in x)))
print(*x[m - 1:-1:m])


(n, m, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
sortedA = sorted(a, reverse=True)
freqLar = {}
sum = 0
for i in range(m * k):
	sum += sortedA[i]
	if i > 0 and sortedA[i] == sortedA[i - 1]:
		freqLar[sortedA[i]] += 1
	else:
		freqLar[sortedA[i]] = 1
mn = sortedA[m * k - 1]
sub = 0
part = []
sm = 0
for i in range(n):
	if a[i] >= mn and freqLar[a[i]] > 0:
		sm += a[i]
		sub += 1
		freqLar[a[i]] -= 1
	if sub == m:
		sub = 0
		k -= 1
		if k > 0:
			part.append(i + 1)
		else:
			break
print(sum)
for i in part:
	print(i, end=' ')


import sys
import math as mt
import bisect
input = sys.stdin.readline
import collections
t = 1
p = 10 ** 9 + 7

def ncr_util():
	inv[0] = inv[1] = 1
	fact[0] = fact[1] = 1
	for i in range(2, 300001):
		inv[i] = inv[i % p] * (p - p // i) % p
	for i in range(1, 300001):
		inv[i] = inv[i - 1] * inv[i] % p
		fact[i] = fact[i - 1] * i % p

def solve():
	l1 = []
	for i in l:
		l1.append(i)
	l1.sort(reverse=True)
	ans = sum(l1[:m * k])
	j = 0
	ans1 = []
	d = {}
	for i in range(m * k):
		d[l1[i]] = d.get(l1[i], 0) + 1
	cnt = 0
	(suma, suma1) = (0, 0)
	for i in range(n):
		if d.get(l[i], 0) != 0:
			d[l[i]] -= 1
			cnt += 1
		if cnt == m and len(ans1) < k - 1:
			ans1.append(i + 1)
			cnt = 0
	print(ans)
	return ans1
for _ in range(t):
	(n, m, k) = map(int, input().split())
	l = list(map(int, input().split()))
	print(*solve())


import heapq
(n, m, k) = map(int, input().split())
a = tuple(map(int, input().split()))
b = []
i = 1
for ai in a:
	b.append((ai, i))
	i += 1
b = sorted(((i, ai) for (ai, i) in heapq.nlargest(m * k, b)))
print(sum((bi for (_, bi) in b)))
print(*(bi for (bi, _2) in b[m - 1:-1:m]))


(n, m, k) = map(int, input().split())
vec = list(map(int, input().split()))
must = []
for i in range(n):
	must.append([vec[i], i])
must.sort(reverse=True)
mustLen = m * k
ans = 0
spl = [0] * (n + 1)
for i in range(0, mustLen):
	spl[must[i][1]] = 1
	ans += must[i][0]
cur = 0
print(ans)
for i in range(n):
	cur += spl[i]
	if cur == m and k > 1:
		print(i + 1, end=' ')
		cur = 0
		k -= 1


from collections import deque
import heapq
import math
import bisect

def main():
	(N, M, K) = map(int, input().split())
	A = list(map(int, input().split()))
	B = [(A[i], i) for i in range(N)]
	B.sort(reverse=True)
	used = [0] * N
	ans = 0
	for i in range(M * K):
		idx = B[i][1]
		used[idx] = 1
		ans += B[i][0]
	lst = []
	cnt = le = 0
	for i in range(N):
		if used[i]:
			cnt += 1
		if cnt == M:
			lst.append(i + 1)
			cnt = 0
			le += 1
			if le == K - 1:
				break
	print(ans)
	print(*lst)
main()


import os
import sys
from io import BytesIO, IOBase
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')
import math
import bisect
from collections import Counter
import bisect
from collections import deque
import bisect

def can(x):
	val = bisect.bisect_left(arr, 2 * x)
	val2 = bisect.bisect_left(arr, x)
	if 2 * n - val >= n and 2 * n - val2 >= 2 * n:
		return True
	return False
for _ in range(1):
	(n, m, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	ls = sorted(arr, reverse=True)
	print(sum(ls[:k * m]))
	d = Counter(ls[:k * m])
	cnt = 0
	ans = 0
	for i in range(n):
		if arr[i] in d and d[arr[i]] > 0:
			cnt += 1
			if cnt == m:
				print(i + 1, end=' ')
				cnt = 0
				ans += 1
			d[arr[i]] -= 1
		if ans == k - 1:
			break


(n, m, k) = (int(x) for x in input().split())
arr = [int(x) for x in input().split()]
sorted_enum = list(sorted(enumerate(arr), key=lambda x: -x[1]))[:m * k]
sorted_enum = sorted(sorted_enum, key=lambda x: x[0])
max_sum = 0
arr = []
for i in range(k):
	sm = sum([x[1] for x in sorted_enum[i * m:(i + 1) * m]])
	arr.append(sorted_enum[i * m + m - 1][0] + 1)
	max_sum += sm
print(max_sum)
print(*arr[:-1])


(n, m, k) = map(int, input().split())
arr = list(map(int, input().split()))
arr1 = sorted(arr)
a = arr1[-m * k:]
d = {}
for i in a:
	d[i] = d.get(i, 0) + 1
print(sum(a))
p = 0
t = 0
for i in range(n):
	if arr[i] in d:
		d[arr[i]] -= 1
		t += 1
		if d[arr[i]] == 0:
			del d[arr[i]]
	if t == m:
		t = 0
		p += 1
		print(i + 1, end=' ')
	if p == k - 1:
		break


_ = input()
(n, m, k) = _.split()
(n, m, k) = (int(n), int(m), int(k))
_ = input()
a = _.split()
a = [(i, int(value)) for (i, value) in enumerate(a)]
position = []
b = sorted(a, key=lambda p: p[1])
b = b[-m * k:]
answer = 0
for i in b:
	answer = answer + i[1]
print(answer)
answer = ''
position = [p[0] + 1 for p in b]
position.sort()
position.pop()
for (i, p) in enumerate(position):
	if i % m == m - 1:
		answer = answer + '{} '.format(p)
print(answer)


from sys import stdin
input = stdin.readline

def f(a, m, k):
	b = list(zip(a, range(0, len(a))))
	b = sorted(b, key=lambda s: s[0], reverse=True)
	big = b[:m * k]
	s = 0
	for i in big:
		s += i[0]
	big = sorted(big, key=lambda s: s[1])
	cb = 0
	pt = 0
	lb = len(big)
	ans = []
	for i in range(len(a)):
		if pt < lb and i == big[pt][1]:
			cb += 1
			if cb >= m:
				ans.append(i + 1)
				cb = 0
			pt += 1
	print(s)
	return ans[:-1]
(n, m, k) = map(int, input().strip().split())
lst = list(map(int, input().strip().split()))
print(*f(lst, m, k))


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
array_with_id = [(a[i], i + 1) for i in range(n)]
array_with_id.sort(reverse=True)
important_ids = [item[1] for item in array_with_id[:m * k]]
important_ids.sort()
sum_beauty = 0
for i in important_ids:
	sum_beauty += a[i - 1]
partitions = []
for i in range(m - 1, m * k - 1, m):
	partitions.append(important_ids[i])
print(sum_beauty)
print(*partitions)


import heapq
(n, m, k) = [int(x) for x in input().split(' ')]
assert 2 <= n <= 200000
assert 1 <= m
assert 2 <= k
assert m * k <= n
ns = [int(x) for x in input().split(' ')]
assert len(ns) == n
pis = [i for (i, p) in heapq.nlargest(m * k, enumerate(ns), lambda x: x[1])]
pis.sort()
print(sum((ns[i] for i in pis)))
print(*[pis[i * m - 1] + 1 for i in range(1, k)])


(N, M, K) = map(int, input().split())
a_list = list(map(int, input().split()))
b_list = [i for i in range(N)]
b_list.sort(reverse=True, key=lambda x: a_list[x])
c_list = []
sum_beauties = 0
for i in range(K * M):
	sum_beauties += a_list[b_list[i]]
	c_list.append((a_list[b_list[i]], b_list[i]))
print(sum_beauties)
c_list.sort(key=lambda x: (x[1], x[0]))
for i in range(1, len(c_list)):
	if i % M == 0:
		print(c_list[i - 1][1] + 1, end=' ')


(n, m, k) = map(int, input().split())
lis = list(map(int, input().split()))
aa = sorted(range(len(lis)), key=lambda k: lis[k], reverse=True)
t = m * k
aa = aa[:t]
aa.sort()
p = 0
for i in aa:
	p += lis[i]
ans = []
i = m
while i < len(aa):
	ans.append(aa[i - 1] + 1)
	i += m
print(p)
print(*ans)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
a1 = []
for i in range(n):
	a1.append((a[i], i))
a1.sort(reverse=True)
_max = [0] * n
ans = 0
for i in range(m * k):
	_max[a1[i][1]] = 1
	ans += a1[i][0]
print(ans)
_sum = 0
ans_ar = []
for i in range(n):
	_sum += _max[i]
	if _sum == m:
		ans_ar.append(i + 1)
		_sum = 0
ans_ar.pop()
print(*ans_ar)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
b = []
for i in range(n):
	b.append([a[i], i])

def sortFirst(val):
	return val[0]
b.sort(key=sortFirst, reverse=True)
jog = 0
ind = []
for i in range(m * k):
	jog += b[i][0]
	ind.append(b[i][1] + 1)
ind.sort()
l = m - 1
ans = [ind[l]]
for i in range(k - 2):
	ans.append(ind[l + m])
	l += m
print(jog)
print(*ans, sep=' ')


def find(x):
	first = 0
	last = len(temp) - 1
	while first <= last:
		mid = (first + last) // 2
		if temp[mid] == x:
			return mid
		elif x < temp[mid]:
			first = mid + 1
		elif x > temp[mid]:
			last = mid - 1
	return -1
(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
arr = [(a[i], i) for i in range(n)]
arr.sort(reverse=True)
index = []
res = 0
for i in range(m * k):
	res += arr[i][0]
	index.append(arr[i][1])
print(res)
index.sort()
for i in range(k - 1):
	print(index[(i + 1) * m - 1] + 1, end=' ')


import sys
from collections import deque
input_ = lambda : sys.stdin.readline().strip('\r\n')
ii = lambda : int(input_())
il = lambda : list(map(int, input_().split()))
ilf = lambda : list(map(float, input_().split()))
ip = lambda : input_()
fi = lambda : float(input_())
li = lambda : list(input_())
pr = lambda x: print(x)
f = lambda : sys.stdout.flush()
(n, m, k) = il()
a = il()
b = []
for i in range(n):
	b.append((a[i], i + 1))
b.sort(reverse=True)
c = b[:m * k]
c.sort(key=lambda x: x[1])
ans = 0
for i in c:
	ans += i[0]
print(ans)
for i in range(len(c) - 1):
	if (i + 1) % m == 0:
		print(c[i][1], end=' ')


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
b = []
for i in range(n):
	b.append((a[i], i + 1))
b.sort(reverse=True)
c = b[:m * k]
c.sort(key=lambda x: x[1])
ans = 0
for i in c:
	ans += i[0]
print(ans)
for i in range(len(c) - 1):
	if (i + 1) % m == 0:
		print(c[i][1], end=' ')


(n, m, k) = map(int, input().split())
listo = list(map(int, input().split()))
lis = listo.copy()
lis.sort(reverse=True)
cand = {}
s = 0
for i in range(m * k):
	s += lis[i]
	if lis[i] in cand:
		cand[lis[i]] += 1
	else:
		cand[lis[i]] = 1
cnt = 0
sol = []
for i in range(n):
	if listo[i] in cand:
		cnt += 1
		cand[listo[i]] -= 1
		if cand[listo[i]] == 0:
			del cand[listo[i]]
	if cnt == m:
		sol.append(i + 1)
		cnt = 0
print(s)
print(*sol[:-1])


nmk = input().split()
n = int(nmk[0])
m = int(nmk[1])
k = int(nmk[2])
a = input().split()
for i in range(len(a)):
	a[i] = int(a[i])
b = []
for i in range(len(a)):
	b.append([a[i], i])
b.sort(reverse=1)
sum = 0
c = []
for i in range(m * k):
	sum = sum + b[i][0]
	c.append(b[i][1])
print(sum)
c.sort()
for i in range(m - 1, len(c) - 1, m):
	print(c[i] + 1, end=' ')
print()


(n, m, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
tot = []
i = 0
counter = 0
total = []
for item in a:
	tot.append((item, i))
	i += 1
tot.sort(reverse=True)
for i in range(m * k):
	total.append(tot[i][1])
	counter += tot[i][0]
total.sort()
answer = []
for i in range(m, len(total), m):
	answer.append(total[i])
print(counter)
print(*answer)


(n, m, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = sorted(a)
s = 0
if m * k == n:
	print(sum(a))
	for i in range(m, n, m):
		print(i, end=' ')
else:
	count = 0
	p = b[n - m * k]
	print(sum(b[n - m * k:]))
	for i in range(n - m * k, n):
		if b[i] == p:
			s += 1
	b = []
	for j in range(n):
		if a[j] > p:
			count += 1
			if count == m:
				b.append(j + 1)
				count = 0
		elif a[j] == p and s != 0:
			count += 1
			s -= 1
			if count == m:
				b.append(j + 1)
				count = 0
	for i in range(len(b) - 1):
		print(b[i], end=' ')


(n, m, k) = map(int, input().split())
ar = list(map(int, input().split()))
pos = []
for i in range(n):
	pos.append([i, ar[i]])
st = sorted(pos, key=lambda a: a[1], reverse=True)
s = 0
for i in range(m * k):
	s += st[i][1]
print(s)
req = st[:m * k]
req.sort(key=lambda a: a[0])
ct = 0
z = 0
for i in range(0, m * k, m):
	if z:
		print(req[i][0], end=' ')
		ct += 1
	z = 1
	if ct == k - 1:
		break


(n, m, k) = map(int, input().split())
list_1 = [int(i) for i in input().split()]
total = m * k
sorter = sorted(list_1, reverse=True)[:total]
print(sum(sorter))
board = sorter.count(sorter[m * k - 1])
num = 0
out = []
for i in range(n):
	if list_1[i] > sorter[m * k - 1]:
		num += 1
	elif board > 0 and list_1[i] == sorter[m * k - 1]:
		board -= 1
		num += 1
	if num == m:
		num = 0
		out.append(i + 1)
print(' '.join([str(i) for i in out[:-1]]))


(n, m, k) = [int(i) for i in input().split()]
arr = [int(i) for i in input().split()]
arr = [(arr[i], i) for i in range(n)]
arr.sort(reverse=True)
lis = []
ans = 0
for i in range(m * k):
	ans += arr[i][0]
	lis.append(arr[i][1])
lis.sort()
a1 = []
for i in range(m - 1, len(lis), m):
	a1.append(lis[i] + 1)
print(ans)
print(*a1[:-1])


def check(val):
	return b[m * k - 1] <= val
(n, m, k) = map(int, input().split())
i = 0
a = []
b = []
for x in input().split():
	a.append((int(x), i))
	b.append((int(x), i))
	i += 1
b.sort()
b.reverse()
res = 0
p = []
cnt = 0
for i in range(n):
	if check(a[i]):
		cnt += 1
		res += a[i][0]
	if cnt == m + 1:
		p.append(i)
		cnt = 1
print(res)
for x in p:
	print(x, end=' ')


(n, m, k) = (int(t) for t in input().split(' '))
a = [int(t) for t in input().split(' ')]
s = list(enumerate(a))
s.sort(key=lambda x: x[1], reverse=True)
s = s[:m * k]
print(sum((x[1] for x in s)))
s = [x[0] for x in s]
s.sort()
print(*[s[i - 1] + 1 for i in range(m, m * k, m)])


read = lambda : map(int, input().split())

def takeFirst(element):
	return element[0]

def takeSecond(element):
	return element[1]
(n, m, k) = read()
a = list(read())
b = []
for (cnt, x) in enumerate(a):
	b.append([cnt, x])
b.sort(key=takeSecond, reverse=True)
b = b[:m * k]
b.sort(key=takeFirst)
print(sum([x[1] for x in b]))
print(' '.join(map(str, [x[0] for x in b][m::m])))


def find_lower_bound(array, n, m, k):
	tmp_array = sorted(array, reverse=1)
	cnt = 0
	for i in range(n):
		if tmp_array[i] > tmp_array[m * k - 1]:
			cnt += 1
		else:
			break
	return [tmp_array[m * k - 1], m * k - cnt]

def find_beauty(array, upper_bound, lower_bound, m):
	tmp_array = sorted(array, reverse=1)
	out = 0
	for i in range(m):
		out += tmp_array[i]
	return out

def partition(array, n, m, k, lower_bound, number):
	out = []
	sum_of_beauty = 0
	i = 0
	while i < n:
		cnt = 0
		for j in range(i, n):
			if array[j] > lower_bound:
				cnt += 1
				sum_of_beauty += array[j]
			elif array[j] == lower_bound and number > 0:
				cnt += 1
				sum_of_beauty += array[j]
				number -= 1
			if cnt == m:
				out.append(j + 1)
				k -= 1
				i += 1
				break
			i += 1
		if k == 0:
			break
	print(sum_of_beauty)
	return out
(n, m, k) = map(int, input().split())
array = list(map(int, input().split()))
(lower_bound, number) = find_lower_bound(array, n, m, k)
res = partition(array, n, m, k, lower_bound, number)
for i in range(len(res) - 1):
	print(res[i], end=' ')


(n, m, k) = map(int, input().split())
l = list(map(int, input().split()))
sumi = 0
l = list(enumerate(l))
list = [0] * n
l.sort(key=lambda x: x[1])
l.reverse()
for i in range(m * k):
	list[l[i][0]] = 1
	sumi += l[i][1]
ans = []
count = 0
for i in range(n - 1):
	if len(ans) == k - 1:
		break
	if list[i] == 1:
		count += 1
	if count == m:
		ans.append(i + 1)
		count = 0
print(sumi)
print(*ans)


import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_left
from types import GeneratorType
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		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 = self.os.read(self._fd, max(self.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 = self.os.read(self._fd, max(self.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:
			self.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')
import time
start_time = time.time()
import collections as col
import math, string
from functools import reduce

def getInts():
	return [int(s) for s in input().split()]

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

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())
MOD = 10 ** 9 + 7

def solve():
	(N, M, K) = getInts()
	A = getInts()
	B = A[:]
	B.sort(reverse=True)
	use = col.defaultdict(int)
	dont = col.defaultdict(int)
	ans = 0
	for j in range(M * K):
		ans += B[j]
		use[B[j]] += 1
	size = M
	part_size = 0
	partitions = [0]
	for j in range(N):
		if use[A[j]]:
			use[A[j]] -= 1
			size -= 1
		part_size += 1
		if not size:
			partitions.append(partitions[-1] + part_size)
			part_size = 0
			size = M
	print(ans)
	print(*partitions[1:-1])
	return
solve()


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from functools import cmp_to_key
from heapq import *
from math import gcd, factorial, floor, ceil, sqrt
from copy import deepcopy
from collections import deque
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
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))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func

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

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

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

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

def testcase(t):
	for pp in range(t):
		solve(pp)

def google(p):
	print('Case #' + str(p) + ': ', end='')

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

def power(x, y, p):
	y %= p - 1
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
inf = pow(10, 20)
mod = 10 ** 9 + 7

def bucketsort(order, seq):
	buckets = [0] * (max(seq) + 1)
	for x in seq:
		buckets[x] += 1
	for i in range(len(buckets) - 1):
		buckets[i + 1] += buckets[i]
	new_order = [-1] * len(seq)
	for i in reversed(order):
		x = seq[i]
		idx = buckets[x] = buckets[x] - 1
		new_order[idx] = i
	return new_order

def ordersort(order, seq, reverse=False):
	bit = max(seq).bit_length() >> 1
	mask = (1 << bit) - 1
	order = bucketsort(order, [x & mask for x in seq])
	order = bucketsort(order, [x >> bit for x in seq])
	if reverse:
		order.reverse()
	return order

def long_ordersort(order, seq):
	order = ordersort(order, [int(i & 2147483647) for i in seq])
	return ordersort(order, [int(i >> 31) for i in seq])

def multikey_ordersort(order, *seqs, sort=ordersort):
	for i in reversed(range(len(seqs))):
		order = sort(order, seqs[i])
	return order

def solve(case):
	(n, m, k) = sep()
	a = lis()
	l = []
	r1 = []
	for i in range(n):
		if a[i] >= 0:
			l.append(a[i])
			r1.append(i)
	if len(l) == 0:
		order1 = []
	else:
		order1 = multikey_ordersort(range(len(l)), l, r1)
	l = []
	r2 = []
	for i in range(n):
		if a[i] < 0:
			l.append(-a[i])
			r2.append(i)
	if len(l) == 0:
		order2 = []
	else:
		order2 = multikey_ordersort(range(len(l)), l, r2)
		order2 = order2[::-1]
	order = []
	for i in order2:
		order.append(r2[i])
	for i in order1:
		order.append(r1[i])
	ind = []
	for i in range(m * k):
		ind.append(order.pop())
	ind = sorted(ind)
	ans = []
	for i in range(m - 1, len(ind), m):
		ans.append(ind[i])
	a = sorted(a)[::-1]
	print(sum(a[:m * k]))
	print(' '.join((str(ans[i] + 1) for i in range(len(ans) - 1))))
testcase(1)


from sys import stdin, stdout
from itertools import combinations
from collections import defaultdict, OrderedDict
import math

def listIn():
	return list(map(int, stdin.readline().strip().split()))

def stringListIn():
	return [x for x in stdin.readline().split()]

def intIn():
	return int(stdin.readline())

def stringIn():
	return stdin.readline().strip()
(n, m, k) = listIn()
a = listIn()
b = sorted(a)[::-1][:m * k][::-1]
di = {}
for ele in b:
	if ele not in di:
		di[ele] = 1
	else:
		di[ele] += 1
minn = min(b)
part = []
st = 0
cnt = 0
p = 0
summ = sum(b)
for i in range(n):
	if a[i] >= minn:
		if di[a[i]] > 0:
			cnt += 1
			di[a[i]] -= 1
			if cnt >= m:
				part.append(i + 1)
				p += 1
				cnt = 0
	elif cnt >= m:
		part.append(i + 1)
		p += 1
		cnt = 0
	if p == k - 1:
		break
print(summ)
print(*part)


(n, m, k) = map(int, input().strip().split())
l = list(map(int, input().strip().split()))
b = sorted(range(len(l)), key=lambda k: l[k])
b.reverse()
b = b[:m * k]
b.sort()
sm = 0
ans = []
for i in range(len(b)):
	if i % m == 0 and i != 0:
		ans.append(b[i])
	sm += l[b[i]]
print(sm)
for i in ans:
	print(i, end=' ')


(n, m, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
pairs = [(a[i], i) for i in range(len(a))]
sorted_a = sorted(pairs, reverse=True)[:m * k]
grid = [0] * len(a)
for (x, i) in sorted_a:
	grid[i] = 1
s = 0
print(sum([p[0] for p in sorted_a]))
cnt = 0
for (i, val) in enumerate(grid):
	s += val
	if s == m:
		cnt += 1
		print(i + 1, end=' ')
		s = 0
		if cnt == k - 1:
			break


from collections import defaultdict as dd
import bisect as bb
import sys
input = sys.stdin.readline
(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
b = a[:]
b.sort()
b = b[n - k * m:n]
ans = sum(b)
ind = []
ge = 0
p = 0
d = dd(int)
for i in range(0, k * m):
	d[b[i]] = d.get(b[i], 0) + 1
for i in range(0, n):
	if p == k - 1:
		break
	if ge < m:
		if d[a[i]] >= 1:
			ge += 1
			d[a[i]] -= 1
			if ge == m:
				ind.append(i + 1)
				ge = 0
				p += 1
print(ans)
print(' '.join([str(a) for a in ind]))


(n, m, k) = map(int, input().split())
tab = map(int, input().split())
tab = [(t, i) for (i, t) in enumerate(tab)]
tab.sort()
want = [False for _ in range(n)]
for (_, i) in tab[n - k * m:]:
	want[i] = True
counter = 0
print(sum((t for (t, i) in tab if want[i])))
printed = 0
for (i, w) in enumerate(want):
	counter += w
	if counter == m:
		if i + 1 != n:
			print(i + 1, end=' ')
			printed += 1
		counter = 0
	if printed == k - 1:
		break


from bisect import bisect_left, bisect_right
(n, m, k) = map(int, input().split())
arr = list(map(int, input().split()))
mk = [a for a in arr]
mk.sort()
idx = -1 * m * k
ans = sum(mk[idx:])
v = mk[idx]
i = 0
while idx + i != 0 and mk[idx + i] == v:
	i += 1
large = []
for a in arr:
	if a == v and i > 0:
		large.append(a)
		i -= 1
	if a > v:
		large.append(a)
i = 0
j = 0
ans_ind = []
while k != 1:
	ent = m
	while ent != 0:
		if arr[i] == large[j]:
			ent -= 1
			j += 1
		i += 1
	ans_ind.append(i)
	k -= 1
print(ans)
print(*ans_ind)


def main():
	[n, m, k] = list(map(int, input().split(' ')))
	ar = list(map(int, input().split(' ')))
	orderedAr = ar[:]
	orderedAr.sort(reverse=True)
	items = m * k
	new = orderedAr[:items]
	f = dict()
	for i in new:
		if i not in f:
			f[i] = 1
		else:
			f[i] += 1
	j = 0
	maxSum = sum(new)
	noOfpartitions = 0
	partitions = []
	for i in range(len(ar)):
		if noOfpartitions == k - 1:
			break
		elif ar[i] in f and j < m:
			if f[ar[i]] > 0:
				f[ar[i]] -= 1
				j += 1
		if j == m:
			partitions.append(i + 1)
			noOfpartitions += 1
			j = 0
	print(maxSum)
	for i in partitions:
		print(i, end=' ')
main()


from collections import defaultdict as dd
(n, m, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = a[:]
b.sort()
cnt = dd(int)
ans = 0
for i in b[-m * k:]:
	ans += i
	cnt[i] += 1
ct = 0
tot = 0
print(ans)
for i in range(len(a)):
	if cnt[a[i]] != 0:
		cnt[a[i]] -= 1
		ct += 1
	if ct == m:
		tot += 1
		if tot != k:
			print(i + 1, end=' ')
		ct = 0


(n, m, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = sorted([(a[i], i) for i in range(n)])
ok = [0] * n
ans = 0
for (x, i) in b[-k * m:]:
	ok[i] = 1
	ans += x
t = 0
li = []
for i in range(n):
	t += ok[i]
	if ok[i] and t % m == 0:
		li += [i + 1]
print(ans)
print(*li[:-1])


import heapq
(n, m, k) = map(int, input().split())
a = map(int, input().split())
h = [(x, i + 1) for (i, x) in enumerate(a)]
heapq.heapify(h)
t = heapq.nlargest(m * k, h)
t.sort(key=lambda x: x[1])
s = 0
p = []
for (i, x) in enumerate(t, 1):
	s += x[0]
	if i % m == 0:
		p.append(x[1])
print(s)
print(*p[:-1])


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
b = sorted(a, reverse=True)
t = b[m * k - 1]
idx = b.index(t)
valid = m * k - idx
count = 0
v = 0
ans = []
for i in range(n):
	if a[i] > t or (a[i] == t and v < valid):
		count += 1
		if a[i] == t:
			v += 1
		if count >= m:
			ans.append(i + 1)
			if len(ans) == k - 1:
				break
			count = 0
print(sum((b[i] for i in range(m * k))))
print(*ans)


(n, m, k) = map(int, input().split())
arr = list(map(int, input().split()))
sa = 0
arr_ind = [[c, i] for (i, c) in enumerate(arr)]
arr_ind.sort()
flag = [0] * n
for j in range(n - 1, n - 1 - m * k, -1):
	sa += arr_ind[j][0]
	flag[arr_ind[j][1]] = 1
print(sa)
s = 0
t = 1
for i in range(n):
	s += flag[i]
	if s // m == t:
		t += 1
		print(i + 1, end=' ')
		if t == k:
			break
print()


import sys
(n, m, k) = map(int, sys.stdin.readline().split())
a = list(map(int, sys.stdin.readline().split()))
arr = []
for i in range(n):
	arr.append([a[i], i])
arr.sort(reverse=True)
index = []
ans = 0
for i in range(m * k):
	ans += arr[i][0]
	index.append(arr[i][1])
index.sort()
print(ans)
ans1 = []
for i in range(k - 1):
	ans1.append(index[(i + 1) * m - 1] + 1)
print(*ans1)


from __future__ import print_function
from collections import Counter, OrderedDict
from itertools import permutations as perm
from fractions import Fraction
from collections import deque
from sys import stdin
from bisect import *
from heapq import *
from math import *
g = lambda : stdin.readline().strip()
gl = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
mod = int(1000000000.0) + 7
inf = float('inf')
(n, m, k) = gil()
a = gil()
l = m * k
b = Counter(sorted(a)[-l:])
ans = []
mi = 0
s = 0
for i in range(n):
	if b.get(a[i], 0):
		b[a[i]] -= 1
		s += a[i]
		mi += 1
	if mi == m:
		mi = 0
		ans.append(i + 1)
print(s)
print(*ans[:-1])


(n, m, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
p = [(0, 0)] * n
for i in range(n):
	p[i] = (i, a[i])
s = sorted(p, key=lambda g: g[1], reverse=True)
s = s[:k * m]
s = sorted(s, key=lambda g: g[0])
h = 0
for i in range(len(s)):
	h += s[i][1]
print(h)
l = []
for i in range(1, k):
	l.append(s[i * m][0])
print(*l)


(N, M, K) = map(int, input().split(' '))
ar = list(map(int, input().split()))
dic = []
for i in range(len(ar)):
	dic.append([ar[i], i])
ind = []
dic.sort(reverse=True)
su = 0
for i in range(K * M):
	su += dic[i][0]
	ind.append(dic[i][1])
ind.sort()
ans = []
for i in range(M - 1, len(ind) - 1, M):
	ans.append(ind[i] + 1)
print(su)
print(*ans)


(n, m, k) = map(int, input().split())
a = sorted([(el[1], el[0]) for el in enumerate(map(int, input().split()))], reverse=True)
value = 0
ind = [0] * (m * k)
for i in range(m * k):
	value += a[i][0]
	ind[i] = a[i][1]
ind.sort()
print(value)
for i in range(m, m * k, m):
	print(ind[i - 1] + 1, end=' ')


def get():
	return list(map(int, input().split()))
(n, m, k) = get()
a = get()
b = sorted(a)
c = b[-(m * k):]
f = c.count(c[0])
r = 0
s = sum(b[-(m * k):])
l = []
for i in range(n):
	if a[i] > c[0] or (a[i] == c[0] and f > 0):
		if a[i] == c[0]:
			f -= 1
		r += 1
		if r == m:
			r = 0
			l += [i + 1]
print(s)
print(*l[:k - 1])


l = input().split()
n = int(l[0])
m = int(l[1])
k = int(l[2])
l = input().split()
li = [int(i) for i in l]
lfi = []
for i in range(n):
	lfi.append((int(l[i]), i))
lfi.sort()
lfi.reverse()
hashi = dict()
summax = 0
for i in range(m * k):
	summax += lfi[i][0]
	hashi[lfi[i][1]] = 1
lpart = []
tillnow = 0
for i in range(n):
	if i in hashi:
		tillnow += 1
	if tillnow == m:
		lpart.append(i)
		tillnow = 0
print(summax)
for i in range(k - 1):
	print(lpart[i] + 1, end=' ')
print()


from collections import Counter
(n, m, k) = [int(c) for c in input().split()]
array = [int(c) for c in input().split()]
sortedArray = sorted(array, reverse=True)
greatest = sorted([sortedArray[i] for i in range(m * k)])
greatestCounter = Counter(greatest)
greatestFound = 0
partition = []
intervalNumber = 0
beauty = sum(greatest)
for i in range(len(array)):
	if intervalNumber < k - 1:
		if array[i] in greatestCounter.keys() and greatestCounter[array[i]] > 0:
			greatestFound += 1
			greatestCounter[array[i]] -= 1
			if greatestFound == m:
				intervalNumber += 1
				partition.append(i + 1)
				greatestFound = 0
	else:
		break
print(beauty)
print(' '.join([str(c) for c in sorted(list(partition))]))


inp = [int(x) for x in input().split()]
(n, m) = inp[:2]
k = inp[-1]
l = [int(x) for x in input().split()]
arr = [[i, j] for (i, j) in enumerate(l)]
arr = sorted(arr, key=lambda x: x[1], reverse=True)
summ = 0
for i in range(m * k):
	summ += arr[i][1]
print(summ)
rs = [i[0] + 1 for i in arr[:m * k]]
rs.sort()
frs = []
for i in range(m - 1, m * (k - 1), m):
	frs.append(str(rs[i]))
print(' '.join(frs))


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
b = a.copy()
b.sort(reverse=True)
d = {}
tot = 0
for i in range(k * m):
	tot += b[i]
	if b[i] in d:
		d[b[i]] += 1
	else:
		d[b[i]] = 1
print(tot)
c = m
ans = []
for i in range(n):
	if a[i] in d and d[a[i]] > 0:
		c -= 1
		d[a[i]] -= 1
	if c == 0:
		ans.append(i + 1)
		k -= 1
		c = m
	if k == 0:
		break
ans.pop()
print(*ans)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
b = a[:]
b.sort(reverse=True)
s = 0
c = {}
for i in range(m * k):
	s += b[i]
	c[b[i]] = c.get(b[i], 0) + 1
print(s)
ans = []
ms = m
for i in range(n):
	if c.get(a[i], 0) > 0:
		c[a[i]] -= 1
		ms -= 1
		if ms == 0:
			ms = m
			ans.append(str(i + 1))
ans.pop()
print(' '.join(ans))


(n, m, k) = list(map(int, input().split()))
nums = list(map(int, input().split()))
for (i, num) in enumerate(nums):
	nums[i] = {'value': num, 'ind': i}
nums = sorted(nums, key=lambda x: x['value'], reverse=True)
(beauty, indexes) = (0, [])
for i in range(m * k):
	indexes.append(nums[i]['ind'])
	beauty += nums[i]['value']
indexes.sort()
print(beauty)
print(*[indexes[(i + 1) * m - 1] + 1 for i in range(k - 1)])


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
fin = sorted(a, reverse=True)[:k * m]
s = sum(fin)
d = dict()
for i in fin:
	if i in d:
		d[i] += 1
	else:
		d[i] = 1
print(s)
count = 0
for i in range(n):
	if a[i] in d and d[a[i]] > 0:
		count += 1
		d[a[i]] -= 1
	if count == m and k > 1:
		count = 0
		k -= 1
		print(i + 1, end=' ')


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
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())
lis = list(map(int, input().split()))
aa = sorted(range(len(lis)), key=lambda k: lis[k], reverse=True)
t = m * k
aa = aa[:t]
aa.sort()
p = 0
for i in aa:
	p += lis[i]
ans = []
i = m
while i < len(aa):
	ans.append(aa[i - 1] + 1)
	i += m
print(p)
print(*ans)


l = list(map(int, input().split()))
a = list(map(int, input().split()))
b = a[:]
b.sort(reverse=True)
minn = b[l[2] * l[1] - 1]
cnt = 0
summ = 0
for i in range(l[2] * l[1]):
	summ = summ + b[i]
	if b[i] > minn:
		cnt = cnt + 1
minn_cnt = l[2] * l[1] - cnt
y = l[2] - 1
lenn = 0
i = 0
index = []
while y > 0:
	if a[i] > minn:
		lenn = lenn + 1
	if minn_cnt > 0 and a[i] == minn:
		lenn = lenn + 1
		minn_cnt = minn_cnt - 1
	if lenn == l[1]:
		y = y - 1
		lenn = 0
		index.append(i + 1)
	i = i + 1
print(summ)
print(*index)


(n, k, m) = map(int, input().split())
xs = list(map(int, input().split()))[:n]
helper = sorted(list(zip(xs, range(len(xs)))), reverse=True)
needed = helper[:k * m]
needed = sorted(needed, key=lambda x: x[1])
result = sum([x[0] for x in needed])
print(result)
for i in range(k, len(needed), k):
	print(needed[i][1], end=' ')
print()


import sys, math

def read_int():
	return int(input().strip())

def read_int_list():
	return list(map(int, input().strip().split()))

def read_string():
	return input().strip()

def read_string_list(delim=' '):
	return input().strip().split(delim)
(n, m, k) = read_int_list()
ps = read_int_list()
nis = [(ps[i], i + 1) for i in range(n)]
nis.sort(reverse=True, key=lambda x: x[0])
beauty = 0
pts = []
for i in range(m * k):
	beauty += nis[i][0]
	if nis[i][1] != n:
		pts.append(nis[i][1])
pts.sort()
print(beauty)
for i in range(k - 1):
	print(pts[(i + 1) * m - 1], end=' ')


(n, m, k) = map(int, input().strip().split())
l = [(int(x), i) for (i, x) in enumerate(input().strip().split())]
l.sort(key=lambda x: x[0], reverse=True)
u = m * k
sums = 0
l1 = []
for i in range(u):
	sums += l[i][0]
	l1.append(l[i][1])
l1.sort()
l2 = []
print(sums)
for i in range(k - 1):
	l2.append(l1[(i + 1) * m - 1])
for i in l2:
	print(i + 1, end=' ')


import sys
import heapq
import math
lines = sys.stdin.read().splitlines()
(n, m, k) = [int(x) for x in lines[0].split(' ')]
elems = [int(x) for x in lines[1].split(' ')]
sortedElems = sorted(elems)
if m * k >= n:
	print(sum(elems))
	for i in range(1, k):
		print(i * n // k, end=' ' if i < k - 1 else '\n')
else:
	boundaryElem = sortedElems[-m * k]
	count = sortedElems[-m * k:].count(boundaryElem)
	upToM = 0
	print(sum(sortedElems[-m * k:]))
	for index in range(0, len(elems)):
		i = elems[index]
		if i > boundaryElem:
			upToM += 1
			if upToM > m:
				print(index, end=' ')
				upToM = 1
		elif i == boundaryElem and count > 0:
			count -= 1
			upToM += 1
			if upToM > m:
				print(index, end=' ')
				upToM = 1
	print()


(n, m, k) = tuple(map(int, input().split()))
A = list(map(int, input().split()))
B = A[:]
B.sort()
B = B[-(m * k):]
maximal = {}
summa = 0
for i in B:
	maximal[i] = maximal.get(i, 0) + 1
	summa += i
B = set(B)
count_max = 0
counter = 0
print(summa)
for i in range(n):
	if A[i] in B and maximal[A[i]] != 0:
		count_max += 1
		maximal[A[i]] -= 1
	if count_max == m:
		print(i + 1, end=' ')
		counter += 1
		count_max = 0
	if counter == k - 1:
		break


import sys
from collections import defaultdict
from math import sqrt
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def s(d):
	dis = 1 + 4 * 2 * 3 * d
	ds = sqrt(dis)
	return (-1 + ds) / 6

def add(r, v, m):
	if len(r) < m:
		r.append(v)
		r.sort(reverse=True)
	elif r[-1] < v:
		r.append(v)
		r.sort(reverse=True)
	return r[0:m]

def main():
	(n, m, k) = inlt()
	vals = inlt()
	d = sorted(enumerate(vals), reverse=True, key=lambda b: b[1])[0:m * k]
	print(sum((v[1] for v in d)))
	d2 = sorted(d, key=lambda b: b[0])
	res = []
	i = 0
	for v in range(k):
		res.append(d2[i + m - 1][0] + 1)
		i = i + m
	print(' '.join([str(v) for v in res[:-1]]))
main()


import bisect
(n, m, k) = list(map(int, input().strip().split()))
array = list(map(int, input().strip().split()))
new_array = [(v, idx) for (idx, v) in enumerate(array)]
new_array.sort()
to_select = new_array[-m * k:]
to_select = [(b, a) for (a, b) in to_select]
to_select.sort()
res = 0
curr_m = 0
partitions = []
for (pos, val) in to_select:
	res += val
	curr_m += 1
	if curr_m == m:
		partitions.append(str(pos + 1))
		curr_m = 0
print(res)
print(' '.join(partitions[:-1]))


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
x = sorted(a, reverse=True)
d = {}
for i in range(m * k):
	if x[i] in d:
		d[x[i]] += 1
	else:
		d[x[i]] = 1
indx = []
c = 0
for i in range(n):
	if a[i] in d:
		c += 1
		d[a[i]] -= 1
		if d[a[i]] == 0:
			del d[a[i]]
		if c == m:
			c = 0
			indx.append(i + 1)
print(sum(x[:m * k]))
print(*indx[:-1])


(n, m, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
ind = [x for x in range(n)]
ind = [i for (j, i) in sorted(zip(a, ind), reverse=True)]
index = []
s = 0
for i in range(m * k):
	s += a[ind[i]]
	index.append(ind[i])
print(s)
index.sort()
for i in range(k - 1):
	print(index[(i + 1) * m - 1] + 1, end=' ')


[n, m, k] = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(a)
b.sort(reverse=True)
pool = dict()
val = 0
for i in range(m * k):
	if b[i] in pool:
		pool[b[i]] += 1
	else:
		pool[b[i]] = 1
	val += b[i]
res = list()
hit = 0
for i in range(n):
	if a[i] in pool and pool[a[i]] > 0:
		pool[a[i]] -= 1
		hit += 1
	if hit == m and len(res) + 1 < k:
		res.append(i + 1)
		hit = 0
print(val)
print(' '.join(map(str, res)))


(n, m, k) = [int(x) for x in input().strip().split(' ')]
a = [int(x) for x in input().strip().split(' ')]
limit = sorted(a)[n - m * k]
index = 0
drop = 0
while index < n and drop < n - m * k:
	if a[index] < limit:
		drop += 1
		a[index] = None
	index += 1
index = 0
while index < n and drop < n - m * k:
	if a[index] == limit:
		drop += 1
		a[index] = None
	index += 1
index = 0
segment = []
all = 0
while index < n:
	sub = 0
	total = 0
	while sub < m and index < n:
		if a[index] is not None:
			sub += 1
			total += a[index]
		index += 1
	while index < n and a[index] is None:
		index += 1
	all += total
	segment.append(index)
print(all)
print(' '.join([str(x) for x in segment[:-1]]))
pass


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
b = []
ok = [1] * n
for i in range(n):
	b.append([a[i], i])
b.sort()
ans = 0
for i in range(n):
	ans += a[i]
for i in range(n - m * k):
	ans -= b[i][0]
	ok[b[i][1]] = 0
cnt = 0
print(ans)
for i in range(n - 1):
	cnt += ok[i]
	if cnt == m and k > 1:
		k -= 1
		print(i + 1, end=' ')
		cnt = 0


from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict, Counter
from bisect import bisect
setrecursionlimit(10 ** 7)

def read():
	return int(input())

def reads():
	return [int(x) for x in input().split()]
(n, m, k) = reads()
a = reads()
top = list(reversed(sorted(((x, i) for (i, x) in enumerate(a)))))[:m * k]
maxb = sum((x for (x, _) in top))
inds = sorted((i for (_, i) in top))
print(maxb)
print(' '.join((str(i) for i in inds[m::m])))


(n, m, k) = map(int, input().split())
a = [int(x) for x in input().split()]
b = []
for (ind, nm) in enumerate(a):
	b.append((nm, ind))
b = sorted(b)
b = b[::-1]
ans = 0
flag = [False for _ in range(n)]
for i in range(m * k):
	flag[b[i][1]] = True
	ans += b[i][0]
print(ans)
cnt = 0
j = 0
for i in range(n):
	if flag[i]:
		cnt += 1
	if cnt == m:
		print(i + 1, end=' ')
		cnt = 0
		j += 1
		if j == k - 1:
			exit()


(n, m, k) = map(int, input().split())
arr = input()
nums = [int(n) for n in arr.split()]
s = list(enumerate(nums))
s.sort(key=lambda x: x[1], reverse=True)
s = s[:m * k]
sum = sum((x[1] for x in s))
print(sum)
s = [x[0] for x in s]
s.sort()
for i in range(m, m * k, m):
	print(s[i - 1] + 1, end=' ')


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
b = sorted(a)
d = {}
for i in range(m * k):
	d[b[n - 1 - i]] = d.get(b[n - 1 - i], 0) + 1
c = 0
kk = []
print(sum(b[::-1][:m * k]))
for i in range(n):
	if d.get(a[i], 0) > 0:
		d[a[i]] -= 1
		c += 1
	if c == m:
		c = 0
		kk.append(i + 1)
print(*kk[:len(kk) - 1])


from collections import defaultdict as dd
import math

def nn():
	return int(input())

def li():
	return list(input())

def mi():
	return map(int, input().split())

def lm():
	return list(map(int, input().split()))
(n, m, k) = mi()
l = lm()
l2 = sorted(l)
needed = m * k
total = sum(l2[-needed:])
bubble = l2[-m * k]
i = 1
bubblecount = 1
while i + -m * k < len(l2) and l2[-m * k + i] == l2[-m * k]:
	bubblecount += 1
	i += 1
currentcount = 0
cutlist = []
cuts = 0
for i in range(n):
	if l[i] > bubble:
		currentcount += 1
	if l[i] == bubble and bubblecount > 0:
		currentcount += 1
		bubblecount -= 1
	if currentcount == m and cuts < k - 1:
		cuts += 1
		cutlist.append(i + 1)
		currentcount = 0
print(total)
print(*cutlist)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
c = []
for i in range(n):
	c.append([a[i], i])
b = sorted(c, reverse=True)

def f(m, a):
	s = 0
	b = sorted(a, reverse=True)
	for i in range(m):
		s += b[i]
	return s
ans = []
for i in range(m * k):
	ans.append(b[i])
sum = 0
for elem in ans:
	sum += elem[0]
anss = []
for elem in ans:
	el1 = elem[0]
	el2 = elem[1]
	anss.append([el2, el1])
anss.sort()
z = 0
print(sum)
for i in range(m - 1, len(anss), m):
	j = anss[i][0]
	z += 1
	print(j + 1, end=' ')
	if z == k - 1:
		break


from collections import defaultdict

def search(a, t):
	l = 0
	r = len(a) - 1
	while r - l >= 0:
		mid = (l + r) // 2
		if a[mid] == t:
			return True
		if a[mid] < t:
			l = mid + 1
		if a[mid] > t:
			r = mid - 1
	return False
(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
s = a.copy()
s = sorted(s)[n - m * k:]
c = defaultdict(int)
for i in s:
	c[i] += 1
ind = []
tmp = []
for i in range(n):
	if search(s, a[i]) and c[a[i]]:
		if len(tmp) == m:
			ind.append(tmp)
			tmp = []
		tmp.append(i + 1)
		c[a[i]] -= 1
ar = [i[-1] for i in ind]
print(sum(s))
print(*ar)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
b = a.copy()
b.sort(reverse=True)
d = dict()
for i in b[:m * k]:
	if i in d:
		d[i] += 1
	else:
		d[i] = 1
ans = list()
j = 0
for i in range(n):
	if a[i] in d:
		if d[a[i]] > 0:
			d[a[i]] -= 1
			j += 1
	if j == m:
		ans.append(i + 1)
		j = 0
print(sum(b[:m * k]))
print(*ans[:-1])


def func(n):
	return n[1]
(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
b = [[a[i], i] for i in range(len(a))]
b.sort(reverse=True)
b = b[:m * k]
b.sort(key=func)
ans = []
ans2 = 0
for i in range(0, len(b), 1):
	if (i + 1) % m == 0:
		ans.append(b[i][1] + 1)
	ans2 += b[i][0]
print(ans2)
print(' '.join(map(str, ans[:-1])))


import sys
import math
from collections import Counter
from operator import itemgetter
import queue

def IO():
	sys.stdin = open('pyinput.txt', 'r')
	sys.stdout = open('pyoutput.txt', 'w')

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

def LCM(a, b):
	return a * (b // GCD(a, b))

def scan(TYPE_1, TYPE_2=0):
	if TYPE_1 == int:
		return map(int, sys.stdin.readline().strip().split())
	elif TYPE_1 == float:
		return map(float, sys.stdin.readline().strip().split())
	elif TYPE_1 == list and TYPE_2 == float:
		return list(map(float, sys.stdin.readline().strip().split()))
	elif TYPE_1 == list and TYPE_2 == int:
		return list(map(int, sys.stdin.readline().strip().split()))
	elif TYPE_1 == str:
		return sys.stdin.readline().strip()
	else:
		print('ERROR!!!!')

def main():
	(n, m, k) = scan(int)
	a = scan(list, int)
	x = sorted(a, reverse=True)
	x = x[:k * m]
	mp = {}
	for i in x:
		if mp.get(i, 's') == 's':
			mp[i] = 1
		else:
			mp[i] += 1
	print(sum(x))
	ans = []
	cnt = 0
	for i in range(n):
		if mp.get(a[i], 0) == 0:
			continue
		cnt += 1
		mp[a[i]] -= 1
		if cnt == m:
			ans.append(i + 1)
			cnt = 0
	print(*ans[:k - 1])
main()


import sys
import math
import array
import bisect
import collections
from collections import Counter, defaultdict
import fractions
import heapq
import re
sys.setrecursionlimit(1000000)

def array2d(dim1, dim2, init=None):
	return [[init for _ in range(dim2)] for _ in range(dim1)]

def argsort(l, reverse=False):
	return sorted(range(len(l)), key=lambda i: l[i], reverse=reverse)

def argmin(l):
	return l.index(min(l))

def YESNO(ans, yes='YES', no='NO'):
	print([no, yes][ans])
II = lambda : int(input())
MI = lambda : map(int, input().split())
MIL = lambda : list(MI())
MIS = lambda : input().split()

def main():
	(N, M, K) = MI()
	a = MIL()
	l = [False] * N
	for i in argsort(a, True)[:M * K]:
		l[i] = True
	ans = 0
	cnt = 0
	al = []
	for i in range(N):
		if l[i]:
			ans += a[i]
			cnt += 1
			if cnt == M:
				cnt = 0
				al.append(i + 1)
	print(ans)
	print(' '.join(map(str, al[:-1])))
main()


def go():
	(n, m, k) = [int(i) for i in input().split(' ')]
	original = [int(i) for i in input().split(' ')]
	a = sorted(original, reverse=True)
	d = {}
	for i in range(m * k):
		d.setdefault(a[i], 0)
		d[a[i]] += 1
	c = 0
	r = 0
	o = []
	for i in range(n):
		if original[i] in d:
			if d[original[i]] == 1:
				d.pop(original[i])
			else:
				d[original[i]] -= 1
			c += 1
			if c == m:
				c = 0
				o.append(i + 1)
	total = sum((a[i] for i in range(m * k)))
	return '{}\n{}'.format(total, ' '.join((str(i) for i in o[:-1])))
print(go())


(n, m, k) = map(int, input().split())
l = list(map(int, input().split()))
a = n // k
su = 0
li = (a - 1) * k
for i in range(n):
	l[i] = (i + 1, l[i])
l.sort(reverse=True, key=lambda x: x[1])
lol = m * k
for i in range(lol):
	su = su + l[i][1]
l = l[:m * k]
print(su)
kk = 0
l.sort()
for i in range(m, m * k, m):
	print(l[i][0] - 1, end=' ')
print()


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
b = sorted(range(len(a)), key=lambda i: a[i], reverse=True)
b = b[:m * k]
b.sort()
sum = 0
for i in b:
	sum += a[i]
print(sum)
b = b[m - 1:-1:m]
for i in b:
	print(i + 1, end=' ')
print()


R = lambda : map(int, input().split())
(n, m, k) = R()
a = sorted(zip(R(), range(n)))[-m * k:]
print(sum((x for (x, _) in a)), *sorted((i + 1 for (_, i) in a))[m - 1:-1:m])


(n, m, k) = input().split()
n = int(n)
m = int(m)
k = int(k)
arr = input().split()
a = [int(i) for i in arr]
c = [i for i in a]
a.sort()
rem = n - m * k
h = {}
for i in a:
	h[i] = 0
for i in range(rem):
	h[a[i]] += 1
l = 0
b = []
su = 0
for i in range(n):
	if h[c[i]] == 0:
		l += 1
		su += c[i]
	else:
		h[c[i]] -= 1
	if l == m:
		l = 0
		b.append(i)
print(su)
for i in range(k - 1):
	print(b[i] + 1, end=' ')


from operator import itemgetter
from itertools import accumulate
(n, m, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
id = [x for x in range(n)]
b = list(zip(a, id))
a.sort(reverse=True)
b.sort(reverse=True)
c = [p[1] for p in b[:m * k]]
c.sort()
print(list(accumulate(a[:m * k]))[-1])
for x in [x + 1 for x in c][m - 1::m][:k - 1]:
	print(x, end=' ')


(n, m, k) = map(int, input().split())
l = list(map(int, input().split()))
ans = []
for i in range(n):
	ans.append([l[i], i])
ans.sort(reverse=1)
sum = 0
ans1 = []
for i in range(m * k):
	sum += ans[i][0]
	ans1.append(ans[i][1] + 1)
print(sum)
ans1.sort()
for i in range(m - 1, len(ans1) - 1, m):
	print(ans1[i], end=' ')


def inpl():
	return list(map(int, input().split()))
(N, M, K) = inpl()
A = [(int(v), i) for (i, v) in enumerate(input().split(), 1)]
A.sort(reverse=True)
H = dict()
for (j, (_, i)) in enumerate(A, 1):
	H[i] = j
ctr = 0
ans = []
sumans = 0
for i in range(1, N + 1):
	pre = ctr
	if H[i] <= K * M:
		ctr += 1
	if not ctr % M and pre != ctr:
		ans.append(i)
print(sum([v for (v, _) in A[:K * M]]))
print(*ans[:-1])


from sys import stdin, stdout
(n, m, k) = [int(x) for x in stdin.readline().rstrip().split()]
A = [int(x) for x in stdin.readline().rstrip().split()]
I = list(reversed(sorted(range(n), key=lambda i: A[i])))
S = set(I[:m * k])
ans = []
count = 0
for i in range(n):
	if i in S:
		count += 1
	if count == m:
		ans.append(i + 1)
		count = 0
ans.pop()
print(sum((A[i] for i in S)))
print(' '.join((str(x) for x in ans)))


def answer(n, m, k, A):
	count = 0
	l = sorted(A)
	maxi = 0
	d = {}
	for i in range(n - 1, -1, -1):
		if count == m * k:
			break
		if l[i] in d:
			d[l[i]] += 1
		else:
			d[l[i]] = 1
		maxi += l[i]
		count += 1
	ans = []
	count = 0
	for i in range(n):
		if A[i] in d:
			if d[A[i]] > 0:
				count += 1
				d[A[i]] -= 1
		if count == m:
			ans.append(i + 1)
			count = 0
	ans.pop()
	return (maxi, ans)
(n, m, k) = map(int, input().split())
arr = list(map(int, input().split()))
(a, b) = answer(n, m, k, arr)
print(a)
print(*b)


import sys
from collections import Counter
input = lambda : sys.stdin.readline().strip('\r\n')
(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
ls = sorted(a, reverse=True)[:k * m]
s = sum(ls)
print(s)
d = Counter(ls)
cnt = 0
for i in range(n):
	if a[i] in d and d[a[i]] > 0:
		d[a[i]] -= 1
		cnt += 1
	if cnt == m and k > 1:
		cnt = 0
		k -= 1
		print(i + 1, end=' ')
print()


import sys
import heapq
import collections
data = sys.stdin.read().splitlines()
(n, m, k) = map(int, data[0].split())
nums = list(map(int, data[1].split()))
bests = collections.Counter(heapq.nlargest(k * m, nums))
ps = []
cnt = 0
ans = 0
K = k
for (j, num) in enumerate(nums):
	if num in bests:
		bests[num] -= 1
		if bests[num] == 0:
			bests.pop(num)
		ans += num
		cnt += 1
	if cnt >= m and k != 0 or n - j - 1 == (k - 1) * m:
		ps.append(j + 1)
		k -= 1
		cnt = 0
print(ans)
for i in range(K - 1):
	print(ps[i], end=' ')
print()


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
b = [(a[i], i) for i in range(n)]
b.sort(reverse=True)
c = [0] * n
sm = 0
for i in range(m * k):
	sm += b[i][0]
	c[b[i][1]] = 1
i = 0
p = []
while i < n:
	j = i
	cnt = 0
	while j < n and cnt < m:
		cnt += c[j]
		j += 1
	p.append(j)
	i = j
print(sm)
print(*p[:k - 1])


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
b = sorted(a, reverse=True)
d = dict()
s = 0
for i in b[:m * k]:
	s += i
	if i in d:
		d[i] += 1
	else:
		d[i] = 1
ans = []
prev = 0
for i in range(k - 1):
	count = 0
	pos = prev
	while count < m:
		if a[pos] in d and d[a[pos]] > 0:
			d[a[pos]] -= 1
			count += 1
		pos += 1
	prev = pos
	ans.append(str(pos))
print(s)
print(' '.join(ans))


import sys
input = sys.stdin.readline
from collections import defaultdict
(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
b = a[:]
b.sort(reverse=True)
ans0 = 0
d = defaultdict(int)
for i in range(m * k):
	ans0 += b[i]
	d[b[i]] += 1
s = set(list(d.keys()))
cnt = defaultdict(int)
c = 0
ans1 = []
for i in range(n):
	if a[i] in s and cnt[a[i]] < d[a[i]]:
		c += 1
		cnt[a[i]] += 1
		if c == m:
			ans1.append(i + 1)
			c = 0
print(ans0)
print(*ans1[:-1])


from collections import defaultdict
(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
s = a.copy()
s.sort(reverse=True)
ans = sum(s[:k * m])
d = defaultdict(int)
for i in s[:k * m]:
	d[i] += 1
c = 0
fin = []
for i in range(n):
	if a[i] in d and d[a[i]] >= 1:
		d[a[i]] -= 1
		c += 1
	if c == m:
		fin.append(i + 1)
		c = 0
fin.pop(-1)
print(ans)
print(*fin)


line1 = input()
line2 = input()
(n, m, k) = map(int, line1.split())
nums = list(map(int, line2.split()))
nums_copy = nums.copy()
nums_copy.sort()
counter = {}
res1 = 0
res2 = []
for num in nums_copy[n - m * k:]:
	counter[num] = counter.get(num, 0) + 1
	res1 += num
cnt = 0
for (index, num) in enumerate(nums):
	if num in counter.keys():
		cnt += 1
		counter[num] -= 1
		if counter[num] == 0:
			del counter[num]
		if cnt == m:
			res2.append(index + 1)
			if len(res2) == k - 1:
				break
			cnt = 0
print(res1)
print(' '.join(map(str, res2)))


from operator import itemgetter
(n, m, k) = map(int, input().split())
ali = list(map(int, input().split()))
bli = list(enumerate(ali))
bli.sort(key=itemgetter(1), reverse=True)
cli = list(map(itemgetter(0), bli))[:m * k]
cli.sort()
dli = list(map(lambda x: x + 1, cli[m - 1::m]))[:k - 1]
print(sum(map(itemgetter(1), bli[:m * k])))
print(' '.join(map(str, dli)))


(n, m, k) = map(int, input().split())
cl = list(map(int, input().split()))
pl = sorted(cl)
dic = {}
for i in range(n - m * k, n):
	dic.update({pl[i]: 1})
pos = pl[n - m * k]
p = pl[n - m * k:].count(pos)
for i in range(n - m * k):
	if pl[i] != pos:
		dic.update({pl[i]: 0})
count = 0
ans = []
sm = sum(pl[n - m * k:])
for i in range(n):
	if dic[cl[i]] == 1:
		if cl[i] == pos:
			if p != 0:
				count += 1
				p -= 1
		else:
			count += 1
	if count == m:
		ans.append(i + 1)
		count = 0
print(sm)
print(*ans[:k - 1])


(n, m, k) = list(map(int, input().split(' ')))
std_in = list(map(int, input().split(' ')))
a = [(std_in[i], i) for i in range(n)]
a = sorted(a, key=lambda x: x[0], reverse=True)
largest = a[:m * k]
print(sum([i[0] for i in largest]))
ind = sorted(largest, key=lambda x: x[1])
print(' '.join([str(ind[m * i - 1][1] + 1) for i in range(1, k)]))


from collections import defaultdict

def solve():
	(n, m, k) = list(map(int, input().split()))
	arr = list(map(int, input().split()))
	find = sorted(arr)[-k * m:]
	freq = defaultdict(int)
	for i in find:
		freq[i] += 1
	unique = set(find)
	print(sum(find))
	if n == k * m:
		count = 0
		index = 0
		while count < k - 1:
			index += m
			print(index, end=' ')
			count += 1
		print()
	elif n < k * m:
		count = 0
		index = 1
		while n < (k - count) * m:
			print(index, end=' ')
			n -= 1
			count += 1
			index += 1
		index += m - 1
		for i in range(index, n + count, m):
			print(i, end=' ')
		print()
	else:
		count = 0
		for (index, value) in enumerate(arr):
			if value in unique and freq[value] > 0:
				freq[value] -= 1
				count += 1
			if count == m:
				print(index + 1, end=' ')
				count = 0
				k -= 1
			if k - 1 == 0:
				print()
				return
solve()


from collections import defaultdict
(n, m, k) = map(int, input().split())
arr = [int(x) for x in input().split()]
ans = []
largest = sorted(arr, reverse=True)[:m * k]
dd = defaultdict(int)
k -= 1
for x in largest:
	dd[x] += 1
temp = m
for i in range(len(arr)):
	if dd[arr[i]]:
		dd[arr[i]] -= 1
		temp -= 1
	if temp <= 0:
		ans.append(i + 1)
		temp = m
		k -= 1
	if k <= 0:
		break
print(sum(largest))
for x in ans:
	print(x, end=' ')


from copy import deepcopy
(n, k, m) = map(int, input().split())
arr = list(map(int, input().split()))
arr2 = sorted(arr, reverse=True)
print(sum(arr2[:m * k]))
arr = sorted([(y, x) for (x, y) in enumerate(arr)], reverse=True)
ids = sorted([y for (x, y) in arr[:m * k]])
print(' '.join([str(x + 1) for x in ids[k - 1::k]][:-1]))


def main():
	(n, m, k) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	ret = sum(a)
	index = list(range(n))
	index.sort(key=lambda i: a[i])
	rm_flag = [False] * n
	for i in range(n - m * k):
		rm_flag[index[i]] = True
		ret -= a[index[i]]
	(pos, cnt) = ([], 0)
	for i in range(n):
		if not rm_flag[i]:
			cnt += 1
			if cnt == m:
				pos.append(i + 1)
				cnt = 0
				if len(pos) == k - 1:
					break
	print(ret)
	print(*pos)

def __starting_point():
	main()
__starting_point()


(n, m, k) = map(int, input().split())
A = list(map(int, input().split()))
a = list(enumerate(A))
a.sort(key=lambda x: x[1])
f = [0] * (n + 100)
ans = 0
ANS = []
for i in range(n - m * k):
	f[a[i][0]] = 1
t = 0
tt = 0
for i in range(n):
	t += 1
	ans += A[i]
	if f[i] == 1:
		t -= 1
		ans -= A[i]
	if t == m and tt != k:
		ANS.append(i + 1)
		t = 0
		tt += 1
print(ans)
for i in ANS[:-1]:
	print(i, end=' ')


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
b = []
b.sort()
mn = 10 ** 18
q = 0
for i in range(n):
	b.append([a[i], i])
b.sort(reverse=True)
l = 0
ind = []
for i in range(m * k):
	q += b[i][0]
	ind.append(b[i][1])
ind.sort()
ans = []
for i in range(len(ind)):
	l += 1
	if l % m == 0:
		ans.append(ind[i] + 1)
print(q)
print(*ans[0:len(ans) - 1])


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

class SortedList:

	def __init__(self, iterable=[], _load=200):
		values = sorted(iterable)
		self._len = _len = len(values)
		self._load = _load
		self._lists = _lists = [values[i:i + _load] for i in range(0, _len, _load)]
		self._list_lens = [len(_list) for _list in _lists]
		self._mins = [_list[0] for _list in _lists]
		self._fen_tree = []
		self._rebuild = True

	def _fen_build(self):
		self._fen_tree[:] = self._list_lens
		_fen_tree = self._fen_tree
		for i in range(len(_fen_tree)):
			if i | i + 1 < len(_fen_tree):
				_fen_tree[i | i + 1] += _fen_tree[i]
		self._rebuild = False

	def _fen_update(self, index, value):
		if not self._rebuild:
			_fen_tree = self._fen_tree
			while index < len(_fen_tree):
				_fen_tree[index] += value
				index |= index + 1

	def _fen_query(self, end):
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		x = 0
		while end:
			x += _fen_tree[end - 1]
			end &= end - 1
		return x

	def _fen_findkth(self, k):
		_list_lens = self._list_lens
		if k < _list_lens[0]:
			return (0, k)
		if k >= self._len - _list_lens[-1]:
			return (len(_list_lens) - 1, k + _list_lens[-1] - self._len)
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		idx = -1
		for d in reversed(range(len(_fen_tree).bit_length())):
			right_idx = idx + (1 << d)
			if right_idx < len(_fen_tree) and k >= _fen_tree[right_idx]:
				idx = right_idx
				k -= _fen_tree[idx]
		return (idx + 1, k)

	def _delete(self, pos, idx):
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len -= 1
		self._fen_update(pos, -1)
		del _lists[pos][idx]
		_list_lens[pos] -= 1
		if _list_lens[pos]:
			_mins[pos] = _lists[pos][0]
		else:
			del _lists[pos]
			del _list_lens[pos]
			del _mins[pos]
			self._rebuild = True

	def _loc_left(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(lo, pos) = (-1, len(_lists) - 1)
		while lo + 1 < pos:
			mi = lo + pos >> 1
			if value <= _mins[mi]:
				pos = mi
			else:
				lo = mi
		if pos and value <= _lists[pos - 1][-1]:
			pos -= 1
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value <= _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def _loc_right(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(pos, hi) = (0, len(_lists))
		while pos + 1 < hi:
			mi = pos + hi >> 1
			if value < _mins[mi]:
				hi = mi
			else:
				pos = mi
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value < _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def add(self, value):
		_load = self._load
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len += 1
		if _lists:
			(pos, idx) = self._loc_right(value)
			self._fen_update(pos, 1)
			_list = _lists[pos]
			_list.insert(idx, value)
			_list_lens[pos] += 1
			_mins[pos] = _list[0]
			if _load + _load < len(_list):
				_lists.insert(pos + 1, _list[_load:])
				_list_lens.insert(pos + 1, len(_list) - _load)
				_mins.insert(pos + 1, _list[_load])
				_list_lens[pos] = _load
				del _list[_load:]
				self._rebuild = True
		else:
			_lists.append([value])
			_mins.append(value)
			_list_lens.append(1)
			self._rebuild = True

	def discard(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_right(value)
			if idx and _lists[pos][idx - 1] == value:
				self._delete(pos, idx - 1)

	def remove(self, value):
		_len = self._len
		self.discard(value)
		if _len == self._len:
			raise ValueError('{0!r} not in list'.format(value))

	def pop(self, index=-1):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		value = self._lists[pos][idx]
		self._delete(pos, idx)
		return value

	def bisect_left(self, value):
		(pos, idx) = self._loc_left(value)
		return self._fen_query(pos) + idx

	def bisect_right(self, value):
		(pos, idx) = self._loc_right(value)
		return self._fen_query(pos) + idx

	def count(self, value):
		return self.bisect_right(value) - self.bisect_left(value)

	def __len__(self):
		return self._len

	def __getitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		return self._lists[pos][idx]

	def __delitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		self._delete(pos, idx)

	def __contains__(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_left(value)
			return idx < len(_lists[pos]) and _lists[pos][idx] == value
		return False

	def __iter__(self):
		return (value for _list in self._lists for value in _list)

	def __reversed__(self):
		return (value for _list in reversed(self._lists) for value in reversed(_list))

	def __repr__(self):
		return 'SortedList({0})'.format(list(self))

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()
		a = ria()
		z = m * k
		d = {}
		sa = sorted(a)[::-1]
		sumsa = 0
		for i in range(z):
			if sa[i] in d:
				d[sa[i]] += 1
			else:
				d[sa[i]] = 1
		curr = 0
		ind = 0
		ans = []
		for i in a:
			ind += 1
			if i in d and d[i] > 0:
				d[i] -= 1
				sumsa += i
				curr += 1
			if curr == m:
				curr = 0
				ans.append(ind)
		wi(sumsa)
		wia(ans[:k - 1])
	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 os
import sys
from io import BytesIO, IOBase
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 = [] + l
a.sort(reverse=True)
print(sum(a[:m * k]))
d = dict()
for i in range(m * k):
	if a[i] not in d:
		d.update({a[i]: 1})
	else:
		d[a[i]] += 1
t = 0
c = 0
for i in range(len(l)):
	if l[i] in d.keys():
		d[l[i]] -= 1
		if d[l[i]] == 0:
			del d[l[i]]
		t += 1
	if t == m:
		c += 1
		if c < k:
			print(i + 1, end=' ')
		t = 0


(n, m, k) = map(int, input().split())
arr1 = list(map(int, input().split()))
arr2 = []
for i in range(len(arr1)):
	arr2.append((arr1[i], i))
arr2.sort(reverse=True)
arr3 = []
ans = 0
for i in range(m * k):
	ans += arr2[i][0]
	arr3.append(arr2[i][1])
arr3.sort()
ansarr = []
count = 0
for i in range(m * k - m):
	if (i + 1) % m == 0:
		ansarr.append(arr3[i] + 1)
print(ans)
print(*ansarr)


import heapq
(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
a2 = [i for i in a]
g = {}
heapq._heapify_max(a)
s = 0
for i in range(m * k):
	p = heapq._heappop_max(a)
	s += p
	if p in g:
		g[p] += 1
	else:
		g[p] = 1
print(s)
t = []
count = 0
split = 0
for (index, value) in enumerate(a2):
	if value in g:
		count += 1
		g[value] -= 1
		if g[value] == 0:
			del g[value]
	if count == m and split < k - 1:
		t.append(index + 1)
		split += 1
		count = 0
print(*t)


import sys
from math import gcd
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

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

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
(n, m, k) = Ri()
a = Ri()
lis = [[a[i], i] for i in range(n)]
lis.sort(key=lambda x: (-x[0], x[1]))
tot = 0
lis = lis[0:m * k]
for i in lis:
	tot += i[0]
lis = [lis[i][1] for i in range(len(lis))]
lis.sort()
summ = 0
ans = []
for i in range(m - 1, len(lis), m):
	ans.append(lis[i])
print(tot)
print(*[ans[i] + 1 for i in range(len(ans) - 1)])


[n, m, k] = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
sort = sorted(a)
sort.reverse()
comparison = sort[m * k - 1]
num_comparison = sort[:m * k].count(comparison)
partition_count = 0
output = []
curr_k = k
for i in range(n):
	if a[i] > comparison or (a[i] == comparison and num_comparison):
		partition_count += 1
		if partition_count == m:
			output.append(str(i + 1))
			partition_count = 0
			curr_k -= 1
	if num_comparison and a[i] == comparison:
		num_comparison -= 1
	if curr_k == 1:
		break
print(sum(sort[:m * k]))
print(' '.join(output))


from collections import Counter
(n, m, k) = map(int, input().split())
l = list(map(int, input().split()))
ke = sorted(l[:], reverse=True)
final = sum(ke[0:m * k])
d = dict(Counter(ke[0:m * k]))
ans = []
c = m
for i in range(n):
	if l[i] in d:
		c -= 1
		d[l[i]] -= 1
		if d[l[i]] == 0:
			del d[l[i]]
		if c == 0:
			c = m
			k -= 1
			ans.append(i + 1)
			if k == 1:
				break
print(final)
print(*ans)


(n, m, k) = map(int, input().split())
a = []
i = 0
for item in input().split():
	a.append((int(item), i))
	i += 1
a.sort(reverse=True)
c = 0
index = []
for i in range(m * k):
	c += a[i][0]
	index.append(a[i][1])
print(c)
index.sort()
for i in range(m - 1, m * k - 1, m):
	print(index[i] + 1, end=' ')


import sys
from math import gcd, log2

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

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

def input():
	return sys.stdin.readline().strip('\n')
(n, m, k) = get_ints()
l = get_array()
s = []
for (i, j) in enumerate(l):
	s.append((i, j))
s.sort(key=lambda x: x[1], reverse=True)
index = [0] * (m * k)
ans = 0
for i in range(m * k):
	ans += s[i][1]
	index[i] = s[i][0]
index.sort()
ansr = [0] * (k - 1)
for i in range(k - 1):
	ansr[i] = index[m * (i + 1) - 1] + 1
print(ans)
print(*ansr)


R = lambda : map(int, input().split())
(n, m, k) = R()
L = list(R())
S = sorted(L)
ind = n - m * k
e = S[ind]
c = 1
while ind < n - 1:
	if S[ind] == S[ind + 1]:
		c += 1
	else:
		break
	ind += 1
res = []
ans = 0
p = m
for i in range(n):
	if L[i] > e:
		p -= 1
		ans += L[i]
	elif L[i] == e and c > 0:
		c -= 1
		p -= 1
		ans += L[i]
	if p == 0:
		res.append(i + 1)
		p = m
print(ans)
print(*res[:-1])


(n, m, k) = [int(s) for s in input().split(' ')]
array = [int(s) for s in input().split(' ')]
index = sorted(range(len(array)), key=lambda k: array[k], reverse=True)
index = sorted(index[:m * k])
out = index[m - 1::m][:-1]
print(sum((array[i] for i in index)))
print(' '.join((str(i + 1) for i in out)))


(n, m, k) = map(int, input().split())
mas = list(map(int, input().split()))
qu = {}
for i in sorted(mas, reverse=True)[:k * m]:
	if not i in qu.keys():
		qu[i] = 0
	qu[i] += 1
otv = []
c = 0
for i in range(n):
	if mas[i] in qu.keys() and qu[mas[i]] > 0:
		qu[mas[i]] -= 1
		c += 1
	if c == m:
		otv.append(i + 1)
		c = 0
print(sum(sorted(mas, reverse=True)[:k * m]))
for i in otv[:-1]:
	print(i, end=' ')


def make_string(ans):
	sss = ''
	for (index, value) in enumerate(ans):
		if index:
			sss += ' '
		sss += str(value)
	return sss

def each():
	(n, m, k) = [int(x) for x in input().split(' ')]
	arr = [[int(value), index] for (index, value) in enumerate(input().split(' '))]
	arr.sort()
	sum = 0
	len = n - min(m * k, n) - 1
	for i in range(n - 1, len, -1):
		sum += arr[i][0]
		arr[i][0] = None
	arr.sort(key=lambda x: x[1:2])
	mmm = m
	ans = []
	for i in range(n):
		if arr[i][0] == None:
			mmm -= 1
		if mmm == 0:
			mmm = m
			ans.append(arr[i][1] + 1)
	ans.pop()
	print(sum)
	ans = make_string(ans)
	print(ans)
each()


def check():
	(n, m, k) = [int(x) for x in input().split()]
	s = [int(x) for x in input().split()]
	a = []
	stop = []
	for i in range(n):
		a += [(int(s[i]), i)]
	aa = sorted(a, key=lambda x: x[0], reverse=True)
	aa = aa[:m * k]
	ans = 0
	for e in aa:
		ans += e[0]
	counter = 0
	vis = [0 for _ in range(n)]
	for i in aa:
		vis[i[1]] = 1
	for i in range(len(a)):
		if vis[i] == 1:
			counter += 1
		if counter == m:
			stop += [i + 1]
			counter = 0
			k -= 1
		if k == 1:
			break
	print(ans)
	for e in stop:
		print(e, end=' ')
check()


import sys, os
from io import BytesIO, IOBase
import collections, itertools, bisect, heapq, math, string
from decimal import *
BUFSIZE = 8192
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')

def main():
	(n, m, k) = map(int, input().split())
	a = list(map(int, input().split()))
	sa = sorted(a)
	s = sum(sa[n - m * k:])
	d = collections.Counter(sa[n - m * k:])
	ans = []
	(l, r) = (0, 0)
	while r < n:
		t = 0
		while r < n:
			if t >= m:
				ans.append((l, r))
				break
			if a[r] in d.keys() and d[a[r]] > 0:
				d[a[r]] -= 1
				t += 1
			r += 1
		l = r
	print(s)
	print(' '.join([str(ans[j][1]) for j in range(k - 1)]))
main()


(n, m, k) = map(int, input().split())
ls = list(map(int, input().split()))
ls2 = ls.copy()
ls2.sort()
d = {}
count = 0
ans = 0
for x in reversed(ls2):
	r = int(x)
	ans = ans + r
	if r in d:
		d[r] = d[r] + 1
	else:
		d[r] = 1
	count = count + 1
	if count == m * k:
		break
ls1 = list()
count = 0
count1 = 0
for i in range(0, n):
	h = ls[i]
	if h in d:
		d[h] = d[h] - 1
		if d[h] == 0:
			del d[h]
		count1 = count1 + 1
		if count1 == m:
			count1 = 0
			count = count + 1
			ls1.append(i + 1)
			if count == k - 1:
				break
print(ans)
for i in range(0, len(ls1)):
	print(ls1[i], end=' ')


[n, m, k] = list(map(int, input().split()))
a = list(map(int, input().split()))
b = a[:]
b.sort(reverse=True)
can = b[m * k - 1]
last = 0
for i in range(m * k, len(b)):
	if b[i] == can:
		last += 1
	else:
		break
ans = 0
for i in range(m * k):
	ans += b[i]
print(ans)
num = 0
ans = []
for i in range(len(a)):
	if a[i] >= can:
		if last > 0 and a[i] == can:
			last -= 1
		else:
			num += 1
	if num >= m:
		ans.append(i + 1)
		num = 0
	if len(ans) == k - 1:
		break
print(' '.join((str(i) for i in ans)))


(n, m, k) = map(int, input().split())
r = list(map(int, input().split()))
r = [[r[i], i] for i in range(n)]
r.sort(reverse=True)
ans = 0
ind = [0] * (m * k)
for i in range(m * k):
	ans += r[i][0]
	ind[i] = r[i][1]
ind.sort()
print(ans)
for i in range(k - 1):
	print(ind[(i + 1) * m - 1] + 1, end=' ')


(n, m, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = sorted(a, reverse=True)
middle = b[m * k - 1]
nm = b[:m * k].count(middle)
sum = sum(b[:m * k])
ind = []
c = 0
cut = 0
cm = 0
for i in range(len(a)):
	if a[i] >= middle:
		if a[i] == middle:
			if cm < nm:
				cm += 1
				c += 1
		else:
			c += 1
	if c == m:
		c = 0
		cut += 1
		ind.append(i + 1)
	if cut == k - 1:
		break
print(sum)
print(' '.join(list(map(str, ind))))


import os
import sys
from io import BytesIO, IOBase
from collections import defaultdict, deque, Counter, OrderedDict
import threading

def main():
	(n, m, k) = map(int, input().split())
	a = [*map(int, input().split())]
	D = []
	for i in range(n):
		D.append([a[i], i])
	D = sorted(D)[len(D) - m * k:]
	D.sort(key=lambda z: z[1])
	val = 0
	for i in range(len(D)):
		val += D[i][0]
	ans = []
	for i in range(m - 1, len(D) - 1, m):
		ans.append(D[i][1] + 1)
	print(val)
	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))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


(n, m, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [[i, j] for (i, j) in enumerate(a)]
b.sort(key=lambda x: x[1], reverse=True)
c = [False] * n
sum_a = 0
for i in range(k * m):
	c[b[i][0]] = True
	sum_a += b[i][1]
print(sum_a)
cnt = 0
all_k = 1
for i in range(n):
	if c[i]:
		cnt += 1
		if cnt == m and all_k < k:
			print(i + 1, end=' ')
			cnt = 0
			all_k += 1
print()


import collections
(n, m, k) = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
C = collections.Counter(sorted(A, reverse=True)[:m * k])
partition = []
ans = cur = 0
for (i, a) in enumerate(A, 1):
	if C[a]:
		C[a] -= 1
		cur = (1 + cur) % m
		ans += a
		if not cur:
			partition.append(i)
partition.pop()
print(ans)
print(' '.join((str(x) for x in partition)))


import io, os, math
rr = lambda : input()
rri = lambda : int(input())
rrm = lambda : list(map(int, input().split()))
INF = float('inf')

def solve(N, M, K, arr):
	arr = [(v, i) for (i, v) in enumerate(arr)]
	arr = sorted(arr, reverse=True)
	ind = []
	total = 0
	for i in range(M * K):
		total += arr[i][0]
		ind.append(arr[i][1])
	ind.sort()
	division = []
	for i in range(K - 1):
		division.append(str(ind[(i + 1) * M - 1] + 1))
	print(total)
	print(' '.join(division))
(N, M, K) = rrm()
arr = rrm()
solve(N, M, K, arr)


import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5:
	from math import gcd
else:
	from fractions import gcd
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits

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

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

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

def round(x):
	return int((x * 2 + 1) // 2)

def fermat(x, y, MOD):
	return x * pow(y, MOD - 2, MOD) % MOD

def lcm(x, y):
	return x * y // gcd(x, y)

def lcm_list(nums):
	return reduce(lcm, nums, 1)

def gcd_list(nums):
	return reduce(gcd, nums, nums[0])

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST():
	return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7
(N, M, K) = MAP()
aN = LIST()
aN2 = [None] * N
for i in range(N):
	aN2[i] = [i, aN[i]]
aN2.sort(key=itemgetter(1), reverse=True)
aN2 = aN2[:M * K]
aN2.sort(key=itemgetter(0))
print(sum([aN2[i][1] for i in range(len(aN2))]))
ans = []
for i in range(M, len(aN2), M):
	ans.append(aN2[i][0])
print(*ans)


from sys import stdin

def compute():
	(n, m, k) = map(int, stdin.readline().split())
	a = list(map(int, stdin.readline().split()))
	i = sorted(enumerate(a), key=lambda p: (-p[1], p[0]))
	res = sum(map(lambda p: p[1], i[:m * k]))
	p = list(sorted(map(lambda p: p[0], i[:m * k])))[m:m * k:m]
	return (res, p)
(res, p) = compute()
print(res)
print(*p)


from sys import stdin
(n, m, k) = map(int, stdin.readline().strip().split())
s = list(map(int, stdin.readline().strip().split()))
s1 = s.copy()
s1.sort(reverse=True)
x = m * k
s1 = s1[0:x]
d = dict()
for i in s1:
	if i not in d:
		d[i] = 1
	else:
		d[i] += 1
x = 0
ans = []
y = 1
for i in range(n):
	if s[i] in d and d[s[i]] > 0:
		d[s[i]] -= 1
		x += 1
	if x == m:
		x = 0
		ans.append(i + 1)
		y += 1
	if y == k:
		break
print(sum(s1))
print(*ans)


(n, m, k) = [int(i) for i in input().strip().split()]
nums = [int(i) for i in input().strip().split()]
beauty_num = m * k
num_sort = sorted(nums, reverse=True)[:beauty_num]
num_dict = dict()
for i in num_sort:
	if i not in num_dict:
		num_dict[i] = 1
	else:
		num_dict[i] += 1
counter = 0
ans = []
for i in range(n):
	if nums[i] in num_dict and num_dict[nums[i]] > 0:
		counter += 1
		num_dict[nums[i]] -= 1
	if counter >= m:
		ans.append(i + 1)
		counter = 0
print(sum(num_sort))
print(' '.join((str(i) for i in ans[:-1])))


import os
import sys
from collections import deque
import pdb
import heapq
from heapq import *
from pprint import pprint
from bisect import *
from math import *
if os.getcwd() == 'C:\\Users\\User\\Desktop\\python\\Prog':
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def rI():
	return [int(i) for i in input().split()]
(n, m, k) = rI()
dat = rI()
tosort = dat.copy()
tosort.sort(reverse=True)
tosort = tosort[:k * m]
st = {}
for i in tosort:
	if i in st:
		st[i] += 1
	else:
		st[i] = 1
kmax = 0
out = []
sm = 0
for i in range(len(dat)):
	if dat[i] in st and st[dat[i]] > 0:
		sm += dat[i]
		kmax += 1
		st[dat[i]] -= 1
	if kmax == m:
		kmax = 0
		out.append(i + 1)
print(sm)
for i in range(len(out) - 1):
	print(out[i], end=' ')


def main():
	arr = input().split()
	n = int(arr[0])
	m = int(arr[1])
	k = int(arr[2])
	arr = input().split()
	store = []
	for x in range(n):
		arr[x] = int(arr[x])
		store.append(arr[x])
	store.sort()
	bound = store[-(m * k)]
	count = 0
	total = 0
	for x in range(-(m * k), 0):
		if store[x] == bound:
			count += 1
		total += int(store[x])
	print(total)
	total = 0
	subcount = 0
	outs = 0
	for x in range(n):
		if arr[x] > bound:
			subcount += 1
			total += int(arr[x])
		elif arr[x] == bound and count > 0:
			subcount += 1
			count -= 1
			total += int(arr[x])
		if subcount == m:
			subcount = 0
			outs += 1
			print(x + 1, end=' ')
		if outs == k - 1:
			break
main()


(n, m, k) = map(int, input().split())
l = [int(x) for x in input().split()]
ll = [(l[i], i) for i in range(n)]
ll.sort(key=lambda x: x[0], reverse=True)
(ans, idx) = (0, [])
for i in range(m * k):
	ans += ll[i][0]
	idx.append(ll[i][1])
idx.sort()
print(ans)
for i in range(k - 1):
	print(idx[(i + 1) * m - 1] + 1, end=' ')
print('')


input = __import__('sys').stdin.readline
print = __import__('sys').stdout.write
(n, m, k) = map(int, input().split())
tmp = list(map(int, input().split()))
r = sorted(tmp, reverse=True)[:m * k]
min_val = min(r)
print(str(sum(r)) + '\n')
d = {}
for i in r:
	if i not in d:
		d[i] = 1
	else:
		d[i] += 1
idx = []
k = 0
for i in range(n):
	if tmp[i] >= min_val:
		if d[tmp[i]] > 0:
			k += 1
			d[tmp[i]] -= 1
	if k == m:
		k = 0
		idx.append(i)
for i in idx[:-1]:
	print(str(i + 1) + ' ')


I = lambda : map(int, input().split())
(n, m, k) = I()
(x, y) = zip(*sorted(zip(I(), range(1, n + 1)))[-m * k:])
print(sum(x))
print(*sorted(y)[m - 1:-1:m])


(n, m, k) = map(int, input().split())
a = [int(s) for s in input().split()]
a_sorted = sorted(a, reverse=True)
min_take = a_sorted[m * k - 1]
needed_min = 0
for i in range(m * k - 1, -1, -1):
	if a_sorted[i] == min_take:
		needed_min += 1
su = 0
for i in range(m * k):
	su += a_sorted[i]
part = []
takes = 0
for i in range(n):
	if a[i] > min_take:
		takes += 1
	elif a[i] == min_take:
		if needed_min > 0:
			takes += 1
			needed_min -= 1
	if takes >= m:
		part.append(i + 1)
		takes = 0
	if len(part) == k - 1:
		break
print(su)
print(*part, sep=' ')


(n, m, k) = map(int, input().split())
arr = list(map(int, input().split()))
arr2 = [x for x in arr]
arr2.sort()
indices = []
high = arr2[-k * m:][0]
highcount = arr2[-k * m:].count(high)
temp = m
count = 1
total = 0
for i in range(n):
	if arr[i] > high or (arr[i] == high and highcount > 0):
		total += arr[i]
		temp -= 1
		if arr[i] == high:
			highcount -= 1
	if temp == 0 and count < k:
		indices.append(i + 1)
		temp = m
		count += 1
print(total)
for x in indices:
	print(x, end=' ')
print()


(n, m, k) = map(int, input().split())
A = list(map(int, input().split()))
B = list(enumerate(A))
B.sort(key=lambda x: x[1])
B.reverse()
LIST = [0] * n
ANS = 0
for i in range(m * k):
	LIST[B[i][0]] = 1
	ANS += B[i][1]
ANSLIST = []
count = 0
for i in range(n):
	if LIST[i] == 1:
		count += 1
	if count == m:
		ANSLIST.append(i + 1)
		count = 0
print(ANS)
for a in ANSLIST[:-1]:
	print(a, end=' ')


def solve(n, m, k, arr):
	newArr = []
	for i in range(n):
		newArr.append((arr[i], i))
	newArr.sort(key=lambda x: x[0], reverse=True)
	mk = m * k
	largeNums = {}
	for i in range(mk):
		largeNums[newArr[i]] = 1
	ans = 0
	ansArr = []
	seg = 0
	numInSeg = 0
	maxNums = 0
	tempArr = []
	i = 0
	while i < n:
		if seg < k - 1:
			if numInSeg >= m and maxNums >= m:
				seg += 1
				maxNums = 0
				numInSeg = 0
				ans += sum((val for (val, ind) in tempArr))
				ansArr.append(tempArr[-1][1] + 1)
				tempArr.clear()
				i -= 1
			else:
				x = (arr[i], i)
				if x in largeNums:
					maxNums += 1
					tempArr.append(x)
					mk -= 1
				numInSeg += 1
		else:
			tempArr.append(arr[i])
		i += 1
	tempArr.sort(reverse=True)
	ans += sum(tempArr[:mk])
	print(ans)
	for j in ansArr:
		print(j, end=' ')

def main():
	(n, m, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	solve(n, m, k, arr)
main()


def main():
	(n, m, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	max_nums = {}
	arr1 = arr[:]
	arr1.sort(reverse=True)
	total = 0
	for i in range(m * k):
		if arr1[i] not in max_nums.keys():
			max_nums[arr1[i]] = 1
		else:
			max_nums[arr1[i]] += 1
		total += arr1[i]
	count = 0
	ans = []
	for i in range(n):
		if arr[i] in max_nums.keys():
			max_nums[arr[i]] -= 1
			if max_nums[arr[i]] == 0:
				del max_nums[arr[i]]
			count += 1
		if count > m:
			ans.append(i)
			count = 1
		if len(ans) == k - 1:
			break
	print(total)
	for i in ans:
		print(i, end=' ')
main()


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
b = [[a[i], i] for i in range(n)]
b.sort(reverse=True)
c = []
ans = 0
for i in range(m * k):
	ans += b[i][0]
	c.append(b[i][1])
c.sort()
print(ans)
for i in range(k - 1):
	print(c[(i + 1) * m - 1] + 1, end=' ')
print()


import sys
from collections import Counter
(n, m, k) = map(int, input().split())
a = list(map(int, sys.stdin.readline().split()))
if m * k == n:
	v = 0
	dp = []
	q = sum(a)
	while v + m < n:
		v = v + m
		dp.append(v)
	print(q)
	print(' '.join(map(str, dp)))
else:
	b = a[:]
	b.sort(reverse=True)
	q = sum(b[:m * k])
	v = b[m * k:]
	d = Counter(v)
	p = 0
	r = 0
	dp = [0]
	for j in range(n):
		if a[j] not in d:
			if p < m:
				p = p + 1
				r = r + 1
			else:
				dp.append(dp[-1] + r)
				p = 1
				r = 1
		else:
			r = r + 1
			if d[a[j]] == 1:
				del d[a[j]]
			else:
				d[a[j]] -= 1
	print(q)
	del dp[0]
	if dp[-1] == n:
		del dp[-1]
	print(' '.join(map(str, dp)))


(n, m, k) = list(map(int, input().split()))
arr = list(map(int, input().split()))
brr = []
for i in arr:
	brr.append(i)
arr.sort(reverse=True)
suma = 0
dic = {}
for i in arr:
	dic[i] = 0
for i in range(m * k):
	suma += arr[i]
	dic[arr[i]] += 1
ans = []
count = 0
counta = 0
for i in range(len(arr)):
	if count >= k - 1:
		break
	if dic[brr[i]] > 0:
		dic[brr[i]] -= 1
		counta += 1
	if counta == m:
		ans.append(i + 1)
		count += 1
		counta = 0
print(suma)
print(*ans)


import sys
import bisect
input = lambda : sys.stdin.readline().strip('\r\n')
from math import log
sa = lambda : input()
sb = lambda : int(input())
sc = lambda : input().split()
sd = lambda : list(map(int, input().split()))
se = lambda : float(input())
sf = lambda : list(input())
flsh = lambda : sys.stdout.flush()
mod = 10 ** 9 + 7

def hnbhai():
	(n, m, k) = sd()
	a = sd()
	ans = []
	for i in range(n):
		ans.append([a[i], i + 1])
	ans.sort(reverse=True)
	query = ans[:m * k]
	query.sort(key=lambda k: k[1])
	total = 0
	for i in query:
		total += i[0]
	print(total)
	for i in range(m * k - 1):
		if (i + 1) % m == 0:
			print(query[i][1], end=' ')
for _ in range(1):
	hnbhai()


import heapq
(n, subSize, nSub) = map(int, input().split())
a = list(map(int, input().split()))
pq = []
for (i, v) in enumerate(a):
	heapq.heappush(pq, (-v, i))
ret = []
total = 0
for i in range(subSize * nSub):
	(val, idx) = heapq.heappop(pq)
	total -= val
	ret.append(idx + 1)
ret.sort()
print(total)
for i in range(subSize, nSub * subSize, subSize):
	print(ret[i] - 1, end=' ')


(n, m, k) = map(int, input().split())
ls = list(map(int, input().split()))
new = sorted(range(len(ls)), key=ls.__getitem__, reverse=True)
print(sum((ls[item] for item in new[:m * k])))
idx = sorted(new[:m * k])
for i in range(1, k):
	print(idx[i * m - 1] + 1, end=' ')
print()


(n, m, k) = map(int, input().split())
a = map(int, input().split())
lengthMemory = []
for (index, elem) in enumerate(a):
	lengthMemory.append((elem, index))
lengthMemory.sort(reverse=True)
beauty = sum(map(lambda x: x[0], lengthMemory[:m * k]))
print(beauty)
indexGroup = []
for elem in lengthMemory[:m * k]:
	indexGroup.append(elem[1])
indexGroup.sort()
ans = []
for index in range(m - 1, len(indexGroup), m):
	ans.append(str(indexGroup[index] + 1))
print(' '.join(ans[:-1]))


r = [int(x) for x in input().split()]
n = r[0]
m = r[1]
k = r[2]
a = [int(x) for x in input().split()]
arr = []
for i in range(n):
	arr.append([a[i], i])
arr.sort()
arr.reverse()
brr = []
sum = 0
for i in range(m * k):
	brr.append([arr[i][1], arr[i][0]])
	sum += arr[i][0]
brr.sort()
print(sum)
for i in range(m - 1, len(brr) - 1, +m):
	print(brr[i][0] + 1, end=' ')