Harryxun/stf_run huggingface dataset:
S = list(input())
T = list(input())

change = []
flag = 0
get = 0

for i in range(len(S)):
  if S[0] == T[i]:
    get = 1
    for j in range(len(S) - i):
      change.append(T[j+i])
    for k in range(i):
      change.append(T[k])
      
if get == 1:
	for check in range(len(S)):
  		if S[check] != change[check]:
    		flag = 1

if flag == 1:
  print("No")
else:
  print("Yes")

### FIXED CODE ###

Spr = input()
T = list(input())
S = list(Spr)

change = ""
ok = 0

for i in range(len(S)):
  if S[0] == T[i]:
    for j in range(len(S) - i):
      change += T[j+i]
    for k in range(i):
      change += T[k]
    if Spr == change:
      if ok == 0:
      	print("Yes")
      	ok = 1
    change = ""

if i == len(S) - 1 and ok == 0:
  print("No")
N, M, R = map(int, input().split())
R_LIST = list(map(int, input().split()))
ABC = []
for _ in range(M):
    a,b,c = map(int, input().split())
    ABC.append((a,b,c))
   
edges = ABC[:]


def warshall_floyd(d, n):
    # d: グラフ二次元リスト
    # n: 頂点数 (0始まり)
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d

# グラフ無効グラフ化
graph = [[float("inf") for i in range(N+1)] for i in range(N+1)] 
for x,y,z in edges:
    graph[x][y] = z
    graph[y][x] = z
for i in range(N+1):
    graph[i][i] = 0 #自身のところに行くコストは０

#最短経路
shortest =  warshall_floyd(graph, N+1)
    
# 順列全探索
import sys
INT_MAX = sys.maxsize # 9223372036854775807
ans = INT_MAX

import queue

q = queue.Queue()
for t in travels:
    q.put((
        0,
        (t,)
    ))

travels = R_LIST[:]

while not q.empty():
    past = q.get()
    if len(past[1]) == len(travels):
        ans = min(ans, past[0])
    
    for t in travels:
        if not t in past[1]:
            cost = past[0]
            cost += shortest[past[1][-1]][t]
            if ans <= cost:
                continue
            next_past = past[1] + (t,)
            q.put((
                cost,
                next_past
            ))
print(ans)
      
        
        



### FIXED CODE ###

N, M, R = map(int, input().split())
R_LIST = list(map(int, input().split()))
ABC = []
for _ in range(M):
    a,b,c = map(int, input().split())
    ABC.append((a,b,c))
    
    
edges = ABC[:]


def warshall_floyd(d, n):
    # d: グラフ二次元リスト
    # n: 頂点数 (0始まり)
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d

# グラフ無効グラフ化
graph = [[float("inf") for i in range(N+1)] for i in range(N+1)] 
for x,y,z in edges:
    graph[x][y] = z
    graph[y][x] = z
for i in range(N+1):
    graph[i][i] = 0 #自身のところに行くコストは０

#最短経路
shortest =  warshall_floyd(graph, N+1)
    
# 順列全探索
import sys
INT_MAX = sys.maxsize # 9223372036854775807
ans = INT_MAX

import queue

rest = set(R_LIST[:])

import copy  
def dfs(cost,pre,rest):
    if len(rest) == 0:
        return cost
    
    ret = INT_MAX
    for r in rest:
        if pre == None:
            next_cost = 0
        else:
            next_cost = cost + shortest[pre][r]
        next_rest = copy.copy(rest)
        next_rest.remove(r)
        
        tmp_ret = dfs(next_cost, r, next_rest)
        ret = min(ret, tmp_ret)
        
    return ret
        
    

print(dfs(0, None, rest))
s,w=map(int.input().split());
if s<=w:
  print(unsafe);
else:
  print(safe);


### FIXED CODE ###

def issafe(S,W):
    if S > W:
        return "safe"
    return "unsafe"

S,W = map(int,input().split())
print(issafe(S,W))
a,b,k=map(int, input().split())
l=[]
for i in range(1,100):
    if a%i==0 and b%i==0:
        l.append(i)
if k==len(k):
    print(l[0])
else:
    print(l[-k])

### FIXED CODE ###

a,b,k=map(int, input().split())
l=[]
for i in range(1,101):
    if a%i==0 and b%i==0:
        l.append(i)
