Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

import itertools
import heapq
import sys
import functools
import operator
import numpy as np
input = sys.stdin.readline
#-------------
n,k = map(int,input().split())
a = list(map(int,input().split()))
#-------------
a.sort()
D = [[a[i+j-k] for j in range(k)] for i in range(len(a))]
A = (functools.reduce(operator.mul,D[_]) for _ in range(len(D)))
l_max = max(A)
waru = 10**9 + 7
print(l_max % waru)

### FIXED CODE ###

import sys
 
n, k = map(int, input().split())
a = [int(x) for x in input().split()]
mod = pow(10, 9)+7
zero = 0
plus = []
minus = []
for i in range(n):
  if a[i] == 0:
    zero += 1
  elif a[i] > 0:
    plus.append(a[i])
  else:
    minus.append(a[i])
 
P, M = len(plus), len(minus)
plus.sort(reverse=True)
minus.sort()
ans = 1
if n == k:
  for i in range(n):
    ans *= a[i]
    ans %= mod
elif P+M < k:
  ans = 0
elif P == 0:
  if zero and k%2:
    ans = 0
  else:
    if k%2:
      minus.reverse()
    for i in range(k):
      ans *= minus[i]
      ans %= mod
else:
  q = 0
  if k%2:
    ans *= plus[0]
    ans %= mod
    q = 1
  judge = []
  for i in range((len(plus)-q)//2):
    judge.append(plus[2*i+q]*plus[2*i+q+1])
  for i in range(len(minus)//2):
    judge.append(minus[2*i]*minus[2*i+1])
  judge.sort(reverse=True)
  for i in range(k//2):
    ans *= (judge[i]%mod)
    ans %= mod
 
print(ans)
### BUGGY CODE ###

N = int(input())
Nlist = list(map(int, input().split()))
total = 1

for i in range(N):
    total = total*Nlist[i]

if total > 1000000000000000000:
        total = -1
print(total)


### FIXED CODE ###

import sys
N = int(input())
Nlist = list(map(int, input().split()))
total = 1

if Nlist.count(0)>=1:
    total = 0
    print(total)
    sys.exit()


for i in range(N):
    total = total*Nlist[i]
    if total > 1000000000000000000:
        total = -1
        break

print(total)
### BUGGY CODE ###

n=int(input())
edge=[[]for i in range(n+1)]
for i in range(1,n+1):
    s=list(input())
    for j in range(i,n+1):
        if s[j-1]=="1":
            edge[i].append(j)
            edge[j].append(i)



ans=0
for i in range(1,n+1):
    bubun=[[] for iii in range(n+1)]
    bubun[0].append(i)
    check=0
    for j in range(n):
        for k in bubun[j]:
            for y in edge[k]:
                if y in bubun[j-1]:
                    continue
                elif y in bubun[j]:
                    break
                else:
                    bubun[j+1].append(y)
            else:
                continue
            break
        else:
            continue
        break
    else:
        for ii in bubun:
            if ii:
                check+=1
        ans=max(ans,check)
if ans==0:
    print(-1)
else:
    print(ans)
        

### FIXED CODE ###

n=int(input())
edge=[[]for i in range(n+1)]
for i in range(1,n+1):
    s=list(input())
    for j in range(i,n+1):
        if s[j-1]=="1":
            edge[i].append(j)
            edge[j].append(i)



ans=0
for i in range(1,n+1):
    bubun=[[] for iii in range(n+1)]
    bubun[0].append(i)
    check=0
    for j in range(n):
        for k in bubun[j]:
            for y in edge[k]:
                if y in bubun[j-1]:
                    continue
                elif y in bubun[j]:
                    break
                elif y in bubun[j+1]:
                    continue
                else:
                    bubun[j+1].append(y)
            else:
                continue
            break
        else:
            continue
        break
    else:
        for ii in bubun:
            if ii:
                check+=1
        ans=max(ans,check)
if ans==0:
    print(-1)
else:
    print(ans)
### BUGGY CODE ###

from collections import defaultdict

d, g = map(int, input().split())
dp = defaultdict(lambda: float('inf'))
dp[0] = 0
for i in range(d):
    p, c = map(int, input().split())
    solo_score = (i + 1) * 100
    ndp = dp.copy()
    for s, q in dp.items():
        if s == g:
            continue
        for j in range(1, p):
            k = min(g, s + solo_score * j)
            ndp[k] = min(ndp[k], q + j)
        k = min(g, s + solo_score * p + c)
        ndp[k] = min(ndp[k], q + p)
    dp = ndp
print(dp[g])


### FIXED CODE ###

import bisect
from operator import itemgetter

d, g = map(int, input().split())
g //= 100
problem_quantities = []
complete_scores = []
for i in range(1, d + 1):
    p, c = map(int, input().split())
    c //= 100
    problem_quantities.append(p)
    complete_scores.append(i * p + c)

curr_idx = d
curr_bit = 0
curr_cmp, curr_qtt = 0, 0
complete_combinations = [None] * (1 << d)
complete_combinations[0] = (0, 0, 0)
for use in range(1, 1 << d):
    if use & curr_bit == 0:
        curr_idx -= 1
        curr_bit = use
        curr_cmp = complete_scores[curr_idx]
        curr_qtt = problem_quantities[curr_idx]
    ps, pq, _ = complete_combinations[use ^ curr_bit]
    complete_combinations[use] = (ps + curr_cmp, pq + curr_qtt, use)

complete_combinations.sort()

bi = bisect.bisect(complete_combinations, (g,))

ans = float('inf')
for s, p, use in complete_combinations[:bi]:
    i = d
    while use & 1:
        i -= 1
        use >>= 1
    cmp = complete_scores[i - 1]
    remain = g - s
    if remain >= cmp:
        continue
    q = min(problem_quantities[i - 1], (remain - 1) // i + 1)
    ans = min(ans, p + q)

ans = min(ans, min(map(itemgetter(1), complete_combinations[bi:])))
print(ans)
### BUGGY CODE ###

import sys

line = sys.stdin.readline()
x, y = line.split(" ")

x = int(x)
y = int(y)

divide = 1

if x > y:
    x, y = y, x

while(x > 1):
    for i in range(2, x + 1):
        if x % i == 0 and y % i == 0:
            divide = divide * i
            x = x / i
            y = y / i
            break

print divide

### FIXED CODE ###

import sys

def div(x, y):
    if x % y == 0:
        print y
    else:
        div(y, x%y)


line = sys.stdin.readline()
x, y = line.split(" ")

x = int(x)
y = int(y)

if x < y:
    x, y = y, x

if x == y:
    print x

else:
    div(x, y)
### BUGGY CODE ###

s=input()
ans = 0
dp = [[0 for i in range(len(s)+3)]for j in range(len(s)+3)]
def rec(i,j,num):#j:numの左から何個けずった？ i:sの左から何番目までいった？
    global ans
    if dp[i][j] == 1:
        return
    dp[i][j] = 1
    if int(num) % 2019 == 0:
        ans += 1
    else:
        if j < len(s):
            rec(i,j+1,num+s[j])
        if len(num) >= 2:
            rec(i+1,j,num[1::])

rec(0,1,s[0])
print(ans)


### FIXED CODE ###

from collections import Counter
s = str(input())

si = [0] * (len(s)+1) #mod2019の累積和用に
tmp = 0
for i in range(1,len(s)+1): #累積和の作成
    tmp += int(s[len(s)-i])%2019 * pow(10,i-1,2019)
    si[i] = tmp % 2019

c = Counter(si)
ans = 0
for b in list(c.values()):#aがb回出てきたよ
    ans += b*(b-1)//2

print(ans)
### BUGGY CODE ###

input()
ans = 1

for a in map(int, input().split()):
    ans *= a

print(ans if ans <= 10**18 else -1)

### FIXED CODE ###

import sys
input()
A = list(map(int, input().split()))
ans = 1

if 0 in A:
    print(0)
    sys.exit()

else:
    for a in A:
        ans *= a
        if ans > 10**18:
            print(-1)
            sys.exit()
    print(ans)
### BUGGY CODE ###

n, k = map(int, input().split())
p = list(map(int, input().split()))

#連続するK個の要素の和で一番大きいもの
start = -1
maximum = -1
for i in range(len(p) - k + 1):
  temp = sum(p[i:i + k])
  if temp > maximum:
    maximum = temp
    start = i

#期待値の算出
exp = 0
for i in range(start, start + k):
  temp = 0
  for j in range(1, p[i] + 1):
    temp += j
  exp += temp / p[i]

print(exp)



### FIXED CODE ###

n, k = map(int, input().split())
p = list(map(int, input().split()))

#累積和を出す
t = [0] * (len(p) + 1)
for i in range(len(p)):
  t[i + 1] = t[i] + p[i]

#連続するK個の和で、最大の値を取得する。
maximum = -1
start = -1

for i in range(len(p) - k + 1):
  temp = t[i + k] - t[i]
  if temp > maximum:
    maximum = temp
    start = i

#期待値
exp = 0
for i in range(start, start + k):
  temp = 1 / 2 * p[i] * (p[i] + 1)
  exp += temp / p[i]

print(exp)
### BUGGY CODE ###

from fractions import gcd
from sys import exit

N = int(input())
A = list(map(int, input().split()))

l_gcd_list = [0]
r_gcd_list = [0]
for i in range(N):
    l_gcd_list.append(gcd(l_gcd_list[i], A[i]))
    r_gcd_list.insert(0, gcd(r_gcd_list[0], A[-(i+1)]))
# print(l_gcd_list)
# print(r_gcd_list)

results = []
for i in range(N):
    results.append(gcd(l_gcd_list[i], r_gcd_list[i+1]))

print(max(results))


### FIXED CODE ###

from fractions import gcd
from sys import exit

N = int(input())
A = list(map(int, input().split()))

l_gcd_list = [0]
r_gcd_list = [0]
for i in range(N):
    l_gcd_list.append(gcd(l_gcd_list[i], A[i]))
    r_gcd_list.append(gcd(r_gcd_list[i], A[-(i+1)]))
r_gcd_list = r_gcd_list[::-1]
# print(l_gcd_list)
# print(r_gcd_list)

results = []
for i in range(N):
    results.append(gcd(l_gcd_list[i], r_gcd_list[i+1]))

print(max(results))
### BUGGY CODE ###

n = input()
R = []
for i in range(n):
    R.append(input())

profit = R[1] - R[0]
for i in range(n):
    for j in range(i+1, n):
        if R[j] - R[i] > profit:
            profit = R[j] - R[i]
print "%d" % profit

### FIXED CODE ###

n = input()
R = []
for i in range(n):
    R.append(input())

maxv = R[1] - R[0]
minv = R[0]
for j in range(1, n):
    maxv = max(maxv, R[j] - minv)
    minv = min(minv, R[j])

print "%d" % maxv
### BUGGY CODE ###

l,r=map(int,input().split())
ans=int(10000000)
if r-l>2019:
    ans=0

for i in range(l,r):
    for j in range(i+1,r+1):
        now=int((i*j)%2019)
        if ans>now:
            ans=now

print(ans)

### FIXED CODE ###

l,r=map(int,input().split())
ans=int(10000000)
if r-l>2019:
    print(0)
    exit()

for i in range(l,r):
    for j in range(i+1,r+1):
        now=int((i*j)%2019)
        if ans>now:
            ans=now

print(ans)
### BUGGY CODE ###

import collections


def friend_candidates(i, friends, visited=None):
    visited = set([i])
    stack = list(friends[i])

    while stack:
        v = stack.pop()
        if v in visited:
            continue

        stack.extend(friends[v])
        visited.add(v)

    return visited


N, M, K = map(int, input().split())

friends = collections.defaultdict(set)
for _ in range(M):
    A, B = map(int, input().split())
    friends[A].add(B)
    friends[B].add(A)

blockings = collections.defaultdict(set)
for _ in range(K):
    C, D = map(int, input().split())
    blockings[C].add(D)
    blockings[D].add(C)


table = {}
for i in range(1, N + 1):
    if i in table:
        continue

    candidates = friend_candidates(i, friends)
    for j in candidates:
        table[j] = candidates

print(
    " ".join(
        str(len(table[i] - friends[i] - blockings[i]) - 1) for i in range(1, N + 1)
    )
)


### FIXED CODE ###

def dfs(graph, start):
    visited = set()
    stack = [start]

    while stack:
        v = stack.pop()
        if v not in visited:
            stack.extend(graph[v])
            visited.add(v)
            yield v


def read_graph(nodes, edges):
    graph = [[] for _ in range(nodes)]
    for _ in range(edges):
        a, b = (int(x) - 1 for x in input().split())
        graph[a].append(b)
        graph[b].append(a)

    return graph


def count_candidates(n, counts, groups, block, friend):
    for i in range(n):
        count = counts[groups[i]]
        for v in block[i]:
            if groups[i] == groups[v]:
                count -= 1

        count -= len(friend[i])
        count -= 1
        yield count


def main():
    n, m, k = map(int, input().split())
    friend = read_graph(n, m)
    block = read_graph(n, k)

    groups = [-1 for _ in range(n)]
    counts = []
    i = 0
    group_id = 0
    while i < n:
        if groups[i] != -1:
            i += 1
            continue

        for j, v in enumerate(dfs(friend, i)):
            groups[v] = group_id

        counts.append(j + 1)
        group_id += 1

    print(" ".join(str(i) for i in count_candidates(n, counts, groups, block, friend)))


if __name__ == "__main__":
    main()
### BUGGY CODE ###

import itertools
from operator import mul
from functools import reduce
def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom
N = int(input())
S = [int(s) for s in input()]
num = {s:[] for s in S}
for i, s in enumerate(S):
    num[s].append(i)
ans = combinations_count(N, 3)
#print(ans)
check = []
for i in list(num.keys()):
    for j in list(num.keys()):
        for k in list(num.keys()):
            s = str(i) + str(j) + str(k)
            if s not in check and (len(num[i]) > 1 or len(num[j]) > 1 or len(num[k]) > 1):
                temp = 0
                check.append(s)
                for a in num[i]:
                    for b in num[j]:
                        for c in num[k]:
                            if a < b < c:
                                temp += 1
                #print(i, j, k, temp)
                if temp > 0:
                    ans -= (temp-1)
print(ans)

### FIXED CODE ###

N = int(input())
S = input()
ans = 0
for i in range(1000):
    v = str(i).zfill(3)
    idx = 0
    c = 0
    idx_now = 0
    for j in range(3):
        idx = S[idx_now:].find(v[j])
        if idx == -1:
            break
        else:
            idx_now += idx + 1
            c += 1
    if c == 3:
        ans += 1
print(ans)
### BUGGY CODE ###

nag = int(input())
kaz = list(map(int,input().split(" ")))
cou = 0
for i in range(nag):
    kar = 0
    for j in range(nag - i):
       kar += kaz[i + j]
       if kar == 0:
           cou += 1

print(cou)

### FIXED CODE ###

from itertools import accumulate
import collections
n = int(input())
A = [0]
A.extend(list(map(int,input().split())))
p = list(accumulate(A))
c = collections.Counter(p)
ans = 0
for k,v in c.items():
    ans += v*(v-1)//2
print(ans)
### BUGGY CODE ###

import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

def wa(d):
    for k in range(len(d)):
        for i in range(len(d)):
            for j in range(len(d)):
                d[i][j] = min(d[i][j],d[i][k]+d[k][j])
    return d

def on():
    N,M,L = m()

    e = [[Max for i in range(N)]for j in range(N)]

    for i in range(M):
        a,b,c = m()
        e[a-1][b-1] = c
        e[b-1][a-1] = c

    for i in range(N):
        e[i][i] = 0

    d = wa(e)


    E = [[Max for i in range(N)]for j in range(N)]

    for i in range(N):
        for j in range(N):
            if d[i][j] <= L:
                E[i][j] = 1

    for i in range(N):
        E[i][i] = 0

    E = wa(E)
    q = onem()
    for i in range(q):
        s,t = m()
        if E[s-1][t-1] == Max:
            print(-1)
        else:
            print(E[s-1][t-1]-1)

if __name__ == "__main__":
    on()




### FIXED CODE ###

import sys,collections as cl,bisect as bs
Max = 10**18
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())

def wa(d):
    for k in range(len(d)):
        for i in range(len(d)):
            for j in range(len(d)):
                d[i][j] = min(d[i][j],d[i][k]+d[k][j])
    return d

def on():
    N,M,L = m()

    e = [[Max for i in range(N)]for j in range(N)]

    for i in range(M):
        a,b,c = m()
        e[a-1][b-1] = c
        e[b-1][a-1] = c

    for i in range(N):
        e[i][i] = 0

    d = wa(e)


    E = [[Max for i in range(N)]for j in range(N)]

    for i in range(N):
        for j in range(N):
            if d[i][j] <= L:
                E[i][j] = 1

    for i in range(N):
        E[i][i] = 0

    E = wa(E)
    q = onem()
    for i in range(q):
        s,t = m()
        if E[s-1][t-1] == Max:
            print(-1)
        else:
            print(E[s-1][t-1]-1)

if __name__ == "__main__":
    on()
### BUGGY CODE ###

while(1):
    z=int(raw_input())
    if z==0:
        break
    else:
        k=0
        for x in range(1,z+1):
            for y in range(1,z+1):
                if x**3+y**3>z**3:
                    break
                k=max(k,x**3+y**3)
        print z**3-k

### FIXED CODE ###

import math

while(1):
    z=int(raw_input())
    if z==0:
        break
    else:
        k=0
        for x in range(1,z):
            y=int(pow(z**3-x**3,1/3.))
            k=max(k,x**3+y**3)
        print z**3-k
### BUGGY CODE ###

mods = [0]*2019
mods[0] = 1
s = input()
dp = [0]*(len(s)+1)
u = 1
for i in range(1,len(s)+1):
    k = len(s) - i
    dp[i] = (dp[i-1] + int(s[k])*u)%2019
    u *= 10
    mods[dp[i]] += 1


cnt = 0
for x in mods:
    if x >= 2:
        cnt += x*(x-1)//2
print(cnt)

### FIXED CODE ###

mods = [0]*2019
mods[0] = 1
s = input()
t = 0
u = 1
for i in range(1,len(s)+1):
    t = (t + int(s[-i])*u)%2019
    u = u*10%2019
    mods[t] += 1


cnt = 0
for x in mods:
    if x >= 2:
        cnt += x*(x-1)/2
print(int(cnt))
### BUGGY CODE ###

import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n,k = na()
h = na()

A = [0]+[float("inf")]*(n-1)

for i in range(1,n):
  for j in range(max(0, i-k), i):
    A[i] = min(A[i],A[j]+abs(h[i]-h[j]))

print(A[-1])

### FIXED CODE ###

import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n,k = na()
h = na()

A = [0]+[float("inf")]*(n-1)

for i in range(1,n):
  for j in range(max(0, i-k), i):
    A[i] = min(A[i],A[j]+abs(h[i]-h[j]))

print(A[-1])
### BUGGY CODE ###

N,W=map(int,input().split())
weights,profits = [0]*N, [0]*N
def solve_knapsack(profits, weights, capacity):
    # basic checks
    n = len(profits)
 
    dp = [[0 for x in range(capacity+1)] for y in range(n)]
    # populate the capacity = 0 columns, with '0' capacity we have '0' profit
    for i in range(0, n):
        dp[i][0] = 0
    for c in range(0, capacity+1):
        if weights[0] <= c: dp[0][c] = profits[0]
    for i in range(1, n):
        for c in range(1, capacity+1):
            if weights[i] <= c:
                dp[i][c] = max(profits[i] + dp[i - 1][c - weights[i]], dp[i - 1][c])
            else: dp[i][c]  = dp[i - 1][c]
 
    # maximum profit will be at the bottom-right corner.
    return dp[n - 1][capacity]
  
def main():
 
    for i in range(N):
        weights[i],profits[i] = map(int,input().split())
    res = solve_knapsack(profits, weights, W)
 
    print(res)
if __name__ == "__main__":
	main()

### FIXED CODE ###

def main():
  n, w = [int(e) for e in input().split()]
  t = [-1 for i in range(w + 1)]
  t[w] = 0
  for _ in range(n):
    nw, nv = [int(e) for e in input().split()]
    for i in range(nw, w + 1):
      if t[i] == -1:
        continue
      if t[i - nw] < t[i] + nv:
        t[i - nw] = t[i] + nv
  print(max(t))
main()
### BUGGY CODE ###

n=int(input())
x=list(map(int,input().split()))
m=n//2 - 1
for i in range(n):
  a=sorted(x[:i]+x[i+1:])
  print(a[m])

### FIXED CODE ###

n=int(input())
x=list(map(int,input().split()))
arr=sorted(x)[n//2-1:n//2+1]
for i in range(n):
  if x[i]<=arr[0]:
    print(arr[1])
  elif x[i]>=arr[1]:
    print(arr[0])
### BUGGY CODE ###

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

prefecture=[[] for j in range(n)]
for i in range(m):
    prefecture[p[i]-1].append(y[i])

for j in range(n):
    prefecture[j].sort()

# for j in range(n):
#     city=[] # number
#     for i in range(m):
#         if(p[i]==j+1):
#             city.append(y[i])
#     city.sort()
#     prefecture.append(city)

for i in range(m):
    print('{0:06d}{1:06d}'.format(p[i],prefecture[p[i]-1].index(y[i])+1))

### FIXED CODE ###

n,m=map(int, input().split())
prefecture=[]
for i in range(m):
    pk,yk=map(int, input().split())
    prefecture.append([pk,yk,i])

prefecture.sort(key=lambda x:(x[0],x[1])) # x[0]:pで整理したうえでx[1]:yで整理
p_num=prefecture[0][0]
city_num=1
for i in range(m):
    if(prefecture[i][0]!=p_num):
        p_num=prefecture[i][0]
        city_num=1

    prefecture[i].append(city_num)
    city_num+=1

prefecture.sort(key=lambda x:x[2])

for i in range(m):
    print('{0:06d}{1:06d}'.format(prefecture[i][0], prefecture[i][3]))
### BUGGY CODE ###

from collections import deque
N, M = map(int, input().split())
ab_list = [ list(map(int, input().split())) for i in range(N)]

score_list = [[] for i in range(M+1)]


for ab in ab_list:
    if ab[0] <= M:
        score_list[ab[0]].append(ab[1])

ans = 0
for i in range(0, M+1):
    if len(score_list[i]) == 0:
        continue
    score_list[i].sort(reverse=True)
    ans += score_list[i].pop(0)
    if i < M and len(score_list[i]) > 0:
        score_list[i+1].extend(score_list[i])

print(ans)

### FIXED CODE ###

import heapq


N, M = map(int, input().split())
ab_list = [ list(map(int, input().split())) for i in range(N)]

score_list = [[] for i in range(M+1)]


for ab in ab_list:
    if ab[0] <= M:
        score_list[ab[0]].append(ab[1])


ans = 0
candidates = []

for i in range(0, M+1):

    for s in score_list[i]:
        heapq.heappush(candidates, -s)
    if len(candidates) == 0:
        continue
    ans -= heapq.heappop(candidates)


print(ans)
### BUGGY CODE ###

while 1:
    m=input()
    if m==0:break
    st=[map(int,raw_input().split()) for _ in xrange(m)]
    n=input()
    pi=[map(int,raw_input().split()) for _ in xrange(n)]
    d=[[] for _ in xrange(m)]
    for i in xrange(m):
        for j in xrange(m):
            if i==j:continue
            d[i].append([st[j][0]-st[i][0],st[j][1]-st[i][1]])
    f=0
    for i in xrange(n):
        if f==1:break
        mo=[]
        f=0
        for j in xrange(n):
            mo.append([pi[j][0]-pi[i][0],pi[j][1]-pi[i][1]])
        for k in xrange(m):
            cnt=0
            for l in d[k]:
                if not l in mo:continue
                else:cnt+=1
                if cnt==len(d[k]):
                    print pi[i][0]-st[k][0],pi[i][1]-st[k][1]
                    f=1
                    break
            if f==1:break

### FIXED CODE ###

while 1:
    m=int(raw_input())
    if m==0:break
    st=[map(int,raw_input().split()) for _ in xrange(m)]
    n=int(raw_input())
    pi=[map(int,raw_input().split()) for _ in xrange(n)]
    d=[[st[i][0]-st[0][0],st[i][1]-st[0][1]] for i in xrange(1,m)]
    for i in xrange(n):
        mo=[[pi[j][0]-pi[i][0],pi[j][1]-pi[i][1]] for j in xrange(n)]
        cnt=0
        cnt1=0
        for k in xrange(m-1):
            if not d[k] in mo:break
            else:cnt+=1
        if cnt==m-1:
            print pi[i][0]-st[0][0],pi[i][1]-st[0][1]
            break
### BUGGY CODE ###

import itertools

N = int(input())
S = input()
D = 10**9+7

d = {}
for i,n in enumerate(S):
    if n in d.keys():
        d[n] += 1
    else:
        d[n] = 1

count = 0
for i in range(1,len(d.keys())+1):
    for p in list(itertools.combinations(d.keys(),i)):
        tmp = 1
        for c in p:
            tmp *= d[c]
        count += tmp
        count %= D
print(count)

### FIXED CODE ###

N = int(input())
S = input()
D = 10**9+7

d = {}
for i,n in enumerate(S):
    if n in d.keys():
        d[n] += 1
    else:
        d[n] = 1

ans = 1
for i in d.values():
    ans *= i+1
print((ans-1)%D)
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))

for i in range(1, N+1):
    print(A.index(i)+1)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))

result = [0] * (N+1)
for i in range(0, N):
    result[A[i]-1] = i+1

for i in range(N):
    print(result[i])