Harryxun/stf_run huggingface dataset:
t = [int(input()) for i in range(5)]
r = [x%10 for x in t]
if all(x%10==0 for x in r):
  print(sum(t))
else:
  y = sorted(set(r))[1]
  print(sum(x if x%10==0 else 10*(1+x//10) for x in t) -10+y)

### FIXED CODE ###

t = [int(input()) for i in range(5)]
r = [x%10 for x in t]
if all(x==0 for x in r):
  print(sum(t))
else:
  y = min(set(r)-{0})
  print(sum(x if x%10==0 else 10*(1+x//10) for x in t) -10+y)
n,k=map(int,input().split())
a=list(map(int,input().split()))
if n==k:
    print(1)
else:
    ans=0
    cnt=k
    for i in range(2,n):
        cnt+=(k-1)
        if cnt>=n:
            ans=i
            break
    print(ans)

### FIXED CODE ###

s=list(input())
ans=0
for i in range(4):
    if s[i]=='+':
        ans+=1
    else:
        ans-=1
print(ans)
s=input()
X,Y=map(int,input().split())
import copy
def solve(a,G):

    amax=0
    for i in a:
        amax+=abs(i)
    if amax==0:
        if G==0:
            return True
        else:
            return False

    dp=[[0]*2*amax for _ in range(3)]
    dp[0][a[0]]=1
    for i in range(1,len(a)):
        p=a[i]
        for j in range(-amax,amax):
            dp[i%3][j-p]+=dp[(i-1)%3][j]
            dp[i%3][j+p]+=dp[(i-1)%3][j]
            #print(dp)
        if dp[i][G]>=1:
            return True
    return False
    """#print(a)
    dp=set()
    dp.add(a[0])
    dp2=set()
    for i in range(1,len(a)):
        for j in dp:
            dp2.add(j-a[i])
            dp2.add(j+a[i])
        dp=copy.deepcopy(dp2)
    #print(dp)
    if G in dp:
        return True
    return False"""

x=[]
y=[0]
flg=1
cnt=0
"""if s[0]=="T":
    x.append(0)"""
for i in range(len(s)):
    if s[i]=="F":
        cnt+=1
    else:
        if flg==1:
            x.append(cnt)
            flg*= -1
            cnt=0
        else:
            y.append(cnt)
            flg*= -1
            cnt=0
if flg==1:
    x.append(cnt)
else:
    y.append(cnt)
#print(x)
#print(y)

if solve(x,X) and solve(y,Y):
    print("Yes")
else:
    print("No")


### FIXED CODE ###

s=input()
X,Y=map(int,input().split())
from collections import defaultdict
def solve(da,dp,G):
    for i in range(len(da)):
        tmp=set()
        for j in dp:
            tmp.add(j-da[i])
            tmp.add(j+da[i])
        dp=tmp
    if G in dp:
        return True
    else:
        return False
    """amax=0
    for i in a:
        amax+=abs(i)
    if amax==0:
        if G==0:
            return True
        else:
            return False
    if a[0]==G:
        return True
    dp=[[0]*2*amax for _ in range(3)]
    dp[0][a[0]]=1
    for i in range(1,len(a)):
        p=a[i]
        for j in range(-amax,amax):
            dp[i%3][j-p]+=dp[(i-1)%3][j]
            dp[i%3][j+p]+=dp[(i-1)%3][j]
            #print(dp)
        if dp[i%3][G]>=1:
            return True
    return False"""
    """#print(a)
    dp=set()
    dp.add(a[0])
    dp2=set()
    for i in range(1,len(a)):
        for j in dp:
            dp2.add(j-a[i])
            dp2.add(j+a[i])
        dp=copy.deepcopy(dp2)
    #print(dp)
    if G in dp:
        return True
    return False"""

d=[len(x) for x in s.split("T")]

dx=d[2::2]
dy=d[1::2]

if solve(dx,{d[0]},X) and solve(dy,{0},Y):
    print("Yes")
else:
    print("No")
MAX = 50001

is_prime = [True for _ in range(MAX)]
is_prime[0] = is_prime[1] = False
for i in range(2, int(MAX ** (1 / 2)) + 1):
  if is_prime[i]:
    for j in range(i ** 2, MAX, i):
      is_prime[j] = False

primes = [i for i in range(MAX) if is_prime[i]]

def main():
  while True:
    n = int(input())
    if not n:
      break
    
    ans = 0
    for i in primes_less_than_n:
      if is_prime[n - i]:
        ans += 1
  
    print(ans)

main()


### FIXED CODE ###

MAX = 50001

is_prime = [True for _ in range(MAX)]
is_prime[0] = is_prime[1] = False
for i in range(2, int(MAX ** (1 / 2)) + 1):
  if is_prime[i]:
    for j in range(i ** 2, MAX, i):
      is_prime[j] = False

primes = [i for i in range(MAX) if is_prime[i]]

def main():
  while True:
    n = int(input())
    if not n:
      break
        
    ans = 0
    for i in primes:
      if i > n // 2:
        break
      if is_prime[n - i]:
        ans += 1
  
    print(ans)

main()
(AC)
s=input()
l=len(s)
mod = pow(10,9)+7

dp = [[0 for _ in range(13)] for _ in range(l+1)]
dp[0][0] = 1
keta = 1

for i in range(1,l+1):
	num = s[-i]
	if num == '?':
		for j in range(10):
			for k in range(13):
				dp[i][(j * keta + k) % 13] += dp[i-1][k] % mod
	else:
		num = int(num)
		for k in range(13):
			dp[i][(num * keta + k) % 13] += dp[i-1][k] % mod
	keta = keta*10  % 13
print(dp[l][5] % mod)

### FIXED CODE ###

INF = 10 ** 9 + 7

S = input()
# dp[i][j]はうしろからi桁を13で割った余りがjであるものの個数
dp = [[0] * 13 for _ in range(len(S) + 1)]
dp[0][0] = 1
mul = 1

for i in range(len(S)):
    x = S[-(i + 1)]
    if x == "?":
        for k in range(10):
            for j in range(13):
                dp[i + 1][(mul * k + j) % 13] += dp[i][j]
                dp[i + 1][(mul * k + j) % 13] %= INF
    else:
        k = int(x)
        for j in range(13):
            dp[i + 1][(mul * k + j) % 13] += dp[i][j]
            dp[i + 1][(mul * k + j) % 13] %= INF
    mul = mul * 10 % 13  # 計算量削減のためここで13で割っている

print(dp[len(S)][5])
A, B, C = map(int, input().split())

print(s = C-(A-B) if C-(A-B) > 0 else 0)

### FIXED CODE ###

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

s = C-(A-B)
print(s if C-(A-B) > 0 else 0)
import math

def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
  
N, K = map(int, input().split())
s = (10 ** 9) + 7
n = N - K + 1

for i in range(1, K+1):
  S = (i * comb(n, i) * comb(K, i)) // K
  print(S % s)

### FIXED CODE ###

import math

def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
  
N, K = map(int, input().split())
s = (10 ** 9) + 7
n = N - K + 1

if N >= 2 * K -1:
  for i in range(1, K+1):
    S = (i * comb(n, i) * comb(K, i)) // K
    print(S % s)
else:
  for i in range(1, N-K+2):
      S = (i * comb(n, i) * comb(K, i)) // K
      print(S % s)
  for i in range(N-K+2, K+1):
      print(0)
n = int(input())
l = list(map(int,input(),split())

if max(l) < sum(l)-max(l):
    print('Yes')
else:
    print('No')

### FIXED CODE ###

N = int(input())
l = list(map(int, input().split()))
if 2 * max(l) < sum(l):
  print("Yes")
else:
  print("No")
import math
r = int(input())
print('%.7f %.7f' % (r * r * math.pi, 2 * r * math.pi))

### FIXED CODE ###

import math
r = float(input())
print('%.7f %.7f' % (r * r * math.pi, 2 * r * math.pi))
N,M=map(int,input().split())
S=(range(1,M+1))
for i in range(N):
    K,*A=map(int,input().splirt())
    S&=set(A)
print(len(S))

### FIXED CODE ###

N,M=map(int,input().split())
S=set(range(1,M+1))
for i in range(N):
    K,*A=map(int,input().split())
    S&=set(A)
print(len(S))
S = input()
listw = [ "Sunny", "Cloudy", "Rainy" ]
ind = listw.index( S )
listw = listw.append( "Sunny" )
print( listw[ind+1] ) 


### FIXED CODE ###

S = input()
listw = [ "Sunny", "Cloudy", "Rainy" ]
ind = listw.index( S )
if ind == 2 : 
   ind = -1
print( listw[ind+1] )
import math
from functools import reduce



def gcd_list(numbers):
    return reduce(math.gcd, numbers)


N = input()
A = input().split()
for i in range(len(A)):
    A[i] = int(A[i])
answer = gcd_list(A)
print("{}".format(answer))

### FIXED CODE ###

from functools import reduce

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def gcd_list(numbers):
    return reduce(gcd, numbers)


N = input()
A = input().split()
for i in range(len(A)):
    A[i] = int(A[i])
answer = gcd_list(A)
print("{}".format(answer))
r,g,b=map(int,input().split())
print('YES' if (10*g+b)%4=0 else 'NO')


### FIXED CODE ###

r, g, b = map(int, input().split())
if (g * 10 + b) % 4 == 0:
  print("YES")
else:
  print("NO")
import math
A, B, C, D = map(int, input().split())
G = C * D // math.gcd(C, D)
ag = (A - 1) // G
ac = (A - 1) // C
ad = (A - 1) // D
bg = B // G
bc = B // C
bd = B // D
print((B - A + 1) - ((bc + bd - bg) - (ac + ad - ag)))


### FIXED CODE ###

import fractions
A, B, C, D = map(int, input().split())
G = C * D // fractions.gcd(C, D)
ag = (A - 1) // G
ac = (A - 1) // C
ad = (A - 1) // D
bg = B // G
bc = B // C
bd = B // D
print((B - A + 1) - ((bc + bd - bg) - (ac + ad - ag)))
import math

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


def lcm(x, y):
    return x * y / gcd(x, y)


def gcd(x, y):
    r = x % y
    while r != 0:
        x = y
        y = r
        r = x % y
    return r


def cantdiv(x):
    return x - math.floor(x / c) - math.floor(x / d) + math.floor(x / lcm(c, d))


print(cantdiv(b) - cantdiv(a - 1))


### FIXED CODE ###

from fractions import gcd

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


def lcm(x, y):
    if gcd(x, y) == 0:
        return x * y
    return x * y // gcd(x, y)


def cantdiv(x):
    return x - x // c - x // d + x // lcm(c, d)


print(cantdiv(b) - cantdiv(a - 1))
import functools
# import math
import fraction
N = int(input())
A = list(map(int, input().split()))
# ans = functools.reduce(math.gcd, A)
ans = functools.reduce(fraction.gcd, A)
print(ans)


### FIXED CODE ###

import functools
# import math
import fractions
N = int(input())
A = list(map(int, input().split()))
# ans = functools.reduce(math.gcd, A)
ans = functools.reduce(fractions.gcd, A)
print(ans)
s,w=map(int,input().split())
if(s<w) 
  print("unsafe")
else
  print("safe")

### FIXED CODE ###

s,w=map(int,input().split())
if s>w: 
	print("safe")
else:
	print("unsafe")
# -*- coding: utf-8 -*-
import sys

N, M = map(int, input().split())
a = [int(input()) for x in range(M)]

def calc_routes(dan):
    tmp = 1
    for i in range(int(dan/2)):
        i += 1
        n = dan - i
        tmp2 = 1
        for j in range(i):
            tmp2 *= n - j
        for j in range(i):
            tmp2 /= j + 1
        tmp += tmp2

    return tmp

routes = 1
prev = 0
for x in a:
    if x - prev == 0:
        routes = 0
        break
    else:
        x -= 1
        dan = x - prev
        routes = (routes * calc_routes(dan)) % 1000000007
        prev = x+2

routes = (routes * calc_routes(N-prev)) % 1000000007
print(int(routes))

### FIXED CODE ###

# -*- coding: utf-8 -*-
from math import factorial

N, M = map(int, input().split())
a = [int(input()) for x in range(M)]

def fibo(dan):
    tmp = [1, 1]
    for i in range(2, dan+1):
        tmp.append(tmp[i-1] + tmp[i-2])
    return tmp[dan]

routes = 1
prev = 0
for x in a:
    if x == prev:
        routes = 0
        break
    else:
        dan = (x-1) - prev
        routes = (routes * fibo(dan))
        prev = x+1

routes = (routes * fibo(N-prev)) % 1000000007
print(int(routes))
A = input()
ans = 1
for i in range(len(A)):
  for j in range(j,len(A)):
    if A[i] != A[j]:
      ans += 1
      
print(ans)


### FIXED CODE ###

A = input()

Alphabet = list("abcdefghijklmnopqrstuvwxyz")

N = len(A)
ans = N*(N-1)/2 + 1

for i in Alphabet:
  z = 0
  for j in range(len(A)):
    if i == A[j]:
      z+=1
  if z>1:
    ans -= z*(z-1)/2
    
print(int(ans))
A,P = map(int,input().split())
    ans = 0
     
    A = int(A)
    P = int(P)
     
    P = (A*3) + P
    ans = P // 2
     
    print(ans)
     

### FIXED CODE ###

A,P = map(int,input().split())
ans = 0

A = int(A)
P = int(P)

P = (A*3) + P
ans = P // 2

print(ans)
a,b,m=map(int, input().split())
rei=list(map(int, input().split())) 
den=list(map(int, input().split())) 
cou = [0] * m[2]
ans = []
for i in range(m[2]):
	cou[i]=list(map(int, input().split()))
	ans.append(rei[cou[i][0]-1]+den[cou[i][1]-1]-cou[i][2])
for i in range(b):
	for j in range(len(a)):
		ans.append(rei[j]+den[i])
print(min(ans))

### FIXED CODE ###

m=list(map(int, input().split()))
rei=list(map(int, input().split())) 
den=list(map(int, input().split())) 
cou = [0] * m[2]
ans = []
for i in range(m[2]):
	cou[i]=list(map(int, input().split()))
	ans.append(rei[cou[i][0]-1]+den[cou[i][1]-1]-cou[i][2])

ans.append(min(rei)+min(den))
print(min(ans))
n, m, l = (int(i) for i in input().split())
A = []
B = []
#C = [[0] * n] * l
C = [[0 for i in range(n)] for j in range(l)]

#??\?????????????????????????´?
for i in range(n):
    #swap_list = input().split()
    #A.append(swap_list)
    A.append([int(i) for i in input().split()])
for i in range(m):
    #swap_list = input().split()
    #B.append(swap_list)
    B.append([int(i) for i in input().split()])
#????????????????¨????
for i in range(n):
    for j in range(l):
        for k in range(m):
            C[i][j] += A[i][k] * B[k][j]
#?????????????????????
#for i in range(n):
#    for j in range(l):
#        print("{0}".format(C[i][j]), end="\b")
#    print("")
#for i in range(n):
#    print(" ".join(map(str, C[i][:])))
for r in C:
    print(' '.join([str(d) for d in r]))

### FIXED CODE ###

n, m, l = (int(i) for i in input().split())
A = []
B = []
C = [[0 for i in range(l)] for j in range(n)]
#??\?????????????????????????´?
for i in range(n):
    swap_list = input().split()
    A.append(swap_list)
    #A.append([int(i) for i in input().split()])
for i in range(m):
    swap_list = input().split()
    B.append(swap_list)
    #B.append([int(i) for i in input().split()])
#????????????????¨????
for i in range(n):
    for j in range(l):
        for k in range(m):
            C[i][j] += int(A[i][k]) * int(B[k][j])
#?????????????????????
#for i in range(n):
#    for j in range(l):
#        print("{0}".format(C[i][j]), end="\b")
#    print("")
for i in range(n):
    print(" ".join(map(str, C[i][:])))
#for r in C:
#    print(" ".join([str(d) for d in r]))
K = int(input())
print(50)
s, t = K//50, K%50
ANS = [ s + i for i in range(50)]
for j in range(t):
    for i in range(50):
        if j == i:
            ANS[i] += 50
        else:
            ANS[i] -= 1
print(" ".join(ANS))

### FIXED CODE ###

K = int(input())
print(50)
s, t = K//50, K%50
ANS = [ s + i for i in range(50)]
for j in range(t):
    for i in range(50):
        if j == i:
            ANS[i] += 50
        else:
            ANS[i] -= 1
print(" ".join( map( str, ANS)))
a*b = c
if c / 2 == 0:
  print('Even')
else:
  print('Odd')

### FIXED CODE ###

a,b = map(int, input(). split())
if (a*b) % 2 == 0 :
  print("Even")
else:
  print('Odd')
n=int(input())
K=int(input())
if K==1:
    counter=0
    for i in range(100):
        for j in range(1,10):
            a="0"*(i)+str(j)+"0"*(99-i)
            if 1<=int(a)<=n:
                counter+=1
    print(counter)
elif K==2:
    counter=0
    for i in range(100):
        for j in range(i+1,100):
            for k in range(1,10):
                for l in range(1,10):
                    a="0"*(i)+str(k)+"0"*(j-i-1)+str(l)+"0"*(99-j)
                    if 1<=int(a)<=n:
                        counter+=1
    print(counter)
elif K==3:
    counter=0
    for i in range(100):
        if 100-i>len(str(n)):
            pass
        elif 100-i<len(str(n)):
            for j in range(i+1,100):
                for k in range(j+1,100):
                    counter+=9*9*9
        elif 100-i==len(str(n)):
            counter+=(int(str(n)[i])-1)*((99-i)*(98-i)//2)*9*9
            for j in range(i+1,100):
                for k  in range(j+1,100):
                    for b in range(1,10):
                        for c in range(1,10):
                            pp=str(n)[i]+"0"*(j-i-1)+str(b)+"0"*(k-j-1)+str(c)+"0"*(99-k)
                            if 1<=int(pp)<=n:
                                counter+=1
    print(counter)
                    


### FIXED CODE ###

n=int(input())
K=int(input())
if K==1:
    counter=0
    for i in range(100):
        for j in range(1,10):
            a="0"*(i)+str(j)+"0"*(99-i)
            if 1<=int(a)<=n:
                counter+=1
    print(counter)
elif K==2:
    counter=0
    for i in range(100):
        for j in range(i+1,100):
            for k in range(1,10):
                for l in range(1,10):
                    a="0"*(i)+str(k)+"0"*(j-i-1)+str(l)+"0"*(99-j)
                    if 1<=int(a)<=n:
                        counter+=1
    print(counter)
elif K==3:
    counter=0
    for i in range(100):
        if 100-i>len(str(n)):
            pass
        elif 100-i<len(str(n)):
            for j in range(i+1,100):
                for k in range(j+1,100):
                    counter+=9*9*9
        elif 100-i==len(str(n)):
            for j in range(i+1,100):
                for k in range(j+1,100):

                        for b in range(1,10):
                            for c in range(1,10):
                                P=(str(n)[0])+"0"*(j-i-1)+str(b)+"0"*(k-j-1)+str(c)+"0"*(99-k)
                                if 1<=int(P)<=n:
                                    counter+=1
            counter+=((98-i)*(99-i)//2)*9*9*(int(str(n)[0])-1)
    print(counter)
i = 0
wa = 0
while i len(str(N)):
  wa = wa + int(str(N)[i:i+1])
  i += 1
if N % wa == 0:
  print("Yes")
elif N % wa != 0:
  print("No")

### FIXED CODE ###

from sys import stdin
N = int(stdin.readline().rstrip())
i = 0
wa = 0
while i < len(str(N)):
    wa = wa + int(str(N)[i:i+1])
    i += 1
if N % wa == 0:
    print("Yes")
elif N % wa != 0:
    print("No")
n=int(input())
a=[]
b=[]
c=[]
for i in range(n):
    d,e,f=map(int,input().split())
    a.append(d)
    b.append(e)
    c.append(f)
dp[0]=[0,0,0]
for i in range(1,n):
    dp[i]=[dp[i-1][0]+max(b[i],c[i]),dp[i-1][1]+max(a[i],c[i]),dp[i-1][2]+max(b[i],a[i])]
print(max(dp[n-1]))


### FIXED CODE ###

n=int(input())
dp=[0,0,0]
for i in range(n):
    a,b,c=map(int,input().split())
    dp=[max(dp[1],dp[2])+a,max(dp[0],dp[2])+b,max(dp[0],dp[1])+c]
print(max(dp))
x = [i for i in input().rsplit(1)]
money = []
unit = []
for i in x[1:]:
    m, u = i.split()
    money.append(float(m))
    unit.append(u)

total = 0.0
for m, u in zip(money, unit):
    if u == 'JPY':
        total += m
    else:
        total += 380000.0*m

print(total)

### FIXED CODE ###

n = int(input())
money = []
unit = []
for i in range(n):
    m, u = input().split()
    money.append(float(m))
    unit.append(u)

total = 0.0
for m, u in zip(money, unit):
    if u == 'JPY':
        total += m
    else:
        total += 380000.0*m
print(total)
i = int(input())

print(N**3)

### FIXED CODE ###

N = int(input())

print(N**3)
from math import sqrt 
Q = int(input())
table=[]
for i in range(Q):
    A,B=map(int,input().split())
    if A>B:
        table.append([B,A])
    else:
        table.append([A,B])
def f(a,b):
    if a==b:
        return 2*a-2
    if a+1==b:
        return 2*a-2
    m = int(sqrt(a*b))
    if m**2 ==a*b:
        return 2*m-3
    if m*(m+1) >= a*b:
        return 2*m -2
    return 2*m-1

ans = []
for a,b in table:
    ans.append(f(a,b))
print('\n'.join(map(str,ans)))

### FIXED CODE ###

A,B,C=map(int,input().split())
L=[A,B,C]
L.sort()
ans=0
s=(L[-1]-L[0])//2
L[0]=L[0]+2*s
t=(L[-1]-L[1])//2
L[1]=L[1]+2*t
L.sort()
a=0
if L[0]!=L[1]:
    a=2
elif L[1]!=L[2]:
    a=1
print(s+t+a)
c=input()
if c=a or c=e or c=i or c=o or c=u :
print("vowel")
else:
print("consonant")

### FIXED CODE ###

c = input()
if c == "a" or c == "e" or c == "i" or c == "o" or c == "u":
  print("vowel")
else:
  print("consonant")
a,b,c=map(int,input(),split())
q=min(b,c)
w=b+c-a
print("{} {}".format(q,w))

### FIXED CODE ###

a,b,c=map(int,input().split())
q=min(b,c)
w=b+c-a
print("{} {}".format(q,max(0,w)))
n = int(input())

f = 'True'

for i in range(n):
  a = int(input())
  if a % 2 == 0:
    if a % 3 != 0 and a % 5 != 0:
      f = 'False'

if f == 'True':
  print('APPROVED')
else:
  print('DENIED')

### FIXED CODE ###

n = int(input())

a = input().split()

f = 'True'

for i in a:
  if int(i) % 2 == 0:
    if int(i) % 3 != 0 and int(i) % 5 != 0:
      f = 'False'

if f == 'True':
  print('APPROVED')
else:
  print('DENIED')
n = 1
while True:
    if int(input()) == 0:
        break
    print("Case " + n + ": " + str(input()))
    n+=1


### FIXED CODE ###

i = 1

while True:
    x = int(input())
    if x == 0:
        break
    print("Case " + str(i) + ": " + str(x))
    i += 1
s = input().split("/")
print("2018/01/"+s[3])

### FIXED CODE ###

s = input().split("/")
print("2018/01/"+s[2])
S=input()
s=0
for i in range(len(S)):
  if S[i]==S[i+1]==S[i+2]==0:
    s+=1
    S[i+1]=1
  elif S[i]==S[i+1]==S[i+2]==1:
    s+=1
    S[i+1]==0
  elif S[i]==S[i+1] and S[i+1]!=S[i+2]:
    s+=1
    S[i]=S[i+2]
  elif S[i]!=S[i+1] and S[i+1]==S[i+2]:
    s+=1
    S[i+2]==S[i]
  else:
    s=s
print(s)

### FIXED CODE ###

S=input()
s=0
t=0
for i in range(len(S)):
  if i%2==0 and S[i]=="0":
    s+=1
  elif i%2!=0 and S[i]=="1":
    s+=1
for j in range(len(S)):
  if j%2==0 and S[j]=="1":
    t+=1
  elif j%2!=0 and S[j]=="0":
    t+=1
print(min(s,t))
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import itertools
import numpy as np

N = int(readline())
info = []
for i in range(N):
    A = int(readline())
    for _ in range(A):
        x,y = map(int,readline().split())
        info.append((i,x-1,y))
#print(info)

#info=[(0, 1, 1), (1, 0, 1), (2, 1, 0)]

N=3
#A = np.array(list(itertools.product([0,1],repeat=N)),np.bool)
A = np.array(list(itertools.product([0,1],repeat=N)),np.bool)

for i,x,y in info:
    # print(~A[:,i])
    # print(A[:,x])
    bl = (~A[:,i]) | (A[:,x] == bool(y))
    # bl = (A[:,i]) & A[:,x] == bool(y)
    A = A[bl]

answer = A.sum(axis = 1).max()
print(answer)

### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import itertools
import numpy as np

N = int(readline())
info = []
for i in range(N):
    A = int(readline())
    for _ in range(A):
        x,y = map(int,readline().split())
        info.append((i,x-1,y))
        
A = np.array(list(itertools.product([0,1],repeat=N)),np.bool)
for i,x,y in info:
    bl = (~A[:,i]) | (A[:,x] == bool(y))
    A = A[bl]

answer = A.sum(axis = 1).max()
print(answer)
if N <= 2:
    print(0)
else:
    for i, d in enumerate(set_dup):
        count = 0
        for n in nums:
            if n == d:
                count += 1
        set_dup[i] = count

    count = 0
    for a in range(len(set_nums)):
        for b in range(a+1, len(set_nums)):
            for c in range(b+1, len(set_nums)):
                if set_nums[a] + set_nums[b] > set_nums[c]:
                    count += set_dup[a] * set_dup[b] * set_dup[c]
    print(count)


### FIXED CODE ###

N = int(input())
nums = list(map(int, input().split()))
 
set_nums = sorted(list(set(nums)))
set_dup = set_nums.copy()
 
if N <= 2:
    print(0)
else:
    for i, d in enumerate(set_dup):
        count = 0
        for n in nums:
            if n == d:
                count += 1
        set_dup[i] = count
 
    count = 0
    for a in range(len(set_nums)):
        for b in range(a+1, len(set_nums)):
            for c in range(b+1, len(set_nums)):
                if set_nums[a] + set_nums[b] > set_nums[c]:
                    count += set_dup[a] * set_dup[b] * set_dup[c]
    print(count)
n = input()

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

maxv =  int(-20000000)
minv = int r[0]

for i in ranfe(n)
    maxv = max(maxv, r[i]-minv)
    minv = min(minv, r[i])

print(maxv)



### FIXED CODE ###

n = int(input())

maxv = -10**18
minv = 10**18

for i in range(n):
    r= int(input())
    maxv = max(maxv, r - minv)
    minv = min(minv, r)

print(maxv)
N = input().split()

n = float(N[0])
m = float(N[1])
d = float(N[2])

max_point = m-1
total = n**m
total_point = 0.
#point_sub = 0
#point_m = m-d
#point_m_sub = m
#for i in range(point_m):
#    point_sub += point_m_sub*(n-i)
#    point_m_sub -= 1

#print(str(point_sub/total))
if d == 0:
    ans = (m-1)/n
    print(str(ans))
else:
    ans = 2*(m-1)*(n-d)/n**2
    print(str(ans))


#for i in range(int(max_point)):
#    total_point += (n-d-i)*(m-i)

#print(str(total_point/total))

### FIXED CODE ###

N = input().split()

n = float(N[0])
m = float(N[1])
d = float(N[2])

#max_point = m-1
#total = n**m
#total_point = 0.
#point_sub = 0
#point_m = m-d
#point_m_sub = m
#for i in range(point_m):
#    point_sub += point_m_sub*(n-i)
#    point_m_sub -= 1

#print(str(point_sub/total))
if d == 0:
    ans = (m-1)/n
    print(str(ans))
else:
    ans = 2*(m-1)*(n-d)/n**2
    print(str(ans))


#for i in range(int(max_point)):
#    total_point += (n-d-i)*(m-i)

#print(str(total_point/total))