Harryxun/stf_run huggingface dataset:
N = int(input())
As = list(map(int, input().split()))

sA = sum(As) % (10 ** 9 + 7)
print((sA * sA - sum( (A * A % (10 ** 9 + 7) for A in As) ) ) * pow(2, -1, 10 ** 9 + 7) % (10 ** 9 + 7))

### FIXED CODE ###

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

sA = sum(As) % (10 ** 9 + 7)
print((sA * sA - sum( (A * A % (10 ** 9 + 7) for A in As) ) ) * pow(2, -1, 10 ** 9 + 7) % (10 ** 9 + 7))
N = int(input())
edge = [[] for _ in range(N+1)]
for i in range(N-1):
  u,v,w = map(int, input().split())
  edge[u].append([v,w%2])
  edge[v].append([u,w%2])
color = [0]*(N+1)
visited = [False]*(N+1)
def dfs(u):
  for v,w in edge[u]:
    if visited[v]==False:
      visited[v]=True
      color[v]=color[u]^w
      dfs(v)
  return 0
dfs(1)
ans = color[1:]
print(*ans,sep='\n')

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**8)

N = int(input())
edge = [[] for _ in range(N+1)]
for i in range(N-1):
  u,v,w = map(int, input().split())
  edge[u].append([v,w%2])
  edge[v].append([u,w%2])
color = [0]*(N+1)
visited = [False]*(N+1)
def dfs(u):
  for v,w in edge[u]:
    if visited[v]==False:
      #print(v)
      visited[v]=True
      color[v]=color[u]^w
      dfs(v)
  return 0
visited[1]=True
dfs(1)
ans = color[1:]
print(*ans,sep='\n')
n = int(input())
if n[len(n) - 1] == 3:
  print("bon")
elif n[len(n) - 1] == 0 or 1 or 6 or 8:
  print("pon")
else:
  print("hon")

### FIXED CODE ###

n = input()
if n[-1] in "24579":
  print("hon")
elif n[-1] in "0168":
  print("pon")
elif n[-1] in "3":
  print("bon")
s=sorted(input())
ans="abc"
flag=1
for i in range(3)
	if s[i] != ans[i]:
    	print("No")
        flag=0
    	break
if flag==1:
  print("Yes")




### FIXED CODE ###

s=sorted(input())
ans="abc"
flag=1
for i in range(3):
  if s[i] != ans[i]:
    print("No")
    flag=0
    break

if flag==1:
  print("Yes")
from collections import deque, Counter


class UnionFind:
    def __init__(self, v):
        self.v = v
        self._tree = list(range(v + 1))
        self._counter = Counter(self._tree)

    def _root(self, a):
        queue = deque()
        while self._tree[a] != a:
            queue.append(a)
            a = self._tree[a]
        while queue:
            index = queue.popleft()
            self._tree[index] = a
        return a

    def union(self, a, b):
        root_a = self._root(a)
        root_b = self._root(b)
        if root_a == root_b:
            return

        self._tree[root_b] = root_a
        ca = self._counter[root_a]
        cb = self._counter[root_b]
        self._counter[root_a] += cb
        self._counter[root_b] = 0
        return ca * cb

    def find(self, a, b):
        return self._root(a) == self._root(b)


N, M = map(int, input().split(' '))
edges = [tuple(map(int, input().split(' '))) for _ in range(M)]

dp = [0] * (M + 1)
dp[-1] = N * (N - 1) // 2
union_find = UnionFind(N)

for i in reversed(range(M)):
    a, b = edges[i]
    minus = union_find.union(a, b)
    dp[i] = dp[i + 1] - minus
    if dp[i] == 0:
        break

for i in range(M):
    print(dp[i+1])


### FIXED CODE ###

from collections import deque, Counter