if k==len(l):
    print(l[0])
else:
    print(l[-k])
class edge:
    def __init__(self, u, v):
        self.u = u
        self.v = v
    def min(self):
        return min(self.u, self.v)
    def max(self):
        return max(self.u, self.v)

N = int(input())
 
edge_list = []
for i in range(N - 1):
    u, v = map(int, input().split())
    edge_list.append(edge(u - 1, v - 1))
 
ver_num = int(N * (N + 1) * (N + 2) / 6)
 
edge_num = 0
for e in edge_list:
    edge_num += (N + 1 - (e.max() + 1)) * (e.min() + 1)
    
print(ver_num - edge_num)

### FIXED CODE ###

# -*- coding: utf-8 -*-
N = int(input())
if N % 1000 == 0:
    print(0)
else:
    print(1000 - N % 1000)
N = int(input())
hh = list(map(int, input().split()))

prev = -999
for i in range(N):
  if pre <= hh[i]-1:
    pre = hh[i]-1
  elif pre <= hh[i]:
    pre = hh[i]
  else:
    print('No')
    exit(0)
print('Yes')
exit(0)


### FIXED CODE ###

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

prev = -999
for i in range(N):
  if prev <= hh[i]-1:
    prev = hh[i]-1
  elif prev <= hh[i]:
    prev = hh[i]
  else:
    print('No')
    exit(0)

print('Yes')
exit(0)
def resolve():
    t = input()
    l = len(t)
    que = []
    ans = [""]
    ma = [0]

    def dfs(s, idx):
        if idx == l:
            a = s.count("D") + s.count("PD")
            if ma[0] < a:
                ans[0] = s
                ma[0] = a
            return

        if t[idx] == "?":
            dfs(s + "P", idx + 1)
            dfs(s + "D", idx + 1)
        else:
            dfs(s + t[idx], idx + 1)

    dfs("", 0)
    print(ans[0])

resolve()

### FIXED CODE ###

def resolve():
    t = input()
    s = ""
    for c in t:
        if c == "?":
            c = "D"

        s += c
    print(s)

resolve()
a,b=map(int,input().split())
if a==1 and b==1:
    print(1)
    exit()
from collections import Counter
from operator import mul
from functools import reduce
def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct
mod=10**9+7
print(reduce(mul,map(lambda x:cmb(a-1+x,a-1),Counter(factorize(b)).values()))%mod)

### FIXED CODE ###

a,b=map(int,input().split())


from collections import Counter
from operator import mul
from functools import reduce
def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b += 1
    if n > 1:
        fct.append(n)
    return fct
if len(factorize(b))==0:
    print(1)
    exit()

mod=10**9+7
print(reduce(mul,map(lambda x:cmb(a-1+x,a-1),Counter(factorize(b)).values()))%mod)
print("ABC" if int(input)<1200 else "ARC")

### FIXED CODE ###

print("ABC" if int(input())<1200 else "ARC")
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
#出力の制限
#フェルマーの小定理なので、素数のみ使用
mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

x , y = map(int,input().split())
MOD = 10 ** 9 + 7
for s in range(max(x,y)):
    if 2 * x - 3 * s == y:
        flag = True
        break
t = x - 2 * s
if flag:
    print(cmb((t+s),s,mod))
else:
    print(0)

### FIXED CODE ###

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
#出力の制限
#フェルマーの小定理なので、素数のみ使用
mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
flag = False
x , y = map(int,input().split())
MOD = 10 ** 9 + 7
for s in range(max(x,y)):
    if 2 * x - 3 * s == y:
        flag = True
        break
t = x - 2 * s
if flag:
    print(cmb((t+s),s,mod))
else:
    print(0)
N=int(input())
S,T=input().split()

for i in range(N):
    print(f'{S[i]}{T[i]}',end='')


### FIXED CODE ###

# coding: utf-8
# Your code here!
N=int(input())
S,T=input().split()

for i in range(N):
    print('{}{}'.format(S[i],T[i]),end='')
l = map( int , raw_input().split())

s = l[0] * l[1]
r = ( l[0] + l[1] ) * 2

print s+' '+r

### FIXED CODE ###

l = map( int , raw_input().split())

s = l[0] * l[1]
r = ( l[0] + l[1] ) * 2

