peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
x = int(input())

if x%11 <= 6:
    print((x//11)*2 + 1)
else:
    print((x//11)*2 * 2)
# Judge status: Accepted
x = int(input())
 
ans = (x//11)*2
remainder = x%11
if remainder == 0:
    print(ans)
elif 1 <= remainder <= 6:
    print(ans+1)
else:
    print(ans+2)
# Judge status: Accepted
"""
N = list(map(int,input().split()))
S = [str(input()) for _ in range(N)]
S = [list(map(int,list(input()))) for _ in range(h)] 
print(*S,sep="")
"""

import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()
inf = float("inf") # 無限
s = set(map(int,input().split()))
print(len(s))
# Judge status: Accepted
s = input()

ans = 0
for i in range(len(s)):
    if s[i] == 'A' or s[i] == 'C' or s[i] == 'G' or s[i] == 'T':
        count = 1
        for j in range(i+1, len(s)):
            if s[j] == 'A' or s[j] == 'C' or s[j] == 'G' or s[j] == 'T':
                count += 1
            else:
                break
        if ans <= count:
            ans = count
print(ans)
# Judge status: Accepted
if __name__ == '__main__':
    n = int(input())
    t = (1 + n) * n // 2
    print(t - n)
# Judge status: Accepted
N, M = map(int, input().split())
if N == 1 and M > 3:
    print(M - 2)
elif M == 1 and N > 3:
    print(N - 2)
else:
    print((N - 2) * (M - 2))
# Judge status: Accepted
n = int(input())
d = {}
while n % 2 == 0:
    d[2] = 1 if 2 not in d else d[2] + 1
    n //= 2
f = 3
while f * f <= n:
    if n % f == 0:
        d[f] = 1 if f not in d else d[f] + 1
        n //= f
    else:
        f += 2
if n != 1:
    d[n] = 1 if n not in d else d[n] + 1
cnt = 0
for k, v in d.items():
    i = 1
    while i <= v:
        cnt += 1
        v -= i
        i += 1
print(cnt)
# Judge status: Wrong Answer
A , B , C = map(int,input().split())
L = C-(A-B)
if L <= 0:
  print(L)
else:
  print(0)
# Judge status: Accepted
import sys

N, P = map(int, input().split())
A = list(map(int, sys.stdin.readline().rsplit()))

even = odd = 0
for a in A:
    if a % 2 == 0:
        even += 1
    else:
        odd += 1

if odd == 0 and P == 0:
    print(2 ** even)
elif odd == 0 and P == 1:
    print(0)
else:
    print(2 ** (N - 1))
# Judge status: Accepted
import itertools

def main():
    A, B = map(int, input().split())
    if (A > 9) | (B > 9):
        print(-1)
    else:
        print(A * B)
    return 0
if __name__ == '__main__':
    main()
# Judge status: Accepted
A, B, C = map(int, input().split())
K = int(input())

count=0

for i in range (0, 100):
    if B <= A:
        B = B*2
        count+= 1
    if C <= B:
        C = C*2
        count+=1

if count <= K:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
S = input()

if S == 'AAA':
    print('No')
elif S == 'BBB':
    print(('No'))
else:
    print('Yes')
# Judge status: Accepted
from sys import stdin

H,A = [int(x) for x in stdin.readline().rstrip().split()]
if H%A==0:
    print(int(H/A))
elif A>H :
    print(1)
else :
    print(1+int(H/A))
# Judge status: Accepted
n=int(input())
s=input()
a=[1 if i=='(' else -1 for i in s]
e=[0]
for i in range(n):
    e.append(e[i]+a[i])
s=-min(e)*'('+s
s+=(s.count('(')-s.count(')'))*')'
print(s)
#print(e)
# Judge status: Accepted
print(("No","Yes")[int(input()) % 9 == 0])
# Judge status: Accepted
from collections import Counter

S = input()
d = Counter(S).values()
if len(S) == 1:
  ans = "YES"
elif len(S) == 2:
  if S[0] != S[1]:
    ans = "YES"
  else:
    ans = "NO"
elif len(d) == 3 and max(d) - min(d) <=1:
  ans = "YES"
else:
  ans = "NO"
print(ans)
# Judge status: Accepted
n=input()
print('Yes' if n[0]==n[1]==n[2] or n[1]==n[2]==n[3] else 'No')
# Judge status: Wrong Answer
item = []
item.append(input())
n = int(input())
for i in range(n):
    tmp = input()
    if tmp[0] == '1':
        item.reverse()
    else:
        _, q, s = tmp.split()
        if q == '1':
            item = [s] + item
        else:
            item += [s]
print(''.join(item))
# Judge status: Accepted
X=input()

ans=0
a=0
for i in range(len(X)):
  if(X[i]=="T"):
    a+=1
  else:
    a-=1
  ans=max(ans,a)
print(ans*2)
# Judge status: Accepted
def get_index(n):
    i=1
    while True:
        if n<=piramid(i):
            return i-1
        i+=1

def piramid(n):
    return n*(n+1)//2

n=int(input())
index=get_index(n)

print(index+1)
# Judge status: Accepted
a,b,c=map(int,input().split());print(min(b//a,c))
# Judge status: Accepted
n=int(input())
s = 0
a = 0
b = 0
for i in range(n):
    t,x,y=map(int,input().split())
    if t-s - abs(x-a) - abs(y-b)>=0 and (t-s - abs(x-a) - abs(y-b)) %2 == 0:
        s = t
        a = x
        b = y
    else:
        print('No')
        exit()
print('Yes')
# Judge status: Accepted
x = input()

if x == "ABC":
    print("ARC")
else:
    print("ABC")
# Judge status: Wrong Answer
# cook your dish here
abc=list(map(int , input().split()))
# frequency check is used
count=0
element=5
element1=7
frequency1=abc.count(5)
frequency2=abc.count(7)
if(frequency1 == 2):
    if(frequency2 == 1):
        count+=1
        
    else:
        count+=0
        
else:
    count+=0
    
if(count == 1):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
#8
a,b = input().split()
c = int(a + b)

d = c**0.5

if c == d**2:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))

if 1 in a:
    num = 1
    for i in range(n):
      if a[i] == num:
          a[i] = 0
          num += 1
      else:
          a[i] = 1
          
print(sum(a))
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

x=sum(b)-sum(a)
y=0
for i in range(n):
    if a[i]<b[i]:
        y+=-((a[i]-b[i])//2)
print("No" if x<y else "Yes")
# Judge status: Wrong Answer
n=int(input())
x=list(map(int,input().split()))
X = sorted(x)
print(x)
print(X)
for i in range(n):
    if x[i] <= X[n//2-1]:
        print(X[n//2]) 
    elif x[i] >= X[n//2]:
        print(X[n//2-1])
# Judge status: Accepted
n = int(input())
ans = 0

if n % 2 == 0:
    n = n // 2
    fives = 5
    while 1:

        if fives > n: 
            break
        ans += n // fives
        fives *= 5

print(ans)
# Judge status: Accepted
n, x = [int(i) for i in input().split()]
l = [0] + [int(i) for i in input().split()]
total = 0
cnt = 0
for i in l:
	total += i
	if total <= x:
		cnt += 1
	else:
		break
print(cnt)
# Judge status: Accepted
def main():
    N, M = map(int, input().split())  # N must be an odd number

    if N % 2 == 1:
        gen = ((i+1, N-i) for i in range(M))
    else:
        gen = ((i+1, N-i) if 2*i < N/2-1 else (i+1, N-i-1) for i in range(M))

    for s in gen:
        print(*s)


if __name__ == "__main__":
    main()
# Judge status: Accepted
N = int(input())

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

money = 1000
kabu = 0

for i in range(len(A)-1):
    if kabu != 0:
        if A[i] >= A[i + 1]:
            money += kabu * A[i]
            kabu = 0

    else:
        if A[i] < A[i + 1]:
            kabu = money // A[i]
            money -= kabu * A[i]

if kabu != 0:
    money += kabu * A[len(A) - 1]
    
print(money)
# Judge status: Accepted
L, R = input().split()
huga = list(map(int, input().split()))
i=0
gou=0

huga.sort()
for a in range(int(R)):
    gou=gou+huga[i]
    i+=1
print(gou)
# Judge status: Accepted
N = int(input())
A_need = N % 500
A = int(input())
print('Yes' if A_need <= A else 'No')
# Judge status: Accepted
n,x = map(int,input().split())
l = list(map(int,input().split()))
d = 0
count=1
for i in range(n):
  d += l[i]
  if d<=x:
    count+=1
print(count)
# Judge status: Accepted
Sx, Sy, Tx, Ty = map(int,input().split())

X = int(Tx - Sx)
Y = int(Ty - Sy)
#S-T-S-T-Sy

z = 'R'*X+'U'*Y+'L'*X+'D'*Y+'D'+'R'*(X+1)+'U'*(Y+1)+'L'+'U'+'L'*(X+1)+'D'*(Y+1)+'R'


print(z)
# Judge status: Accepted
n,d=map(int,input().split())
x=[list(map(int, input().split())) for i in range(n)]
count=0
ans=0
for i in range(n):
    for z in range(i+1,n):
        for c in range(d):
            ans+=(x[i][c]-x[z][c])**2
        if (ans**0.5)%1==0:
            count+=1
        ans=0
print(count)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
ans = 0
for i in range(n):
    if b[i] < a[i]:
        ans += b[i]
    elif b[i] <= a[i] + a[i+1]:
        a[i+1] -= a[i] - b[i]
        ans += b[i]
    else:
        ans += a[i] + a[i+1]
        a[i+1] = 0
print(ans)
# Judge status: Wrong Answer
p,q,r=map(int,input().split())
if p+q<q+r and p+q<p+r:
    print(p+q)
if p+r<p+q and p+r<q+r:
    print(p+r)
if q+r<p+r and q+r<p+q:
    print(q+r)
if p+q==q+r and p+q<p+r:
    print(p+q)
if p+r==q+r and p+r<p+q:
    print(p+r)
if p==q==r:
    print(p+q)
if r+p==q+r and r+p>p+q:
    print(r+p)
# Judge status: Accepted
N = int(input())
ans = [0]


def solve(n):
    if n == 0:
        return
    if n > 0:
        p, a, k = 1, 1, 0
    else:
        p, a, k = -2, -2, 1
    while abs(n) > abs(a):
        p *= 4
        a += p
        k += 2
    while len(ans) <= k:
        ans.append(0)
    ans[k] = 1
    solve(n - p)


solve(N)
print("".join([str(x) for x in reversed(ans)]))
# Judge status: Accepted
a, b = map(int, input().split())
if a % 3 == 0 or b % 3 == 0 or (a+b)%3 == 0:
    print("Possible")
else:
    print("Impossible")
# Judge status: Accepted
line =input().split(' ')
print(len(set(line)))
# Judge status: Wrong Answer
import math
x,y=map(int,input().split())
i=0
count=0
while 2**i<y/x:
  i+=1
  count+=1
if y%x==0:
  count+=1
print(count)
# Judge status: Accepted
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    A, B = map(int, readline().split())
    ans = (B-A)*(B-A+1)//2-B
    print(ans)



if __name__ == '__main__':
    main()
# Judge status: Accepted
N = int(input())
S = input()
ans = 0
d = {"RW": 0, "WR": 0}
for i in range(N):
    if S[i] == "R":
        d["RW"] += 1
ans = d["RW"]
for i in range(N):
    if S[i] == "R":
        d["RW"] -= 1
    else:
        d["WR"] += 1
    ans = min(ans, max(d["RW"], d["WR"]))
print(ans)
# Judge status: Accepted
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
a = inpl()
res = a[0]
for i in range(n-1):
    res = fractions.gcd(res,a[i+1])
print(res)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

stock = 1000

num = 0

for i in range(N-1):
    if A[i] < A[i+1]:
        num += stock // A[i]
        stock %= A[i]
    elif A[i] > A[i+1]:
        stock += num * A[i]
        num = 0

print(stock+A[-1]*num)
# Judge status: Accepted
import math
a,b=map(int,input().split())
def pf(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
pa=set(pf(a))
pb=set(pf(b))
res = pa & pb
print(len(res)+1)
# Judge status: Accepted
X = str(input())

n = len(X)
tmp = 0
cnt = 0
for i in range(n):
  if X[n-1-i] == 'T':
    tmp += 1
  else:
    if tmp > 0:
      tmp -= 1
      cnt += 1

ans = n - 2*cnt
print(ans)
# Judge status: Wrong Answer
n = int(input())

if n < 10:
    print(n)
elif 10 <= n < 100:
    print(9)
elif 100 <= n < 1000:
    print(9+(n-99))
elif 1000 <= n < 10000:
    print(9+900+(n-999))
elif 10000 <= n < 100000:
    print(9+900+90000+(n-9999))
elif 100000 <= n:
    print(9+900+90000)
# Judge status: Wrong Answer
n=int(input())
s=input()

if n%2==2:
  print('No')
else:
  s1=s[:n//2]
  s2=s[n//2:]
  print(s1,s2)
  if s1==s2:
    print('Yes')
  else:
    print('No')
# Judge status: Accepted
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]

ans = [0 for i in range(N + 1)]
ans[0] = 1

ok = sorted(set(i for i in range(1, N + 1)) - set(A))

for i in ok:
  if i == 1:
    ans[i] = 1
  else:
    ans[i] = ans[i - 2] + ans[i - 1]
print(ans[-1]%(10**9+7))
# Judge status: Accepted
def mapt(fn, *args):
    return tuple(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))


def main():
    a, b = Input()
    if a <= 8 and b <= 8:
        print("Yay!")
    else:
        print(":(")


main()
# Judge status: Accepted
m=int(input())
for x in range(m,1000):
    s=str(x)
    if s[0]==s[1] and s[1]==s[2]:
        print(x)
        break
# Judge status: Accepted
if int(input()) == 1:
  print(0)
else:
  print(1)
# Judge status: Accepted
# https://atcoder.jp/contests/agc006/tasks/agc006_a

n = int(input())
s = input()
t = input()

string = s + t
ans = len(string)

for i in range(len(string)):
    for j in range(i, len(string)):
        sub = string[:i] + string[j:]
        if len(sub) >= n:
            if sub[:n] == s and sub[-n:] == t:
                ans = min(ans, len(sub))
print(ans)
# Judge status: Accepted
A = int(input())
B = int(input())
anss = set([1, 2, 3])
anss.remove(A)
anss.remove(B)
for i in anss:
    print(i)
# Judge status: Wrong Answer
i=int(input())
s=list(input())
fw,fr=0,0
count=0

if s[0]=="W" and s[i-1]=="R":
    count+=1
    s[0]="R"
    s[i-1]="W"
if s[i-1]=="R":
    count+=1
    s[i-1]="W"
for j in range (i):
    if s[j]=="W" :
        fw=j 
        break
    
print (s)
for j in range (fw,i):
    if s[j]=="R":
        count+=1
print(count)
# Judge status: Wrong Answer
N,M = map(int,input().split())
if N >= 2*M:
    ans = M//2
else:
    ans = N
    M = M - 2*N
    ans += M//4
print(ans)
# Judge status: Accepted
from math import inf

n, k = map(int, input().split())
a = [int(i) for i in input().split()]
dp = [inf for _ in range(n)]
dp[0] = 0
for i in range(1, n):
    for j in range(1, k + 1):
        if i - j >= 0:
            dp[i] = min(dp[i], abs(a[i] - a[i - j]) + dp[i - j])
        else:
            break

print(dp[-1])
# Judge status: Accepted
x , y =map(int,input().split())
ans = 1
now = x
while True:
    now *= 2
    if now <= y:
        ans += 1
    elif now > y:
        break
print(ans)
# Judge status: Wrong Answer
from itertools import permutations
from math import factorial
from math import sqrt

n = int(input())

nf = factorial(n)

xy = []
X = 0
Y = 1

l = [i for i in range(n)]
s = 0

for i in range(n):
    x, y = map(int, input().split())
    xy.append([x, y])


for p in permutations(l, n):
    p = list(p)
    print(p)
    for i in range(len(p) - 1):
        s += sqrt((xy[i][X] - xy[i+1][X])**2 + (xy[i][Y] - xy[i+1][Y])**2)

print(s/nf)
# Judge status: Accepted
n, k = map(int, input().split())
s = list(input())

cnt = 0
for i in range(n - 1):
    if s[i] == "R" and s[i + 1] == "L":
        cnt += 2
if s[0] == "L":
    cnt += 1

if s[-1] == "R":
    cnt += 1

happy = n - cnt

print(min(happy + k * 2, n - 1))
# Judge status: Accepted
n,k = [int(i) for i in input().split(' ')]
s = 0
for i in range(k,n+2):
    s += i*n - (i*i) + i + 1
    
print(s%(10**9+7))
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
res = [0]*n
for i in range(n):
	res[a[i]-1] = i+1
print(*res)
# Judge status: Accepted
s=input()
l=len(s)
c1=-(-l//2)
c2=l//2
c1b=0
c2b=0

for i in range(l):
  if s[i]=='0':
    if i%2==0:
      c1b+=1
    else:
      c2b+=1
print(min(c1b+c2-c2b, c1-c1b+c2b))
# Judge status: Accepted
num=int(input())
line=list(input())
if len(line)>num:
  line=line[:num]
  line.append("...")
linemap = map(str, line)
line = ''.join(linemap)
print(line)
# Judge status: Accepted
h1,m1,h2,m2,k = map(int, input().split())

ans = (h2*60+m2)-(h1*60+m1)-k
print(ans)
# Judge status: Accepted
n, m = list(map(int, input().split()))
goods = list(map(int, input().split()))
flag = 1
limit = float(sum(goods)) / (4 * m)
for i in range(n - 1):
  for j in range(n - i - 1):
    if goods[j] <= goods[j+1]:
      tmp = goods[j]
      goods[j] = goods[j+1]
      goods[j+1] = tmp
for i in range(1, m):
  if goods[i] < limit:
    flag = 0
    break
if flag:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
data = input().split()

if not('1' in data):
  print(1)
elif not('2' in data):
  print(2)
elif not('3' in data):
  print(3)
# Judge status: Accepted
S = input().strip()
K = int(input())
a = "1"
ind = len(S)
for i in range(len(S)):
    if S[i]!="1":
        a = S[i]
        ind = i
        break
if K<=ind:
    print(1)
else:
    print(a)
# Judge status: Wrong Answer
n,t=map(int,input().split())
ct=[list(map(int,input().split())) for i in range(n)]
ans=float('inf')
for i in range(n):
  if ct[i][1]<=t:
    ans=min(ans,ct[i][0])
print(ans)
# Judge status: Wrong Answer
n,a,b,c,d=map(int,input().split())
s=input()
if c<d:
    print("No" if "##" in s[a-1:d] else "Yes")
else:
    print("Yes" if "##" not in s[a-1:c] and "..." in s[b-1:d] else "No")
# Judge status: Wrong Answer
from collections import deque
n = int(input())
l = ["a","b","c","d","e","f","g","h","i","j","k"]
ansl = []
d = deque()
ans = "a"
d.append([ans,0])
while len(d):
    now,m = d.pop()
    if len(now) == n:
        ansl.append(now)
    else:
        for i in range(m+2):
            d.append([now+l[i],i])
ansl.sort()
for i in ansl:
    print(i)
# Judge status: Accepted
h, w = map(int, input().split())
if h > 1 and w > 1:
    print((h * w + 1)// 2)
else:
    print(1)
# Judge status: Accepted
N=input();print('Yes')if len(set(N[:3]))==1or len(set(N[1:]))==1else print('No')
# Judge status: Wrong Answer
n,k=map(int,input().split())
P=list(map(int,input().split()))
P.sort()
print(sum(P[0:k+1]))
# Judge status: Accepted
h, n = map(int, input().split())
magics = sorted(list(map(int, input().split())) for _ in range(n))
max_cost = max(magic[1] for magic in magics)

dp = [float('inf')] * (h+max_cost)
dp[0] = 0
for i in range(h+max_cost):
    for at, cost in magics:
        if at <= i:
            dp[i] = min(dp[i], dp[i-at] + cost)
        else:
            break
print(min(dp[h:]))
# Judge status: Wrong Answer
N = int(input())
P = list(map(int, input().split()))

cnt = 0
for i in range(N):
    if P[i] == i+1:
        P[i], P[i+1] = P[i+1], P[i]
        cnt += 1
    if i+2 < N:
        if P[i+2] == i+3:
            P[i+1], P[i+2] = P[i+2], P[i+1]
            cnt += 1

print(cnt)
# Judge status: Accepted
n = input()

if n == "AAA" or n == "BBB":
  print("No")
else:
  print("Yes")
# Judge status: Wrong Answer
x,y,k=map(int,input().split())
m=min(x,y,k)
if(x==m):
    print(0,y-m+1)
elif(y==m or k==m):
    print(x-m,y-m)
# Judge status: Accepted
N=int(input())
ans=N*2-2
for n in range(1,int(N**.5)+1):
	if N%n==0:
		ans=min(ans,N//n+n-2)

print(ans)
# Judge status: Accepted
n = int(input())
s = input()
r = 0
g = 0
b = 0
for i in s:
    if i == 'R':
        r += 1
    elif i == 'G':
        g += 1
    else:
        b += 1
ans = r * g * b

for i in range(n):
    for j in range(i+1,n):
        if s[i] == s[j]:
            continue
        k = 2*j - i
        if k >= n or s[k] == s[i] or s[k] == s[j]:
            continue
        ans -= 1
        
print(ans)
# Judge status: Wrong Answer
N, M = [int(x) for x in input().split()]
x = (abs(3-N)+1)*(M-2)
y = (abs(3-M)+1)*abs((N-2))
print(min(x,y))
# Judge status: Accepted
import sys
input = sys.stdin.readline
from fractions import gcd
import math
n = int(input())
a = list(map(int, input().split()))
def lcm(a, b):
    return (a * b) // gcd(a, b)
m = 1
for x in a:
    m = (m * x) // gcd(m, x)
# print(m)
MOD = 1000000007
ans = 0
for x in a:
    b = m // x
    ans = ans + b
ans = ans % MOD
print(math.floor(ans))
# Judge status: Wrong Answer
import sys
n=list(map(int,input().split()))

for i in range(0,4):
    if n[i]==0:
        print(i+1)
        sys.exit()
# Judge status: Accepted
# python 3.4.3
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------



# -------------------------------------------------------------
# main
# -------------------------------------------------------------

N = int(input())
CSF = [tuple(map(int,input().split())) for _ in range(N-1)]

Ans = []
for i in range(N):
    ans = 0
    for j in range(i,N-1):
        c,s,f = CSF[j]
        if ans < s:
            ans = s
        if ans%f != 0:
            ans += f - ans%f
        ans += c
    Ans.append(ans)

for ans in Ans:
    print(ans)
# Judge status: Wrong Answer
n, k = map(int, input().split())
s = input()

for i in s:
    if s.index(i) == k-1:
        print(i.lower(), end="")
        continue
    print(i, end="")
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
a = (sum(A)**2)
b =  sum([(a**2) for a in A])
print(((a-b))//2%(10**9+7))
# Judge status: Accepted
W, H, x, y = map(int,input().split())

cx = W/2
cy = H/2

area = (W*H)/2
if x==cx and y==cy:
    judge = 1
else:
    judge = 0

print(f'{area:.09f}', judge)
# Judge status: Accepted
a, b, x = map( int, input().split())
 
print( b//x - (a-1)//x)
# Judge status: Accepted
h,w = map(int,input().split())
if h == 1 or w == 1:
  print(1)
elif h*w%2 == 0:
  print(h*w//2)
else:
  print(h*w//2+1)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
m = -1
num = sum(b)
for i in a:
    if i == m+1:
        num += c[m-1]
    m = i
print(num)
# Judge status: Accepted
n,m=map(int,input().split())
print(m//2 if 2*n>=m else n+(m-2*n)//4)
# Judge status: Wrong Answer
S = input()
H = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']
k = S.index(S)
print(7-k)
# Judge status: Accepted
import sys
input = sys.stdin.readline

a, b, c, k = map(int, input().split())
if a >= k: print(k)
else:
    # Continue
    res = a
    k -= a
    if b >= k: print(res)
    else:
        # Continue
        k -= b
        print(res - k)
# Judge status: Wrong Answer
N,M=map(int, input().split())
S=[]
for i in range(N):
    a,b=map(int, input().split())
    S.append((a,b))

C=[]
for i in range(M):
    c,d=map(int, input().split())
    C.append((c,d,i+1))
print(C)
for s in S:
    a,b=s
    now=0
    dis=10**9

    for t in C:
        c,d,n=t
        D=abs(c-a)+abs(d-b)
        
        if D<dis:
            dis=D
            now=n
    print(now)
# Judge status: Accepted
import copy

s = input().rstrip()
t = input().rstrip()
ns, nt = len(s), len(t)

start = -1
for i in range(ns - nt, -1, -1):
    for j in range(nt):
        if s[i+j] != t[j] and s[i+j] != '?':
            break
    else:
        start = i
        break

if start >= 0:
    s_ans = s[:start] + t + s[start+len(t):]
    print(s_ans.replace('?', 'a'))
else:
    print('UNRESTORABLE')
# Judge status: Accepted
import fractions
n=int(input())
A=list(map(int,input().split()))
ans=A[0]
for i in range(1,n):
    ans=fractions.gcd(ans,A[i])
print(ans)
# Judge status: Wrong Answer
s = input()
ans = ''

for i in s:
    if i == '0' or i == '1':
        ans += i
    else:
        if len(ans) >= 1:
            ans = ans[:-1]
    print(ans)

print(ans)
# Judge status: Accepted
A, B, C = map(int, input().split())

if A <= C <= B:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n, m, x, y = map(int, input().split())
xx = [int(i) for i in input().split()]
yy = [int(i) for i in input().split()]

war = False
for z in range(x + 1, y + 1):
    if max(xx) < z <= min(yy):
        war = True

print('No War') if war else print('War')
# Judge status: Wrong Answer
a, b, c, x, y = map(int, input().split())
if (a >= 2 * c and b >= 2 * c): print(int(max(x, y) * 2 * c))
elif (a + b <= 2 * c): print(int(a * x + b * y))
else: print(int(min(x, y) * 2 * c) + int((max(x, y) - min(x, y)) * min(a, b)))
# Judge status: Accepted
s, t = input().split()

print("%s%s" %(t,s))
# Judge status: Wrong Answer
A = list(map(int, input().split()))

if A[0]>=A[3]:
  print(A[0])
else:
  if A[0]+A[1]>=A[3]:
    print(A[0])
  else:
    if A[0]+A[1]+A[2]>=A[3]:
      print(A[0]-A[3]+A[0]+A[1])
    else:
      print(A[0]-A[2])
# Judge status: Accepted
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
p=10**9+7
n, m = map(int, input().split())
a = list(int(input()) for i in range(m))

safe = [1]*(n+1)
for aa in a:
    safe[aa]=0

dp = [0]*(n+1)
dp[0] = 1

if safe[1]:dp[1]=1

for i in range(2,n+1):
    if not safe[i]:
        continue

    dp[i] = dp[i-1]%p+dp[i-2]%p

print(dp[-1]%p)