class UnionFind:
    def __init__(self, v):
        self.v = v
        self._tree = list(range(v + 1))
        self._counter = Counter(self._tree)

    def _root(self, a):
        queue = deque()
        while self._tree[a] != a:
            queue.append(a)
            a = self._tree[a]
        while queue:
            index = queue.popleft()
            self._tree[index] = a
        return a

    def union(self, a, b):
        root_a = self._root(a)
        root_b = self._root(b)
        if root_a == root_b:
            return 0

        self._tree[root_b] = root_a
        ca = self._counter[root_a]
        cb = self._counter[root_b]
        self._counter[root_a] += cb
        self._counter[root_b] = 0
        return ca * cb

    def find(self, a, b):
        return self._root(a) == self._root(b)


N, M = map(int, input().split(' '))
edges = [tuple(map(int, input().split(' '))) for _ in range(M)]

score = N * (N - 1) // 2
union_find = UnionFind(N)
scores = []

for a, b in reversed(edges):
    scores.append(score)
    if score == 0:
        continue
    minus = union_find.union(a, b)
    score -= minus

for s in reversed(scores):
    print(s)
if a[0] == a[1] and a[1] == a[2]:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

a = input().split()
if a[0] == a[1] and a[1] == a[2]:
    print("Yes")
else:
    print("No")
import math
r = int(input())
print('{a:6f} {b:6f}'.format(a=r*r*math.pi, b=r*2*math.pi))



### FIXED CODE ###

import math
r = float(input())
print('{a:6f} {b:6f}'.format(a=r*r*math.pi, b=r*2*math.pi))
from collections import defaultdict
from fractions import Fraction

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

MOD = 1000000007
d_plus = defaultdict(int)  # + or ∞
d_minus = defaultdict(int)  # - or 0
ans = 1

for i, (a, b) in enumerate(X):
    if a == 0 and b == 0:
        continue
    elif a == 0:
        d_minus[0] += 1
    elif b == 0:
        d_plus[float('inf')] += 1
    elif a * b > 0:
        d_plus[Fraction(a, b)] += 1
    else:
        d_minus[Fraction(a, b)] += 1


def pair(p):
    if p == 0:
        return float('inf')
    elif p == float('inf'):
        return 0
    else:
        return -1 / p


for m in d_minus:
    d_plus[pair(m)] += 0
for p in d_plus:
    ans = ans * (pow(2, d_plus[p], MOD) + pow(2, d_minus[pair(p)], MOD) - 1)
    ans %= MOD
print((ans - 1) % MOD)


### FIXED CODE ###

N = int(input())
if N % 10 in {2, 4, 5, 7, 9}:
    print('hon')
elif N % 10 in {0, 1, 6, 8}:
    print('pon')
else:
    print('bon')
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n,m = na()

if n%2 == 0:
    a,b = n//2,n//2+1
    for i in m:
        print(a,b)
        a,b = a-1,b+1
else:
    a,b = 1,n
    for i in m:
        print(a,b)
        a,b = a+1,b-1


### FIXED CODE ###

import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n,m = na()

a,b = 1,n-(n%2)
for i in range(m):
    if n%2 == 0 and i == (m+1)//2:
        a += 1
    print(a,b)
    a,b = a+1, b-1
from itertools import product

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

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

s = sum

delecious = []
for prod in product(a, b, c):
    delecious.append(s(prod))

delecious.sort(reverse=True)

for i in range(k):
    print(delecious[i])

### FIXED CODE ###

l = []
for _ in range(6):
    l.append(int(input()))

if l[-2] - l[0] > l[-1]:
    print(':(')
else:
    print('Yay!')
# ABC104-C

D,G=map(int,input().split()) 
box=[] 
for i in range(D): 
    box.append(list(map(int,input().split()))) 
box.insert(0,[0,0]) #数を１番目に合わせるため 
info=[[0,0] for i in range(2**D)] #各全完の組での点数、解いた問題数の記憶

for i in range(2*D): #全完したものをinfoに追加
    for j in range(1,D+1): #100j点の問題は全完するか 
        if (i>>(j-1))&1: 
            info[i][0]+=box[j][1]+j*100*box[j][0] 
            info[i][1]+=box[j][0] 
            info2[i][j]=box[j][0] #ｊ番目を全問解いている。