print s , r
n, m, q = [int(i) for i in input().split()]
A = [1] * n
abcd = []

canditates = []

ans = 0

for i in range(q):
    abcd.append([int(i) for i in input().split()])


def helper(_min, _max, cur, res):
    if res == 0:
        canditates.append(list(cur))
    else:
        for i in range(_min, _max):
            cur.append(i)
            helper(i, _max, cur, res - 1)
            cur.pop()


helper(1, m + 1, [], m)

for A in canditates:
    _temp = 0
    for a, b, c, d in abcd:
        if A[b - 1] - A[a - 1] == c:
            _temp += d
    ans = max(ans, _temp)

print(ans)


### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)
input = sys.stdin.buffer.readline

n, m, q = [int(i) for i in input().strip().split()]
abcd = []
canditates = []
ans = 0


for _ in range(q):
    abcd.append([int(i) for i in input().strip().split()])


def helper(_min, _max, cur, res):
    if res == 0:
        canditates.append(list(cur))
    else:
        for i in range(_min, _max):
            cur.append(i)
            helper(i, _max, cur, res - 1)
            cur.pop()


helper(1, m + 1, [], n)

for A in canditates:
    _temp = 0
    for a, b, c, d in abcd:
        if A[b - 1] - A[a - 1] == c:
            _temp += d

    ans = max(ans, _temp)

print(ans)
N,K = list(map(int,input().split()))

A = list(map(int,input().split()))
visited = [1]
visited_list = [0]*N
visited_list[0] = 1
k = 0
l = 0
kaburi = 1
def f(Ai):
    global k,l,visited,kaburi
    # print("Ai",Ai,k)
    if k == K:
        print(A[Ai])
    elif visited_list[Ai-1] == 1 :
        kaburi = Ai
        k += 1
        l = k
    else:
        visited.append(Ai)
        visited_list[Ai-1] = 1
        k += 1
        f(A[Ai-1])

f(A[0])
hazime = visited.index(kaburi)
b = visited[hazime:]
# print(b)
# print(l)
print(b[(K-hazime)%(l-hazime)])

### FIXED CODE ###

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

A = [0]+ list(map(int,input().split()))

n = 1
visited = [1]
visitedbit = [0] * (N+1) 
visitedbit[1] = 1
k = 0
flag = True
while True:
    
    k += 1
    #A[n]はテレポート先
    if k == K:
        print(A[n])
        flag = False
        break
    if visitedbit[A[n]]  == 0:
        visited.append(A[n])
        visitedbit[A[n]] = 1
        n = A[n]
    else:
        hazime = visited.index(A[n])
        break

if flag == True:
    # print(visited)
    loop = visited[hazime:]
    # print(loop)
    # print(hazime)
    print(loop[ (K-hazime)%(len(loop)) ])
N = int(input())
A = list(map(int, input().split()))
k = max(A)

def pow_k(x, n):
    """
    O(log n)
    """
    if n == 0:
        return 1

    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x % 998244353
        x *= x % 998244353
        n //= 2

    return K * x % 998244353

if A[0] != 0:
    print(0)
    exit()
if A.count(0) != 1:
    print(0)
    exit()



R = [1]
result = 1


for i in range(k):
    R.append(A.count(i + 1))
    A.remove(i + 1)

for j in range(k):
    result *= pow_k(R[j], R[j + 1])

    if result == 0:
        print(0)
        exit()

print(result % 998244353)


### FIXED CODE ###

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

def pow_k(x, n):
    """
    O(log n)
    """
    if n == 0:
        return 1

    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x % 998244353
        x *= x % 998244353
        n //= 2

    return K * x % 998244353


R = [0] * (k + 1)
result = 1
for i in A:
    R[i] += 1

if A[0] != 0 or R[0] != 1:
    print(0)
    exit()

for j in range(k):
    result *= pow_k(R[j], R[j + 1])

    if result == 0:
        print(0)
        exit()

print(result % 998244353)
import numpy as np

N = int(input())
A = np.array(list(map(int,input().split())))
B = np.array(list(map(int,input().split())))
Bsi = np.argsort(B)
A2 = A[Bsi]
Bs = B[Bsi]
A2si = np.argsort(A2)
As = A2[A2si]
C = Bs-As
if any(C[C<0]):
    ans = 'No'
