Harryxun/stf_run huggingface dataset:
input()
nums = [ int(i) for i in input().split()]
   
print( min(nums), max(nums), 

### FIXED CODE ###

input()
nums = [ int(i) for i in input().split()]
   
print( min(nums), max(nums), sum(nums))
# -*- coding: utf-8 -*-

a = input().split("")
sum = 700
for i in a:
    if i == 'o':
        sum += 100

print(sum)


### FIXED CODE ###

# -*- coding: utf-8 -*-

a = list(input())
sum = 700
for i in a:
    if i == 'o':
        sum += 100

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

import math
print(a*b//math.gcd(a, b))

### FIXED CODE ###

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

import fractions
print(a*b//fractions.gcd(a, b))
import heapq
inf = 10**18
def dijkstra(s, n, G):#スタート, 頂点数, グラフ:[[(cost, v)], ...]
    dist = [inf]*n
    edges = []#(sからvまでのコストの候補, v)
    dist[s] = 0
    for e in G[s]:
        heapq.heappush(edges, e)
    while edges:
        cost, v = heapq.heappop(edges)
        if dist[v] != inf:
            continue
        dist[v] = cost
        for c, nv in G[v]:
            if dist[nv] == inf:
                heapq.heappush(edges, (cost + c, nv))
    return dist
mx = 5005
n, m, s = map(int, input().split())
g = [[] for _ in range(n*mx)]
for i in range(m):
    u, v, a, b = map(int, input().split())
    u-=1
    v-=1
    for j in range(mx):
        if j>=a:
            g[u*mx+j].append((b, v*mx+j-a))
            g[v*mx+j].append((b, u*mx+j-a))
for i in range(n):
    c, d = map(int, input().split())
    for j in range(mx-c):
        g[i*mx+j].append((d, i*mx+j+c))
dist = dijkstra(s, len(g), g)
for i in range(1, n):
    res = inf
    for j in range(mx):
        res = min(res, dist[i*mx+j])
    print(res)



### FIXED CODE ###

import heapq
inf = 10**18
def dijkstra(s, n, G):#スタート, 頂点数, グラフ:[[(cost, v)], ...]
    dist = [inf]*n
    edges = []#(sからvまでのコストの候補, v)
    dist[s] = 0
    for e in G[s]:
        heapq.heappush(edges, e)
    while edges:
        cost, v = heapq.heappop(edges)
        if dist[v] != inf:
            continue
        dist[v] = cost
        for c, nv in G[v]:
            if dist[nv] == inf:
                heapq.heappush(edges, (cost + c, nv))
    return dist
mx = 5005
n, m, s = map(int, input().split())
g = [[] for _ in range(n*mx)]
for i in range(m):
    u, v, a, b = map(int, input().split())
    u-=1
    v-=1
    for j in range(mx):
        if j>=a:
            g[u*mx+j].append((b, v*mx+j-a))
            g[v*mx+j].append((b, u*mx+j-a))
for i in range(n):
    c, d = map(int, input().split())
    for j in range(mx-c):
        g[i*mx+j].append((d, i*mx+j+c))
dist = dijkstra(min(s, mx-1), len(g), g)
for i in range(1, n):
    res = inf
    for j in range(mx):
        res = min(res, dist[i*mx+j])
    print(res)
X,Y,A,B,C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort()
q.sort()
r.sort()
a = 0
while X>0:
    if p==[]:
        p[0] = 0
    if r==[]:
        r[0] = 0
    if p[-1] > r[-1]:
        a += p.pop()
    else:
        a += r.pop()
    X -= 1
while Y>0:
    if q==[]:
        q[0] = 0
    if r==[]:
        r[0] = 0
    if q[-1] > r[-1]:
        a += q.pop()
    else:
        a += r.pop()
    Y -= 1
print(a)

### FIXED CODE ###

X,Y,A,B,C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
a = sorted(p)[A-X:]+sorted(q)[B-Y:]+r
print(sum(sorted(a)[C:]))
h, k = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(k)]
dp = [0 for i in range(h+1)]
for i in range(1, h+1):
    dp[i] = min(dp[i - a]+b for a,b in ab)
print(dp[h])

### FIXED CODE ###

h, k = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(k)]
maxa = max(a for a,b in ab)
dp = [0 for i in range(h+maxa)]
for i in range(1, h+maxa):
    dp[i] = min(dp[i - a]+b for a,b in ab)
print(min(dp[h:]))
x=int(input())
print(int(math.ceil(360/x)))

### FIXED CODE ###

from math import *
from copy import *
from string import *				# alpha = ascii_lowercase
from random import *
from sys import stdin,stdout
from sys import maxsize
from operator import *				# d = sorted(d.items(), key=itemgetter(1))
from itertools import *
from collections import Counter		# d = dict(Counter(l))
import math
import math
import time
from queue import Queue
# PradeepGhosh_2017076

def seive(n):
	l=[True]
	l=l*(n+1)
	for i in range(2,int(sqrt(n))+1):
		if(l[i]==True):
			val=i*i
			while(val<len(l)):
				l[val]=False
				val+=i
	prime=[]
	for i in range(2,len(l)):
		if(l[i]==True):
			prime.append(i)
	return prime

def dp(l,i,n,val,ans):
	if(i>=n or val<0):
		return 1000000
	elif(val==0):
		return 0
	else:
		if(ans[i]==1000000):
			ans[i]=min(min(1+dp(l,i+1,n,val-l[i],ans),1+dp(l,i,n,val-l[i],ans)),dp(l,i+1,n,val,ans))
		return ans[i]
from queue import Queue
def factors(n):
	l=[]
	for i in range(1,int(sqrt(n))+1):
		if(n%i==0):
			if(n//i==i):
				l.append(i)
			else:
				l.append(i)
				l.append(n//i)
	return l
def check1(s,v,x):
	while(True):
		if(v not in s):
			return v
		else:
			v-=1
def check2(s,v,x):
	while(True):
		if(v not in s):
			return v
		else:
			v+=1

if __name__ == '__main__':
	# l=seive(1000000)
	# s=set(l)
	# t=int(input())
	# for i in range(t):
	# 	n=int(input())
	# 	if(n==2):
	# 		print(1)
	# 	else:
	# 		if(n in s):
	# 			n=n-1
	# 		j=n-1
	# 		while(j>0):
	# 			if(n%j==0):
	# 				break
	# 			j-=1
	# 		print(j)
	x=int(input())
	c=0
	ans=0
	while(ans!=360):
		ans+=x
		if(ans>360):
			ans-=360
		c+=1
	print(c)
n=int(input())
L=input()
S=input()
T=[]
i=0
while n-2>=i:
	if L[i]==L[i+1]:
		T.append(0)
		i+=2
	else:
		T.append(1)
		i+=1

def f(x,y):
	if x==0 and y==1:
		return 1
	if x==0 and y==0:
		return 3
	if x==1 and y==1:
		return 2
	if x==1 and y==0:
		return 2
if T[0]==0:
	ans=3
else:
	ans=6


for i in range(len(T)-1):
	ans=ans*f(T[i],T[i+1])

print(ans)


			


### FIXED CODE ###

n=int(input())
L=input()+'?'
S=input()
T=[]
i=0


while n-1>=i:
	if L[i]==L[i+1]:
		T.append(0)
		i+=2
	else:
		T.append(1)
		i+=1

        
def f(x,y):
	if x==0 and y==1:
		return 1
	if x==0 and y==0:
		return 3
	if x==1 and y==1:
		return 2
	if x==1 and y==0:
		return 2
if T[0]==0:
	ans=6
else:
	ans=3
mod = 10**9 + 7
for i in range(len(T)-1):
	ans=ans*f(T[i],T[i+1])
	ans=ans%mod
print(ans)
w,h,x,y=map(int,input().split())
area=w*h
if x!=0:
    if (y/x)*w>=h:
        ax=(h/y)*x
        if ((y-h)/x)*w+h>=0:
            ayy=((y-h)/x)*w+h
            axx=((x-w)*w)/y+w
            if y!=h:
                ay=((y-h)/(w-x))*w+h
                lst=[min(area-((w-axx)*h)/2,((w-axx)*h)/2),min(area-((h-ayy)*w)/2,((h-ayy)*w)/2),min(area-h*x,h*x),min(area-w*y,w*y),min(area-(ax*h)/2,(ax*h)/2),min(area-(ay*w)/2,(ay*w)/2)]
                ans=max(lst)
                if lst.count(ans)==1:
                    f=0
                else:
                    f=1
            else:
                lst=[min(area-((w-axx)*h)/2,((w-axx)*h)/2),min(area-h*x,h*x),min(area-(ax*h)/2,(ax*h)/2)]
                ans=max(lst)
                if lst.count(ans)==1:
                    f=0
                else:
                    f=1
        else:
            axx=(h*x)/(h-y)
            ayy=(w*y)/(w-y)
            ay=((y-h)/(w-x))*w+h
            lst=[min(area-(w*ayy)/2,(w*ayy)/2),min(area-(axx*h)/2,(axx*h)/2),min(area-h*x,h*x),min(area-w*y,w*y),min(area-(ax*h)/2,(ax*h)/2),min(area-(ay*w)/2,(ay*w)/2)]
            ans=max(lst)
            if lst.count(ans)==1:
                f=0
            else:
                f=1
    else:
        ay=(w*y)/x
        if ((y-h)/x)*w+h>=0:
            axx=((x-w)*w)/y+w
            ayy=((y-h)/x)*w+h
            if x!=w:
                ax=((w-x)/(y-h))*h+w
                lst=[min(area-((w-axx)*h)/2,((w-axx)*h)/2),min(area-((h-ayy)*w)/2,((h-ayy)*w)/2),min(area-h*x,h*x),min(area-w*y,w*y),min(area-(ay*w)/2,(ay*w)/2),min(area-((w-ax)*h)/2,((w-ax)*h)/2)]
                ans=max(lst)
                if lst.count(ans)==1:
                    f=0
                else:
                    f=1
            else:
                lst=[min(area-((h-ayy)*w)/2,((h-ayy)*w)/2),min(area-w*y,w*y),min(area-(ay*w)/2,(ay*w)/2)]
                ans=max(lst)
                if lst.count(ans)==1:
                    f=0
                else:
                    f=1
        else:
            axx=(h*x)/(h-y)
            ayy=(w*y)/(w-y)
            ax=((w-x)/(y-h))*h+w
            lst=[min(area-(w*ayy)/2,(w*ayy)/2),min(area-(axx*h)/2),min(area-(axx*h)/2,(axx*h)/2),min(area-h*x,h*x),min(area-w*y,w*y),min(area-(ay*w)/2,(ay*w)/2),min(area-((w-ax)*h)/2,((w-ax)*h)/2)]
            ans=max(lst)
            if lst.count(ans)==1:
                f=0
            else:
                f=1
else:
    lst=[min(area-w*y,w*y),min(((h-y)*w)/2,area-((h-y)*w)/2),min(area-(y*w)/2,(y*w)/2)]
    ans=max(lst)
    if lst.count(ans)==1:
        f=0
    else:
        f=1
print(ans,f)
        


### FIXED CODE ###

w,h,x,y=map(int,input().split())
if (x==w/2) and (y==h/2):
    print((w*h)/2,1)
else:
    print((w*h)/2,0)
def main():
    n = int(input())
    friendliness = [int(x) for x in input().split()]
    friendliness.sort(reversed=True)
    ans = 0
    for i in range(n):
        ans += friendliness[i // 2 + 1]
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

from collections import deque


def main():
    n = int(input())  # n
    friendliness = [int(x) for x in input().split()]
    friendliness.sort()
    friendliness = deque(friendliness)
    edges = deque()
    popped = friendliness.pop()
    edges.append(popped)
    ans = 0
    counter = 0
    while friendliness:
        ans += edges.popleft()
        counter += 1
        popped = friendliness.pop()
        edges.append(popped)
        edges.append(popped)
    print(ans)


if __name__ == '__main__':
    main()
n = int(input())
print(2*n*math.pi)

### FIXED CODE ###

n = int(input())
print(2*n*3.14159264)
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n, t = list(map(int, readline().split()))
    ls = [0] * (200 + 1)
    ab = []
    mt = 0
    for i in range(n):
        a, b = list(map(int, readline().split()))
        mt = max(mt, a)
        ab.append([a, b])
        for j in range(t, -1, -1):
            ls[j + a] = max(ls[j + a], ls[j] + b)
    print(max(ls[:t+mt]))


if __name__ == '__main__':
    solve()


### FIXED CODE ###

import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n, t = list(map(int, readline().split()))
    ab = [list(map(int, readline().split())) for _ in range(n)]
    ab.sort()
    dp = [0] * (t + 1)
    for a, b in ab:
        dp[-1] = max(dp[-1], dp[-2] + b)
        for i in range(t - a - 1, -1, -1):
            dp[i + a] = max(dp[i + a], dp[i] + b)
    print(dp[-1])


if __name__ == '__main__':
    solve()
N = int(input())
print("Yes" if N[0]==N[2] else "No")

### FIXED CODE ###

N = input()
print("Yes" if N[0]==N[2] else "No")
n, k = map(int, input().strip().split())
p = list(map(int, input().strip().split()))

def calc_exp(n):
    exp=1+(n-1)*0.5
    return exp

tmp=sum(p[:k])
mx=tmp
for i in range(1,n-k+1):
    # tmp=sum(p[i:i+k])
    tmp-=p[i-1]
    tmp+=p[i+k-1]
    if mx<tmp:
        ind=i
        mx=tmp
        
ans=0
for i in range(k):
    ans+=1+(p[ind+i]-1)*0.5
    
print(ans)

### FIXED CODE ###

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

def calc_exp(n):
    exp=1+(n-1)*0.5
    return exp

tmp=sum(p[:k])
mx=tmp
ind=0
for i in range(1,n-k+1):
    # tmp=sum(p[i:i+k])
    tmp-=p[i-1]
    tmp+=p[i+k-1]
    if mx<tmp:
        ind=i
        mx=tmp
        
ans=0
for i in range(k):
    ans+=1+(p[ind+i]-1)*0.5
    
print(ans)
x = int(input())
y = int(input())

print( x + y * 0.5)


### FIXED CODE ###

x, y = map(int, input().split())
print(int(x + y / 2))
a,b,c=map(int,input().split())
for i in range(1, b+1):
  a%b * i % b == c:
    print("YES")
    break
else:
  print("NO")

### FIXED CODE ###

a,b,c=map(int,input().split())
for i in range(1, b+1):
  if a%b * i % b == c:
    print("YES")
    break
else:
  print("NO")
a,b= input().split()
print a*b, 2*(a+b)

### FIXED CODE ###

a,b=map(int,raw_input().split()) #korenazo
print a*b , 2*(a+b)
N = int(input())
a = [int(i) for i in input().split()]
c = [0,0,0]
for h in range(len(a)):
    n = a[h]
    a[h] = c.count(n)
    c[c.index(n)] += 1
# print(a)
# print(c)
c = 1
for n in a:
    c *= n%1000000007
print(c%1000000007)

### FIXED CODE ###

N = int(input())
a = [int(i) for i in input().split()]
c = [0,0,0]
pos = True
for h in range(len(a)):
    try:
        n = a[h]
        a[h] = c.count(n)
        c[c.index(n)] += 1
    except:
        pos = False
        break
# print(a)
# print(c)
if pos:
    c = 1
    for n in a:
        c *= n%1000000007
    print(c%1000000007)
else:
    print(0)
import sys
import math
from collections import defaultdict, deque
from heapq import heappush, heappop


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


# A
def A():
    return


# B
def B():
    return


# C
def C():
    n = I()
    for i in range(int(n ** 0.5), 0, -1):
        if n % i == 0:
            print(i + n // i - 2)
            return
    return


# D
def D():
    a,b,x=LI()
    if (x <= a**2*b/2):
        print(math.degrees(math.atan(x/a/b/b)))
    else:
        print(math.degrees(math.atan(a**3/(a**2*b-x))))
    return


# E
def E():
    return


# F
def F():
    return


# Unittest
def resolve():
    D()
    return


# Solve
if __name__ == "__main__":
    D()


### FIXED CODE ###

import sys
import math
from collections import defaultdict, deque
from heapq import heappush, heappop


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


# A
def A():
    return


# B
def B():
    return


# C
def C():
    n = I()
    for i in range(int(n ** 0.5), 0, -1):
        if n % i == 0:
            print(i + n // i - 2)
            return
    return


# D
def D():
    a, b, x = LI()
    if (x <= a * a * b / 2):
        print(math.degrees(math.atan(a * b * b / x / 2)))
    else:
        print(math.degrees(math.atan(2 * (a * a * b - x) / a ** 3)))
    return


# E
def E():
    return


# F
def F():
    return


# Unittest
def resolve():
    D()
    return


# Solve
if __name__ == "__main__":
    D()
n=int(input())
x=input()
p=x.count("1")
Ma=[1]+[0]*(n-1)
Mb=[1]+[0]*(n-1)
for i in range(1,n):
  Ma[i]=Ma[i-1]*2%(p-1)
  Mb[i]=Mb[i-1]*2%(p+1)
Sa=Sb=0
for i in range(n):
  if x[i]=="1":
    Sa+=Ma[n-1-i]
    Sb+=Mb[n-1-i]
for i in range(n):
  a=1
  if x[i]=="1":
    s=(Sa-Ma[n-1-i])%(p-1)
  else:
    s=(Sb+Mb[n-1-i])%(p+1)
  while(s>0):
    t=0
    r=s
    while(r>0):
      t+=r&1
      r//=2
    s%=t
    a+=1
  print(a)  

### FIXED CODE ###

n=int(input())
x=input()
p=x.count("1")
Ma=[1]+[0]*(n-1)
Mb=[1]+[0]*(n-1)
for i in range(1,n):
  if p>1:
    Ma[i]=Ma[i-1]*2%(p-1)
  else:
    Ma[i]=0
    Ma[0]=0
  Mb[i]=Mb[i-1]*2%(p+1)
Sa=Sb=0
for i in range(n):
  if x[i]=="1":
    Sa+=Ma[n-1-i]
    Sb+=Mb[n-1-i]
for i in range(n):
  a=0
  if x[i]=="1":
    if p==1:
      s=0
    else:
      s=(Sa-Ma[n-1-i])%(p-1)
      a+=1
  else:
    s=(Sb+Mb[n-1-i])%(p+1)
    a+=1
  while(s>0):
    t=0
    r=s
    while(r>0):
      t+=r&1
      r//=2
    s%=t
    a+=1
  print(a)
def resolve():
    import sys

    input = lambda: sys.stdin.readline().rstrip()

    a, b, c, k = map(int,input().split())
    
    if a <= k:
      print(k)
      sys.exit()

    arr = [1] * a + [0] * b + [-1] * c

    print(sum(arr[0:k]))

resolve()

### FIXED CODE ###

def resolve():
    import sys

    input = lambda: sys.stdin.readline().rstrip()

    a, b, c, k = map(int,input().split())
    
    if a >= k:
      print(k)
    elif a + b >= k:
      print(a)
    else:
      print(a-(k-(a+b)))
      
resolve()
def solve(n, a):
    for i in range(n-1):
        if a[i] == a[i+1]:
            return "NO"
    return "YES"

n = int(input())
a = list(map(int, input().split()))
print(solve(n, a))

### FIXED CODE ###

def solve(n, a):
    return "YES" if len(set(a)) == n else "NO"

n = int(input())
a = list(map(int, input().split()))
print(solve(n, a))
s = input()
n = len(s)
a = s[:(n-1)//2-1]
b = s[-(n+3)//2:]
e = s[
t = s[::-1]
c = t[:(n-1)//2-1]
d = t[-(n+3)//2:]
if (a==b) and (b==c) and (c==d):
  print('Yes')
else:
  print('No')


### FIXED CODE ###

s = input()
n = len(s)
a = s[:(n-1)//2]
b = s[(n+3)//2-1:]

t = s[::-1]
c = t[:(n-1)//2]
d = t[(n+3)//2-1:]
if (a==b) and (b==c) and (c==d) and (d==a):
  print('Yes')
else:
  print('No')
a, b = map(int,input())
if (a*b) % 2 != 0:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

a, b = map(int,input().split())
if (a*b) % 2 != 0:
    print('Yes')
else:
    print('No')
s = input()
count = 0
if s[0] == '1':
  count += 1
if s[1] == '1':
  count += 1
if s[2] == '1':
  count += 1

return count

### FIXED CODE ###

s = input()
count = 0
if s[0] == '1':
  count += 1
if s[1] == '1':
  count += 1
if s[2] == '1':
  count += 1

print(count)
Q = int(input())
mod = int(1e+6 + 3)
def gcd(a, b):
  p, q = a, b
  while q != 0:
    a, b = b, a % b
  return a
def doublestep(a):
  li = []
  while a != 0:
    li = [a%2] + li[:]
    a //= 2
  return li
def doubling(z, num):
  y = doublestep(num)
  tet = 1
  for i in range(len(y)):
    if y[i] == 1:
      tet *= z
      tet %= mod
    if i != len(y) - 1:
      tet *= tet
      tet %= mod
  return tet
modi = doublestep(mod-2)
def inved(s):
  y = 1
  for i in range(len(modi)):
    if modi[i] == 1:
      y *= s
      y %= mod
    if i != len(modi) - 1:
      y *= y
      y %= mod
  return y

frac = [1]
for i in range(2 * mod):
  frac.append((frac[i]*(i+1))%mod)
for i in range(Q):
  x, d, n = map(int, input().split())
  if x == 0:
    print(0)
  else:
    if d == 0:
      print(doubling(x, n))
    else:
      if n >= mod:
        print(0)
      else:
        dn = doubling(d, n)
        xinvd = x * inved(d, mod - 2) - 1
        xinvd %= mod
        print((dn * frac[xinvd + n] * inved(frac[xinvd])) % mod)

### FIXED CODE ###

Q = int(input())
mod = int(1e+6 + 3)

def doubling(n, m):
  y = 1
  p = n
  while m != 0:
    if m % 2 == 1:
      y *= p
      y %= mod
    m //= 2
    p *= p
    p %= mod
  return y

def inved(s):
  x, y, u, v, k, l = 1, 0, 0, 1, s, mod
  while l != 0:
    x, y, u, v = u, v, x - u * (k // l), y - v * (k // l)
    k, l = l, k % l
  return x % mod

frac = [1 for _ in range(mod+1)]
invf = [1 for _ in range(mod+1)]
invf[mod] = 0
for i in range(mod):
  frac[i+1] = (frac[i] * (i+1)) % mod
invf[mod-1] = inved(frac[mod-1])
for i in range(mod-1, 0, -1):
  invf[i-1] = (invf[i] * i) % mod

for i in range(Q):
  x, d, n = map(int, input().split())
  if x == 0:
    print(0)
  else:
    if d == 0:
      print(doubling(x, n))
    else:
      if n >= mod:
        print(0)
      else:
        xinvd = x * inved(d) - 1
        xinvd %= mod
        if xinvd + n >= mod:
          print(0)
        else:
          dn = doubling(d, n)
          print((dn * frac[xinvd + n] * invf[xinvd]) % mod)
N=int(input())
T = list(map(int, input().split()))
A = list(map(int, input().split()))
a = 1
if T[0]>A[0] or A[-1]>T[-1] or T[-1]!=A[-1]:
    a*=0
for i in range(1,n):
    if T[i-1]!=T[i]:
        if T[i]>A[i]:
            a*=0
            break
        else:
            a*=1
    if A[i]!=A[i+1]:
        if T[i]<A[i]:
            a*=0
            break
        else:
            a*=1
    else:
        a=a*(min(T[i],A[i]))%(10**9+7)
print(a)

### FIXED CODE ###

N=int(input())
T = list(map(int, input().split()))
A = list(map(int, input().split()))
a = 1
if T[0]>A[0] or A[-1]>T[-1] or T[-1]!=A[0]:
    a*=0
for i in range(1,N-1):
    if T[i-1]!=T[i]:
        if T[i]>A[i]:
            a*=0
            break
        else:
            a*=1
            continue
    if A[i]!=A[i+1]:
        if T[i]<A[i]:
            a*=0
            break
        else:
            a*=1
            continue
    a=(a*min(T[i],A[i]))%(10**9+7)
print(a)
a=input()

x=a+(a*a)+(a*a*a)

print(x)


### FIXED CODE ###

a=int(input())

a=a+(a*a)+(a*a*a)

print(a)
a=list(map(int, input().split()))
if a[0]+a[1]>=a[2]＊2:
    if a[3]>=a[4]:
        print max(2＊a[3]＊a[2], (a[2]＊a[4]＊2+a[0]＊(a[3]-a[4])))
    else:
        print max(2＊a[4]＊a[2], (a[2]＊a[3]＊2+a[1]＊(a[4]-a[3])))
else:
    print (a[0]＊a[3]+a[1]＊a[4])


### FIXED CODE ###

a, b, c, x, y = map(int, input().split())
res = 0
if a+b > c*2:
    mi = min(x, y)
    res += c*2 * mi
    x -= mi
    y -= mi
res += x * min(a, c*2)
res += y * min(b, c*2)
print(res)
# C
import math

A, B, C, D = map(int, input().split())

num = B-A+1
if A%C==0:
    x=A
else:
    x = A-A%C+C
if B%C==0:
    y=B
else:
    y = B-B%C
C_multi = (y-x)//C+1
# print(x)
# print(y)
# print(C_multi)

if A%D==0:
    x=A
else:
    x = A-A%D+D
if B%D==0:
    y=B
else:
    y = B-B%D
D_multi = (y-x)//D+1
# print(x)
# print(y)
# print(D_multi)

E = C * D / math.gcd(C,D)
if A%E==0:
    x=A
else:
    x = A-A%E+E
if B%E==0:
    y=B
else:
    y = B-B%E
E_multi = (y-x)//E+1

print(int(num-C_multi-D_multi+E_multi))


### FIXED CODE ###

#!/usr/bin/env python3

from fractions import gcd

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


def calc(min_, max_, div_num):
    if (min_ % div_num) != 0:
        min_ = min_ - (min_ % div_num)+div_num

    if min_ > max_:
        return 0
    return (max_-min_)//div_num+1


# print(calc(a, b, c))
# print(calc(a, b, d))
# print(calc(a, b, c*d//gcd(c, d)))
print((b-a+1)-(calc(a, b, c)+calc(a, b, d)-calc(a, b, c*d//gcd(c, d))))
S=input()
p = a
for s in S:
  if p == s:
    p = a
    break
  else:
    p = s
print("Bad" if p == a else "Good")

### FIXED CODE ###

S=input()
p = 'a'
for s in S:
  if p == s:
    p = 'a'
    break
  else:
    p = s
print("Bad" if p == 'a' else "Good")
S=list(input())
S[3]=8
print("".join(S))

### FIXED CODE ###

S=list(input())
S[3]="8"
print("".join(S))
N, Q = map(int,input().split())
tree = [[0] for i in range(N+1)]
for i in range(N-1):
    a,b = map(int,input().split())
    if tree[a] == [0]:
        tree[a] = [b]
    else:
        tree[a].append(b)
counter = [0 for i in range(N+1)]
def dfs(p,x):
    if p == 0:
        return
    counter[p] += x
    for i in tree[p]:
        dfs(i,x)   
    
for i in range(Q):
    p,x = map(int,inupt().split())
    dfs(p,x)
counter = [str(i) for i in counter]
ans = ' '.join(counter[1:])
print(ans)

### FIXED CODE ###

import sys
def input():
    return sys.stdin.readline()[:-1]
 
n,q = map(int, input().split())
#長さn個のリストを入れ子にしたリストの作成：adj
adj = [[] for i in range(n)]
 
#adjに繋がっている要素を上流下流関わらず全て加える。
for j in range(n-1):
    a,b=map(int, input().split())
    adj[a-1].append(b-1)
    adj[b-1].append(a-1) 
 
#加算する値を合計したリストの作成
queries = [0 for i in range(n)]
for j in range(q):
    p, x = map(int, input().split())
    queries[p-1] += x
 
ans = [0 for i in range(n)]
 
#aの値，直前の値，直前のaの値
st = [(0, 0, -1)] 
 
#つながってる奴の一番後ろから処理していく。
#０スタート→1,2繋がってるなら2にいく。2に3が繋がってるなら次は3。
#3に繋がってるのがなければ1に戻る。
#この際，aの直前の値をタプルで保持したままリストに挿入して保管しておく。
while st:
    #stの先頭を取り出す。初期値は末尾のため-1
    l = st.pop()  
    ans[l[0]] = l[1] + queries[l[0]]
    for v in adj[l[0]]:
        if v != l[2]:
            st.append((v, ans[l[0]], l[0]))
 
print(*ans)