for i in range(2**D):
    score=G-info[i][0]
    if score<=0:
        continue
    else:
        n=D
        while score>0:
            #print(str(i)+":"+str(score))
            if (i>>(n-1))&1:
                continue
            else:
                for j in range(1,box[n][0]+1):
                    score -= 100*n
                    info[i][1]+=1 #解いた数を増やす
                    if j==box[n][0]: #ボーナス点追加
                        score-=box[n][1]
                    if  score<=0:
                        break
            n-=1
            
l=len(info)
for i in range(l-1):
    min=info[i][1]
    m=info[i]
    t=i
    for j in range(i+1,l):
        if min>info[j][1]:
            min=info[j][1]
            t=j
    info[i]=info[t]
    info[t]=m
print(info[0][1])

### FIXED CODE ###

D,G=map(int,input().split()) 
box=[] 
for i in range(D): 
    box.append(list(map(int,input().split()))) 
box.insert(0,[0,0]) #数を１番目に合わせるため 
info=[[0,0] for i in range(2**D)] #各全完の組での点数、解いた問題数の記憶
info2=[[0]*(D+1) for i in range(2**D)] #i番目を何問解いているか？

for i in range(2**D): #全完したものをinfoに追加
    for j in range(1,D+1): #100j点の問題は全完するか 
        if (i>>(j-1))&1: 
            info[i][0]+=box[j][1]+j*100*box[j][0] 
            info[i][1]+=box[j][0] 
            info2[i][j]=box[j][0] #ｊ番目を全問解いている。

for i in range(2**D):
    score=G-info[i][0]
    if score<=0:
        continue
    else:
        n=D
        while score>0:
            num=box[n][0]-info2[i][n] #残りの問題数
            #print(num)
            #print(str(i)+":"+str(score))
            if num!=0:
                for j in range(1,num+1):
                    score -= 100*n
                    info[i][1]+=1 #解いた数を増やす
                    if j==num: #ボーナス点追加
                        score-=box[n][1]
                    if  score<=0:
                        break
            n-=1
            
l=len(info)
for i in range(l-1):
    min=info[i][1]
    m=info[i]
    t=i
    for j in range(i+1,l):
        if min>info[j][1]:
            min=info[j][1]
            t=j
    info[i]=info[t]
    info[t]=m
print(info[0][1])
import heapq
 
 
 
n, m = map(int, input().split())
t_r_list = []
for i in range(n):
    t_r_list.append(list(map(int, input().split())))


t_r_list.sort()
que = []
total = 0
l = 0
for j in range(1, m+1):
    while j < m and t_r_list[l][0] == j:
        heapq.heappush(que, -t_r_list[l][1])
        l += 1
        if l >= n:
            break
        
 
    if que:
        total -= heapq.heappop(que)
      
      
print(total)

### FIXED CODE ###

import heapq

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

t_r_list.sort()
que = []
total = 0
l = 0
for j in range(1, m + 1):
    while True:
        if l == n:
            break
        if t_r_list[l][0] != j:
            break
        heapq.heappush(que, -t_r_list[l][1])
        l += 1

    if que:
        total -= heapq.heappop(que)


print(total)
import sys

n=int(raw_input())
buf =[[] for i in range(n)]

while True:
    text = raw_input().split()
    if text[0] == 'quit':
        break
    elif text[0] == 'push':
        buf[text[1]].append(text[2])
    elif text[0] == 'pop':
        print buf[text[1]][-1]
        buf[text[1]].pop()
    elif text[0] == 'move':
        buf[text[2]].append(buf[text[1]][-1])
        buf[text[1]].pop()

### FIXED CODE ###

import sys

n=int(raw_input())
buf =[[] for i in range(n)]

while True:
    text = raw_input().split()
    if text[0] == 'quit':
        break
    elif text[0] == 'push':
        buf[int(text[1])-1].append(text[2])
    elif text[0] == 'pop':
        print buf[int(text[1])-1][-1]
        buf[int(text[1])-1].pop()
    elif text[0] == 'move':
        buf[int(text[2])-1].append(buf[int(text[1])-1][-1])
        buf[int(text[1])-1].pop()