else:
    D = A2-As
    if any(D == 0):
        ans = 'Yes'
    elif all(As[1::]-Bs[:-1:] > 0):
        psum = A2si[0]
        for i,pi in enumerate(A2si[1:-1],1):
            psum += pi
            if psum == int(i*(i+1)/2)
                ans = 'Yes'
                break
        else:
            ans = 'No'
    else:
        ans = 'Yes'
        
print(ans)

### FIXED CODE ###

import numpy as np

N = int(input())
A = np.array(list(map(int,input().split())))
B = np.array(list(map(int,input().split())))
Bsi = np.argsort(B)
A2 = A[Bsi]
Bs = B[Bsi]
A2si = np.argsort(A2)
As = A2[A2si]
C = Bs-As
if any(C[C<0]):
    ans = 'No'
else:
    D = A2-As
    if any(D == 0):
        ans = 'Yes'
    elif all(As[1::]-Bs[:-1:] > 0):
        pi = 0
        i = 0
        while i<N-1:
            pi = A2si[pi]
            if pi == 0:
                ans = 'Yes'
                break
            else:
                i += 1
        else:
            ans = 'No'
    else:
        ans = 'Yes'
        
print(ans)
H, W=map(int,input().strip().split(' '))

def w_f():
    cost=[]
    for i in range(10):
        cost.append(list(map(int,input().strip().split(' '))))

    for k in range(10):
        for i in range(10):
            for j in range(10):
                cost[i][j]=min(cost[i][j],cost[i][k]+cost[k][j])
    rerurn cost
    
d=w_f()
ans=0
for i in range(H):
    a=list(map(int,input().strip().split(' ')))
    for j in a:
        if j!=-1:
            ans+=cost[j][1]
print(ans)



### FIXED CODE ###

H, W=map(int,input().strip().split(' '))

cost=[]
for i in range(10):
    cost.append(list(map(int,input().strip().split(' '))))

for k in range(10):
    for i in range(10):
        for j in range(10):
            cost[i][j]=min(cost[i][j],cost[i][k]+cost[k][j])
ans=0
for i in range(H):
    a=list(map(int,input().strip().split(' ')))
    for j in a:
        if j!=-1:
            ans+=cost[j][1]
print(ans)
S = input()

if len(S) < 26:
    for c in [chr(i) for i in range(ord('a'), ord('a') + 26)]:
        # print(c)
        if c not in S:
            ans = S + c
            break
elif S == 'zyxwvutsrqponmlkjihgfedcba':
    ans = -1
else:
    for i in range(25, -1, -1):
        # print(S[i], S[-1])
        if ord(S[i]) < ord(S[-1]):
            ans = S[:i] + S[-1]
            break
print(ans)

### FIXED CODE ###

S = input()

if len(S) < 26:
    for c in [chr(i) for i in range(ord('a'), ord('a') + 26)]:
        # print(c)
        if c not in S:
            ans = S + c
            break
elif S == 'zyxwvutsrqponmlkjihgfedcba':
    ans = -1
else:
    for i in range(1, len(S)):
        j = - i
        if ord(S[j - 1]) < ord(S[j]):
            break
    # print(S[j:])
    change = 'z'
    for c in S[j:]:
        if ord(S[j - 1]) < ord(c) < ord(change):
            change = c
    ans = S[:j - 1] + change
print(ans)
import math
A,B=map(int,input().split())
c=A*B//math.gcd(A,B)
print(c)

### FIXED CODE ###

import fractions
A,B=map(int,input().split())
c=A*B/fractions.gcd(A,B)
print(int(c))
a,b = map(int,input())
if a < b:
    print(a,'<',b)
elif a > b:
    print(a,'>',b)
else:
    print(a,'==',b)

### FIXED CODE ###

a,b = map(int,input().split())
if a < b:
    print('a < b')
elif a > b:
    print('a > b')
else:
    print('a == b')
a = 2000001
b = 1000000
k, x = map(int, input().split())

if(k == 1):
    print(x)
else:
    ans = [i for i in range(x-k+1, x+k-1)]
    print(" ".join(ans))


### FIXED CODE ###

k, x = map(int, input().split())

if(k == 1):
    print(x)
else:
    ans = [i for i in range(x-k+1, x+k)]
    print(" ".join(map(str, ans)))
import bisect
from typing import List


def solve(ls: List[int]) -> int:
  n = len(ls)
  assert(3 <= n <= 2 * 10**3)

  def n_possible_cs(a: int, b: int, first_ic: int) -> int:
    # def bin_search_le_rightmost(s: int, e: int, target: int):
    #   if s == e:
    #     if ls[s] > target:
    #       return None
    #     else:
    #       return s
    #
    #   mid = s + (e - s) // 2
    #
    #   if ls[mid] <= target and (mid + 1 < n and ls[mid + 1] > target):
    #     return mid
    #   elif ls[mid] <= target:
    #     return bin_search_le_rightmost(mid + 1, e, target)
    #   else:
    #     return bin_search_le_rightmost(s, mid, target)

    idx = bisect.bisect_left(ls, a + b, first_ic)
    return 0 if idx == first_ic else idx - first_ic

  ret = 0
  for ia in range(0, n - 2):
    for ib in range(ia + 1, n - 1):
      a, b = (ls[ia], ls[ib])
      x = n_possible_cs(a, b, ib + 1)
      ret += x
  return ret


# n = int(input().strip())
# ls = [int(l) for l in input().split()]
#
# print(solve(sorted(ls)))

print(solve(sorted([218, 786, 704, 233, 645, 728, 389])))


### FIXED CODE ###

import bisect


def solve(ls) -> int:
  n = len(ls)
  assert(3 <= n <= 2 * 10**3)

  def n_possible_cs(a: int, b: int, first_ic: int) -> int:
    # def bin_search_le_rightmost(s: int, e: int, target: int):
    #   if s == e:
    #     if ls[s] > target:
    #       return None
    #     else:
    #       return s
    #
    #   mid = s + (e - s) // 2
    #
    #   if ls[mid] <= target and (mid + 1 < n and ls[mid + 1] > target):
    #     return mid
    #   elif ls[mid] <= target:
    #     return bin_search_le_rightmost(mid + 1, e, target)
    #   else:
    #     return bin_search_le_rightmost(s, mid, target)

    idx = bisect.bisect_left(ls, a + b, first_ic)
    return 0 if idx == first_ic else idx - first_ic

  ret = 0
  for ia in range(0, n - 2):
    for ib in range(ia + 1, n - 1):
      a, b = (ls[ia], ls[ib])
      x = n_possible_cs(a, b, ib + 1)
      ret += x
  return ret


n = int(input().strip())
ls = [int(l) for l in input().split()]

print(solve(sorted(ls)))
S=list(input())
a=0
for i in range(1,len(S),2):
    if S[i]=="L" or S[i]=="U" or S[i]=="D":
        a+=1
for j in range(0,len(S),2):
    if S[i]=="L" or S[i]=="U" or S[i]=="D":
        a+=1
if a==len(S):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

S=list(input())
a=0
for j in range(0,len(S),2):
    if S[j]=="R" or S[j]=="U" or S[j]=="D":
        a+=1
for i in range(1,len(S),2):
    if S[i]=="L" or S[i]=="U" or S[i]=="D":
        a+=1
if a==len(S):
    print("Yes")
else:
    print("No")
n = input()
c1=c2=0
l = len(n)
c1 = n - len([i for i in l[0::2] if i == "0"]) - len([i for i in l[1::2] if i == "1"])
c2 = n - len([i for i in l[0::2] if i == "1"]) - len([i for i in l[1::2] if i == "0"])

print(min(c1,c2))

### FIXED CODE ###

S = input()
c1 = c2 = 0
 
N = len(S)
c1 = N - len([s for s in S[0::2] if s == "0"]) - len([s for s in S[1::2] if s == "1"])
c2 = N - len([s for s in S[0::2] if s == "1"]) - len([s for s in S[1::2] if s == "0"])
 
print(min(c1, c2))
n = int(input())
pirnt(n**3)

### FIXED CODE ###

n = int(input())
print(n**3)
N,A,B = map(int,input().split())
temp = 0
if (B-A)%2 == 0:
    print(int((B-A)/2))