import math
import sys
C, D = map(int, input().split())

print(C//D)

### FIXED CODE ###

from decimal import Decimal

C, D = map(Decimal, input().split())
print(int(C*D))
n = int(input())
V = sorted(list(map(int, input().split())))
print(ans)
for i in range(1, n):
  ans = (V[i] + ans)/2

print(ans)

### FIXED CODE ###

n = int(input())
V = sorted(list(map(int, input().split())))
ans = V[0]
for i in range(1, n):
  ans = (V[i] + ans)/2

print(ans)
swap_count = 0


def main():
  num = int(input())
  elements = [int(x) for x in input().split()]

  # Get max interval
  intervals = []
  for i in range(0, num):
    interval = int_f(i)
    if num <= interval:
      break
    intervals.append(interval)

  for interval in intervals:
    insertion_sort(elements, num, interval)

  print(len(intervals))
  print(' '.join([str(interval) for interval in intervals]))
  print(swap_count)
  print(' '.join([str(i) for i in elements]))


def int_f(x):
  return 3 * x + 1


def insertion_sort(elements, num, interval=1):
  global swap_count

  i = interval
  while i < num:
    j = i
    while interval <= j:
      print("%s, i: %s, j: %s" % (elements, i, j))
      if elements[j - interval] <= elements[j]:
        break

      elements[j - interval], elements[j] = elements[j], elements[j - interval]
      swap_count += 1
      j -= interval
    i += 1


if __name__ == '__main__':
  main()

### FIXED CODE ###

import math


swap_count = 0


def main():
  num = int(input())
  elements = []
  for i in range(0, num):
    elements.append(int(input()))

  # Get intervals
  interval = 1
  intervals = [interval]
  while True:
    interval = int_f(interval)
    if interval > num:
      break
    intervals.insert(0, math.ceil(interval))

  for interval in intervals:
    insertion_sort(elements, num, interval)

  print(len(intervals))
  print(' '.join([str(interval) for interval in intervals]))
  print(swap_count)
  for val in elements:
    print(val)


def int_f(x):
  return 2.25 * x + 1


def insertion_sort(elements, num, interval=1):
  global swap_count

  i = interval
  while i < num:
    j = i
    while interval <= j:
      if elements[j - interval] <= elements[j]:
        break

      elements[j - interval], elements[j] = elements[j], elements[j - interval]
      swap_count += 1
      j -= interval
    i += 1


if __name__ == '__main__':
  main()
def solve():
  N=int(input())
  a=list(map(int,input().split()))
  dp=[float('inf') for i in range(N)]
  dp[0]=0
  for i in range(N):
    for j in range(1,3):
      if i+j<N:
	  	dp[i+j]=min(dp[i+j],dp[i]+abs(a[i]-a[i+j]))
        
  print(dp[N-1])
solve()
      

### FIXED CODE ###

def solve():
  N=int(input())
  a=list(map(int,input().split()))
  dp=[float('inf') for i in range(N)]
  dp[0]=0
  for i in range(N):
  	for j in range(i+1,min(i+3,N)):
  		dp[j]=min(dp[j],dp[i]+abs(a[i]-a[j]))
  print(dp[N-1])
solve()
      
# your code goes here
t = int(input())
x = 48 - t

return x

### FIXED CODE ###

M = int(input())
x = 48 - M

print(x)
#標準入力からKを求めるまで
N = int(input())
node = [0] * N
AB = []
for i in range(N-1):
    ab = list(map(int, input().split()))
    node[ab[0] - 1] += 1
    node[ab[1] - 1] += 1
    AB.append(ab)
K = max(node)
print(K)

#各辺の色を求めていく
color = [[ i for i in range(1, K + 1)] for i in range(N)]
for i in range(N-1):
    now = list(set(color[AB[i][0]-1]) & set(color[AB[i][1] - 1]))
    tmp = now[0]
    color[AB[i][0]-1].remove(tmp)
    color[AB[i][1]-1].remove(tmp)
    print(tmp)

### FIXED CODE ###

#グラフ構造DFSを使う
import sys
sys.setrecursionlimit(500000)
N = int(input())
ans = [-1] * (N-1)
g = [[] for _ in range(N)]
for i in range(N-1):
    a, b = map(int, input().split())
    g[a-1].append((b-1, i))
    g[b-1].append((a-1, i))

def bfs(v, c, p):
    n_c = 1
    for i in range(len(g[v])):
        to = g[v][i][0]
        ID = g[v][i][1]
        if to == p:
            continue
        if n_c == c:
            n_c += 1
        ans[ID] = n_c
        bfs(to, n_c, v)
        n_c += 1

bfs(0, 0, -1)
print(max(ans))
for i in range(N-1):
    print(ans[i])
n,m=map(int,input.split())

ans=n*(n-1)/2#nC2の順列を利用（n個の球から2個の玉を選択）
ans+=m*(m-1)/2

print(int(ans))

### FIXED CODE ###

n,m=map(int,input().split())

ans=n*(n-1)/2
ans+=m*(m-1)/2

print(int(ans))
import math
h=x/(a**2)
if h>b/2:
    y=2*a*h/b
    shita=math.degrees(math.atan2(y,b))
if h<=b/2:
    y=2*h-b
    y=b-y
    shita=math.degrees(math.atan2(b,y))
print(shita)

### FIXED CODE ###

import math
a, b, x = map(int, input().split())
h=x/(a**2)
if h<b/2:
    y=2*a*h/b
    shita=math.degrees(math.atan2(b,y))
if h>=b/2:
    y=2*h-b
    t=b-y
    shita=math.degrees(math.atan2(t,a))
print(shita)
d = ['SUN','MON','TUE','WED','THUv,'FRI','SAT'].index(input())
print(7 - d)

### FIXED CODE ###

d = ['SUN','MON','TUE','WED','THU','FRI','SAT'].index(input())
print(7 - d)
#!/usr/bin/env python3

n, m = [int(x) for x in input().split()]
edges = []
g = [[] for _ in range(n)]
for _ in range(m):
    a, b = [int(x) for x in input().split()]
    a -= 1
    b -= 1
    e = len(edges)
    g[a].append(e)
    g[b].append(e)
    edges.append((a, b))

if m % 2 == 1:
    print(-1)
    import sys
    sys.exit(0)


visited = [False] * n
visitede = [False] * m


def build_stree(i):
    cts = []
    for e in g[i]:
        j = edges[e][1 if edges[e][0] == i else 0]
        if visited[j]:
            continue
        visitede[e] = True
        visited[j] = True
        cts.append((e, build_stree(j)))
    return i, cts


visited[0] = True
st = build_stree(0)

rev_e = [None if v else False for v in visitede]


def pos(t):
    i, cts = t
    for _, ct in cts:
        pos(ct)
    es = [e for e in g[i] if rev_e[e] is None]
    assert len(es) <= 1
    if not es:
        return
    f = es[0]
    rev_e[f] = (sum(
        (edges[e][0] == i) ^ rev_e[e]
        for e in g[i] if e != f
    ) % 2 != 0) ^ (edges[f][0] == i)


pos(st)

for ed, re in zip(edges, rev_e):
    if re:
        b, a = ed
    else:
        a, b = ed
    print(a + 1, b + 1)


### FIXED CODE ###

#!/usr/bin/env python3

import sys

sys.setrecursionlimit(1000000)

n, m = [int(x) for x in input().split()]
edges = []
g = [[] for _ in range(n)]
for _ in range(m):
    a, b = [int(x) for x in input().split()]
    a -= 1
    b -= 1
    e = len(edges)
    g[a].append(e)
    g[b].append(e)
    edges.append((a, b))

if m % 2 == 1:
    print(-1)
    sys.exit(0)


visited = [False] * n
visitede = [False] * m


def build_stree(i):
    cts = []
    for e in g[i]:
        j = edges[e][1 if edges[e][0] == i else 0]
        if visited[j]:
            continue
        visitede[e] = True
        visited[j] = True
        cts.append((e, build_stree(j)))
    return i, cts


visited[0] = True
st = build_stree(0)

rev_e = [None if v else False for v in visitede]


def pos(t):
    i, cts = t
    for _, ct in cts:
        pos(ct)
    es = [e for e in g[i] if rev_e[e] is None]
    assert len(es) <= 1
    if not es:
        return
    f = es[0]
    rev_e[f] = (sum(
        (edges[e][0] == i) ^ rev_e[e]
        for e in g[i] if e != f
    ) % 2 != 0) ^ (edges[f][0] == i)


pos(st)

for ed, re in zip(edges, rev_e):
    if re:
        b, a = ed
    else:
        a, b = ed
    print(a + 1, b + 1)
n, m = map(int, input().split())

G = [[] for _ in range(m)]
for _ in range(m):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    G[u].append(v)
    G[v].append(u)

ans = [-1] * n
ans[0] = 'Yes'

from collections import deque

q = deque([0])

while q:
    _q = q.popleft()
    for x in G[_q]:
        if ans[x] == -1:
            ans[x] = _q
            q.append(x)

if -1 in ans:
    print('No')
else:
    print('Yes')
    for _ans in ans[1:]:
        print(_ans+1)


### FIXED CODE ###

n, m = map(int, input().split())

G = [[] for _ in range(n)]
for _ in range(m):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    G[u].append(v)
    G[v].append(u)

ans = [-1] * n

from collections import deque

q = deque([0])

while q:
    _q = q.popleft()
    for x in G[_q]:
        if ans[x] == -1:
            ans[x] = _q + 1
            q.append(x)

if -1 in ans:
    print('No')
else:
    ans[0] = 'Yes'
    for _ans in ans:
        print(_ans)
a,b,c,d=map(int,input().split())
def amari(a):
  return a % 998244353
import numpy as np
X=np.zeros((3, c, d),int)
X[0][a-1][b-1]=1
for j in range(b,d):
 X[0][a-1][j]=amari(X[0][a-1][j-1]*(a-1))
 X[1][a-1][j]=amari(X[0][a-1][j-1]+X[1][a-1][j-1]*(a-1))
 X[2][a-1][j]=amari(X[1][a-1][j-1]+X[2][a-1][j-1]*a)
for i in range(a,c):
 for j in range(b,d+1):
  X[1][i][j-1]=amari(X[0][i-1][j-1]+X[1][i-1][j-1]+X[2][i-1][j-1]*j)
  if j>=2:
   X[2][i][j-1]=amari(X[1][i][j-2]+X[2][i][j-2] *(i+1))
  else:
    X[2][i][j-1]=0
print(amari(X[0][c-1][d-1]+X[1][c-1][d-1]+X[2][c-1][d-1]))

### FIXED CODE ###

a,b,c,d=map(int,input().split())
def amari(a):
  return a % 998244353
X0=[[0]*d for i in range(c)]
X1=[[0]*d for i in range(c)]
X2=[[0]*d for i in range(c)]
X0[a-1][b-1]=1
for j in range(b,d):
 X0[a-1][j]=amari(X0[a-1][j-1]*(a-1))
 X1[a-1][j]=amari(X0[a-1][j-1]+X1[a-1][j-1]*(a-1))
 X2[a-1][j]=amari(X1[a-1][j-1]+X2[a-1][j-1]*a)
for i in range(a,c):
 for j in range(b,d+1):
  X1[i][j-1]=amari((X0[i-1][j-1]+X1[i-1][j-1]+X2[i-1][j-1])*j)
  if j>=2:
   X2[i][j-1]=amari(X1[i][j-2]+X2[i][j-2] *(i+1))
print(amari(X0[c-1][d-1]+X1[c-1][d-1]+X2[c-1][d-1]))
from math import inf
class Vertice:
  def __init__(self, num):
    self.num = num
    self.connected = []
    self.edge = []
    self.pos = inf
    
def DFS(vertice):
  judge = True
  for con in vertice.connected:
    index = vertice.connected.index(con)
    if con.pos == inf:
      con.pos = vertice.pos + vertice.edge[index]
      judge = DFS(con)
    elif con.pos != vertice.pos + vertice.edge[index]:
      judge = False
    if judge == False:
      break
  return judge


N, M = (int(_) for _ in input().split())
vertices = [Vertice(i) for i in range(N)]
L, R, D = ([None for i in range(M)] for j in range(3))
for i in range(M):
  L[i], R[i], D[i] = (int(_) for _ in input().split())
for i in range(M):
  if not vertices[R[i] - 1] in vertices[L[i] - 1].connected:
    vertices[L[i] - 1].connected.append(vertices[R[i] - 1])
    vertices[R[i] - 1].connected.append(vertices[L[i] - 1])
    vertices[L[i] - 1].edge.append(D[i])
    vertices[R[i] - 1].edge.append(-D[i])
judge = True
for i in range(N):
  if vertices[i].pos == inf:
    vertices[i].pos = 0
    judge = DFS(vertices[i])
    if judge == False:
      print('No')
      break
if judge:
  print('Yes')

### FIXED CODE ###

import sys
sys.setrecursionlimit(2000002)

def DFS(i, pos, connected, distances):
  if pos[i] == None:
    pos[i] = 0
  size = len(connected[i])
  for j in range(size):
    if pos[connected[i][j]] == None:
      pos[connected[i][j]] = pos[i] + distances[i][j]
      if DFS(connected[i][j], pos, connected, distances) == False:
        return False
    elif pos[connected[i][j]] != pos[i] + distances[i][j]:
      return False
  return True

N, M = map(int, input().split())
pos = [None for i in range(N + 1)]
connected = [[] for i in range(N + 1)]
distances = [[] for i in range(N + 1)]
for i in range(M):
  l, r, d = map(int, input().split())
  connected[l].append(r)
  distances[l].append(d)
  connected[r].append(l)
  distances[r].append(-d)
judge = True
for i in range(1, N + 1):
  if pos[i] == None:
    judge = DFS(i, pos, connected, distances)
    if judge == False:
      break
if judge:
  print('Yes')
else:
  print('No')
a, b=map(int,input().split())
c=a*b
if c%==0:
  print("Odd")
else:
  print("Even")

### FIXED CODE ###

a, b=map(int,input().split())
if a*b%2==0:
  print("Even")
else:
  print("Odd")
b=int(input())
print('A' if b=='T'
      else 'T' if b=='A'
      else 'G' if b=='C'
      else 'C')

### FIXED CODE ###

b=input()
print('A' if b=='T'
      else 'T' if b=='A'
      else 'G' if b=='C'
      else 'C')
#AtCoder
N, M = map(int, input().split())

s = set()
g = set()

for _ in range(M):
    a, b = map(int, input().split())
    if a == 1:
        s.add(a)
    else b == N:
        g.add(a)

if set1 & set2:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
    


### FIXED CODE ###

#AtCoder
N, M = map(int, input().split())

s = set()
g = set()

for _ in range(M):
    a, b = map(int, input().split())
    if a == 1:
        s.add(b)
    if b == N:
        g.add(a)

if s & g:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
import math
n,d = map(int,input().split())
r = 0
for in range(n):
  a,b = map(int,input().split())
  if d >= math.sqrt(a**2 + b**2):
  	r += 1
print(r)

### FIXED CODE ###

import math
n,d = map(int,input().split())
r = 0
d_ = d**2
for i in range(n):
  a,b = map(int,input().split())
  if d_ >= a**2 + b**2:
    r += 1
print(r)
s = input()
s[3] = '8'
print(s)

### FIXED CODE ###

s = input()
s_2 = s[4:10]
print('2018' + s_2)