else:
    min = min([B-1,N-A])
    if A-1 < N-B and (B-A-1)% 2 == 0:
        temp = A + (B-A-1)/2
        if temp < min:
            print(temp)
    elif (b-a-1)%2 == 0:
        a = N - A + 1
        b = N - B + 1
        temp = a + (b-a-1)/2
        if temp < min:
            print(temp)
    else:
        print(temp)

### FIXED CODE ###

N,A,B = map(int,input().split())
temp = 0
if (B-A)%2 == 0:
    print(int((B-A)//2))
else:
    a = N - A + 1
    b = N - B + 1
    print(min([B-1,N-A,A + (B-A-1)//2,a + (b-a-1)//2]))
n = int(input())
list = [0]*n
m = int((n-2)**0.5)
for i in range(1, m):
  for j in range(i, m):
    for k in range(j, m):
      if i*i + j*j + k*k + i*j + j*k + k*i <= n:
        if i==j and j == k:
          list[i*i + j*j + k*k + i*j + j*k + k*i-1] += 1
        elif i == j or j == k:
          list[i*i + j*j + k*k + i*j + j*k + k*i-1] += 3
        else:
          list[i*i + j*j + k*k + i*j + j*k + k*i-1] += 6
      else:
        break
for i in range(n):
  print(list[i])

### FIXED CODE ###

n = int(input())
list = [0]*n
if n ==1:
  m = 1
else:
  m = int((n-2)**0.5)
for i in range(1, m):
  for j in range(i, m):
    for k in range(j, m):
      if i*i + j*j + k*k + i*j + j*k + k*i <= n:
        if i==j and j == k:
          list[i*i + j*j + k*k + i*j + j*k + k*i-1] += 1
        elif i == j or j == k:
          list[i*i + j*j + k*k + i*j + j*k + k*i-1] += 3
        else:
          list[i*i + j*j + k*k + i*j + j*k + k*i-1] += 6
      else:
        break
for i in range(n):
  print(list[i])
n = int(input())
a = list([int(x), int(y)+1] for x, y in zip(input()split(), range(n)))
a.sort()
for i in range(n):
    print(a[i], end=" ")

### FIXED CODE ###

n = int(input())
a = list([int(x), int(y)+1] for x, y in zip(input().split(), range(n)))
a.sort()
for i in range(n):
    print(a[i][1], end=" ")
def judge(bit, n, v):
    # i 人目の証言を検証する
    for i in range(n):
        # 1人目が「不親切」だったら証言はすべて無視
        if not (bit & (1 << i)):
            continue

        x, y = v[i]
        # y == 1 なのに「不親切」だったらダメ
        if y == 1 and not (bit & (1 << x)):
            return False

        # y == 0 なのに「正直者」だったらダメ
        if y == 0 and (bit & (1 << x)):
            return False
    return True


n = int(input())
v = []
for i in range(n):
    for j in range(int(input())):
        x, y = [int(i) for i in input().split()]
        x -= 1
        v.append((x, y))

ans = 0
for bit in range(1 << n):
    if not judge(bit, n, v):
        continue

    # bit に含まれる人数を数える
    cnt = 0
    for i in range(n):
        if bit & (1 << i):
            cnt += 1
    ans = max(ans, cnt)
print(ans)


### FIXED CODE ###

def judge(bit, n, v):
    # i 人目の証言を検証する
    for i in range(n):
        # 1人目が「不親切」だったら証言はすべて無視
        if not (bit & (1 << i)):
            continue

        for x, y in v[i]:
            # y == 1 なのに「不親切」だったらダメ
            if y == 1 and not (bit & (1 << x)):
                return False

            # y == 0 なのに「正直者」だったらダメ
            if y == 0 and (bit & (1 << x)):
                return False
    return True


n = int(input())
v = [[] for _ in range(n)]
for i in range(n):
    for j in range(int(input())):
        x, y = [int(i) for i in input().split()]
        v[i].append((x - 1, y))

ans = 0
for bit in range(1 << n):
    if not judge(bit, n, v):
        continue

    # bit に含まれる人数を数える
    cnt = 0
    for i in range(n):
        if bit & (1 << i):
            cnt += 1
    ans = max(ans, cnt)
print(ans)
num = [input() for i in range(3)]

print((num[0]+num[1])*num[2]/2)

### FIXED CODE ###

num = [int(input()) for i in range(3)]
 
print(int((num[0]+num[1])*num[2]/2))