Harryxun/stf_run huggingface dataset:
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()
score = {"r":P, "s":R, "p":S} 
m = {"r":"p", "s":"r", "p":"s"}
command= []
mm = []
ans = 0


for i, t in enumerate(T):
    if t == "r":
      command = "p"
      point = P
    elif t == "s":
      command ="r" 
      point = R
    elif t == "p":
      command = "s"
      point = P
    
    if (i - K > 0) and (command[i - K] == command):
        command = ''
        point = 0
    
    ans += point
    command.append(command)

### FIXED CODE ###

N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = list(input())


ans = 0
commands = [''] * N
for i, t in enumerate(T):
    if t == 'r':
        command = 'p'
        point = P

    elif t == 's':
        command = 'r'
        point = R

    elif t == 'p':
        command = 's'
        point = S

    if (i - K >= 0) and (commands[i -  K] == command):
        command = ''
        point = 0

    ans += point
    commands[i] = command

print(ans)
import sys
from scipy.sparse.csgraph import csgraph_from_dense, bellman_ford
import numpy as np

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)


def main():
    N, M = map(int, input().split())
    G = [[0 for i in range(N)] for j in range(N)]

    for i in range(M):
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        G[a][b] = -1

    G = csgraph_from_dense(G, null_value=0)
    d = bellman_ford(G)

    print(int(-min(d.flatten())))


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
from collections import defaultdict, deque

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)


def main():
    V, E = map(int, input().split())
    is_visited = [False] * V
    indeg = [0] * V  # 流入量
    # 隣接リスト
    G = defaultdict(lambda: [])

    for i in range(E):
        s, t = map(int, input().split())
        s -= 1
        t -= 1
        G[s].append(t)
        indeg[t] += 1

    # print(G, indeg, is_visited)
    out = []
    dp = [0] * V

    def bfs(s):
        q = deque()
        q.append(s)
        is_visited[s] = True
        while q:
            u = q.popleft()
            out.append(u)
            # print(u, out)
            for v in G[u]:
                indeg[v] -= 1
                # dp[v] = max(dp[v], dp[u] + 1)
                if indeg[v] == 0 and (not is_visited[v]):
                    q.append(v)
                    is_visited[v] = True

    def topological():
        for u in range(V):
            if indeg[u] == 0 and (not is_visited[u]):
                bfs(u)

        # print(max(dp))

    topological()

    for i in out:
        for dest in G[i]:
            dp[dest] = max(dp[dest], dp[i] + 1)

    print(max(dp))


if __name__ == "__main__":
    main()
def cur(n):
    for x in neighbor[n]:
        if x!=par[n]:
            par[x]=n
            descend[n]+=cur(x)
    return descend[n]


def cur2(i):
    for x in neighbor[i]:
        if x!=par[i]:
            ans[x]=ans[i]*(descend[x])*modinv(n-descend[x])%mod
            cur2(x)

def modinv(a,m=10**9+7):
    if a==0: return 1
    b=m
    (x, lastx) = (0, 1)
    (y, lasty) = (1, 0)
    while b != 0:
        q = a // b
        (a, b) = (b, a % b)
        (x, lastx) = (lastx - q * x, x)
        (y, lasty) = (lasty - q * y, y)
    return lastx % m

mod=10**9+7
n=int(input())
neighbor=[[]  for _ in range(n+1)]
descend=[1]*(n+1)
par=[0]*(n+1)

for _ in range(n-1):
    a,b=map(int,input().split())
    neighbor[a].append(b)
    neighbor[b].append(a)

cur(1)
ans=[1]*(n+1)
ans1=1
for i in range(1,n+1):
    ans1=ans1*i%mod
for x in range(1,n+1):
    ans1=ans1*modinv(descend[x])%mod
ans[1]=ans1
cur2(1)
for i in range(1,n+1):
    print(ans[i])

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)

def modinv(a,m=10**9+7):
    if a==0: return 1
    else:
        b=m
        (x, lastx) = (0, 1)
        (y, lasty) = (1, 0)
        while b != 0:
            q = a // b
            (a, b) = (b, a % b)
            (x, lastx) = (lastx - q * x, x)
            (y, lasty) = (lasty - q * y, y)
        return lastx % m

def cur(p):
    if neighbor[p]==[]: return
    for x in neighbor[p]:
        par[x]=p
        neighbor[x].remove(p)
        cur(x)
    descend[par[p]]+=descend[p]

def cur2(p):
    for x in neighbor[p]:
        ans[x]=ans[p]*descend[x]*modinv(n-descend[x])
        ans[x]%=mod
        cur2(x)

mod=10**9+7
n=int(input())
neighbor=[set()  for _ in range(n+2)]
descend=[1 for i in range(n+1)]
par=[0]+[0]*(n+1)

for _ in range(n-1):
    a,b=map(int,input().split())
    neighbor[a].add(b)
    neighbor[b].add(a)

cur(1)


ans=[1]*(n+1)
ans1=1
for i in range(1,n+1):
    ans1=ans1*i*modinv(descend[i])
    ans1%=mod
ans[1]=ans1

cur2(1)

for i in range(1,n+1):
    print(ans[i])
# sys.setrecursionlimit(10**6)

N, H, W = [int(x) for x in raw_input().split(' ')]
arr = []
for _ in xrange(N):
    r, c, a = [int(x) for x in raw_input().split(' ')]
    arr.append((a, r-1, c+H-1))
arr = sorted(arr)
ans = 0
P = [-1] * (H+W)
C = [1] * (H+W)

def find(a):
    if P[a] < 0: return a
    t = find(P[a])
    P[a] = t
    return t

def unite(r, c):
    fr, fc = find(r), find(c)
    if fr == fc:  return 0
    C[fr] = C[fc] = C[fr] + C[fc]
    if P[fr] == P[fc]:
        P[fc] = fr
        P[fr] -= 1
    elif P[fr] > P[fc]:
        P[fc] = fr
    else:
        P[fr] = fc
    
while arr:
    a, r, c = arr.pop()
    unite(r, c)
    fr = find(r)
    if C[fr]:
        ans += a
        C[fr] -= 1
print(ans)


### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

def par(a):
    if P[a] < 0: return a
    t = par(P[a])
    P[a] = t
    return t
def unite(a, b):
    if par(a) == par(b): return 0
    C[par(a)], C[par(b)] = C[par(a)] + C[par(b)], C[par(a)] + C[par(b)]
    if P[par(b)] == P[par(a)]:
        P[par(b)] = par(a)
        P[par(a)] -= 1
    elif P[par(b)] > P[par(a)]:
        P[par(b)] = par(a)
    else:
        P[par(a)] = par(b)
N, H, W = map(int, input().split())
P = [-1 for i in range(H+W)]
C = [1] * (H+W)
X = []
for _ in range(N):
    r, c, a = map(int, input().split())
    X.append((a, r-1, c+H-1))
X = sorted(X)
ans = 0
while X:
    a, r, c = X.pop()
    unite(r, c)
    if C[par(r)]:
        ans += a
        C[par(r)] -= 1
print(ans)
from collections import Counter
from math import factorial

n = int(input())
lst = [input() for _ in range(n)]
for i in range(n):
    lst[i] = str(sorted(lst[i])).replace(', ','').replace("'",'').replace('[','').replace(']','')

numlst = Counter(lst)

ans = 0
for v in numlst.values():
    if v==1:
        continue
    else:
        ans += factorial(v) / factorial(2) / factorial(v-2)
print(int(ans))

### FIXED CODE ###

from collections import Counter

N = int(input())
S = [input() for i in range(N)]

sorted_S =  [''.join(sorted(s)) for s in S]
c = Counter(sorted_S)

print(sum([n * (n-1)//2 for n in  list(c.values())]))
import sys
def side(p1,p2):
  global D
  y1,x1=p1
  y2,x2=p2
  dy=y2-y1
  dx=x2-x1
  for p3 in D[::-1]:
    if p1==p3 or p2==p3:pass
    y3,x3=p3
    elif (x3-x1)*dy-dx*(y3-y1)<0:return 0
  else:return 1

while 1:
  n=input()
  if n==0:break
  D=sorted([list(input()) for i in range(n)])
  p=p1=D[0]
  D1=D[:]
  while True:
    for p2 in D1:
      if p1!=p2 and side(p1,p2):break
    p1=p2
    D1.remove(p2)
    if p2==p:break
  print len(D1)

### FIXED CODE ###

import sys
def side(p1,p2):
  global D
  y1,x1=p1
  y2,x2=p2
  dy=y2-y1
  dx=x2-x1
  for p3 in D:
    if p1==p3 or p2==p3:continue
    if (p3[1]-x1)*dy-dx*(p3[0]-y1)<0:return 0
  else:return 1
 
while 1:
  n=input()
  if n==0:break
  D=sorted([list(input()) for i in range(n)])
  p=p1=D[0]
  while 1:
    for p2 in D:
      if p1!=p2 and side(p1,p2):break
    p1=p2
    D.remove(p2)
    if p2==p:break
  print len(D)
n = int(input())
lst = input().split()
bub, sel = [lst]*2
sls = []
for i in range(n):
    m = i
    li = lst[i][0]
    if not li in sls:
        sls.append(li)
    for j in range(n-1,i,-1):
        if bub[j] < bub[j-1]:
            bub[j-1:j+1] = bub[j], bub[j-1]
    for k in range(i, n):
        if sel[k][1] < sel[k][1]:
            m = k
    if m != i:
        sel[i], sel[m] = sel[m], sel[i]

def stable(sort):
    s = 0
    for i in range(1,n):
        if sort[i][1] == sort[i-1][1] & sls.index(sort[i][0]) < sls.index(sort[i-1][0]):
            s += 1
    print('Not stable' if s else 'Stable')
    
print(*bub)
stable(bub)
print(*sel)
stable(sel)

### FIXED CODE ###

n = int(input())
lst = input().split()
bub, sel = lst[:], lst[:]
def stable(sls):
    s, i = 1, n-1
    while s*i:
        if sls[i][1] == sls[i-1][1]:
            if lst.index(sls[i]) < lst.index(sls[i-1]) :
                s = 0
        i -= 1
    print('Stable' if s else 'Not stable')

for i in range(n):
    m = i
    for j in range(n-1,i,-1):
        if bub[j][1] < bub[j-1][1]:
            bub[j-1:j+1] = bub[j], bub[j-1]
    for k in range(i, n):
        if sel[k][1] < sel[m][1]:
            m = k
    if m != i:
        sel[i], sel[m] = sel[m], sel[i]

print(*bub)
stable(bub)
print(*sel)
stable(sel)
N = str(input())
flag = 0
for i in range(len(N))
	if int(N[i]) == 7:
    	print ('Yes')
      	flag = 1
    	break
if flag == 0:
  print ('No')

### FIXED CODE ###

N = str(input())
flag = 0
for i in range(len(N)):
    if int(N[i]) == 7:
        print ('Yes')
        flag = 1
        break
if flag == 0:
    print ('No')
n=int(input())

ab = []
for _ in range(n):
    a, b, c = (int(x) for x in input().split())
    ab.append([a, b, c])

dp = [[0 for i in range(3)] for j in range(n+1)]

for i in range(n):
    for j in range(3):
        for k in range(3):
            if j != k:
                dp[i+1][k] = max([dp[i+1][k], dp[i][j]+ab[i][k]])

ptint(max(dp[n]))

### FIXED CODE ###

n=int(input())

ab = []
for _ in range(n):
    a, b, c = (int(x) for x in input().split())
    ab.append([a, b, c])

dp = [[0 for i in range(3)] for j in range(n+1)]

for i in range(n):
    for j in range(3):
        for k in range(3):
            if j != k:
                dp[i+1][k] = max([dp[i+1][k], dp[i][j]+ab[i][k]])

print(max(dp[n]))
x = input()
y = x*x*x
print(y)


### FIXED CODE ###

x = int(input())
print(x**3)
n=int(input())
if n==2:
    print(n)
else:
    cost=0
    for i in range(n,10**6):
        for j in range(2,int(i**0.5))+1):
            if i%j==0:
                cost+=1
        if cost==0:
            print(i)
            break

### FIXED CODE ###

n=int(input())
for i in range(n,10**6):
  for j in range(2,int(i**0.5)+1):
    if i%j==0:
      break
  else:
    print(i)
    break
N = int(input())
ans = N * (N - 1) // 2
print(ans)

### FIXED CODE ###

S = input().split()
T = input().split()
S = list(S[0])
T = list(T[0])

count = 0
for i in range(3):

    if S[i] == T[i]:
        count += 1


print(count)
N = int(input())
A = list(map(int,input().split()))

li1 = [i+1-A[i] for i in range(N)]
li2 = [A[i]+i+1 for i in range(N)]

cnt = [0 for i in range(2*N+1)]
for i in li2:
    cnt[i] += 1

ans = 0
for i in li1:
    if i>=0:
        ans += cnt[i]
print(ans)







### FIXED CODE ###

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

li1 = [i+1-A[i] for i in range(N)]
li2 = [A[i]+i+1 for i in range(N)]

cnt = [0 for i in range(2*N+1)]
for i in li2:
    if i<len(cnt)-1:
        cnt[i] += 1

ans = 0
for i in li1:
    if i>=0:
        ans += cnt[i]
print(ans)
#66

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

print(min(a+b, b+c, c+a))

### FIXED CODE ###

#66

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

print(min(a+b, b+c, c+a))
n,m=map(int,input().split())
h=list(map(int,input().split()))
ab=[list(map(int,input().split())) for _ in range(m)]
list=[0]*n
for a,b in ab:
  list[a-1]+=max(list[a-1],h[b-1])
  list[b-1]+=max(list[b-1],h[a-1])
ans=0
for i in range(n):
  if list[i]<h[i]:
    count+=1
print(count)
  

### FIXED CODE ###

n,m=map(int,input().split())
h=list(map(int,input().split()))
ab=[list(map(int,input().split())) for _ in range(m)]
list=[0]*n
for a,b in ab:
  list[a-1]=max(list[a-1],h[b-1])
  list[b-1]=max(list[b-1],h[a-1])
count=0
for i in range(n):
  if list[i]<h[i]:
    count+=1
print(count)
a=input()
a=a.split()

x=str(a[0])
y=str(a[1])

y=y[:-1]

if x==y:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

x=input()
b=input()

y=b[:-1]

if x==y:
  print("Yes")
else:
  print("No")
o = input()
e = input()
l = []
for i in range (len(o)):
  l.append(o[i])
  l.append(e[i])



### FIXED CODE ###

o = list(input())
e = list(input())
i = 0
ans = ""
while i < len(e):
  ans += o[i]+e[i]
  i += 1
if len(o) > len(e):
  ans += o[len(o)-1]
print(ans)
def s(n,p):
  while n>0:yield n%p;n//=p
c=lambda*a:sum(s(*a));n=int(input())print(min(c(i,6)+c(n-i,9)for i in range(n+1)))

### FIXED CODE ###

def s(n,c):
  if n<6:return c+n
  a=b=1
  while a*6<=n:a*=6
  while b*9<=n:b*=9
  return min(s(n-a,c+1),s(n-b,c+1))
print(s(int(input()),0))
def main():
    N = int(raw_input())
    x = map(int, raw_input().split())
    #-1:remove , 0:singe , 1~:label 
    check= [0] * N
    flag = False
    label = 1
    c = 0
    x.sort()

    #labeling
    for i in range(N):
        for j in range(N):
            if(i != j):
                if(x[i] == x[j]):
                    flag = True
        if flag:
            if i > 0:
                if(x[i] != x[i-1]):
                    label += 1
                    check[i] = label
                else:
                    check[i] = label
            else:
                check[i] = label
        flag = False
    
    #removing
    for i in range(N-1):
        if(check[i] > 0 and check[i+1] == check[i]):
            for j in range(N):
                if(check[i] != check[j] and check[j] > 0 and flag == False):
                     check[i] = -1
                     check[j] = -1
                     if j < N-2:
                         check[j+1] != check[j+2]
                         check[j+1] = 0
                     else:
                         check[j+1] = 0
                     flag = True
            if flag == False:     
                check[check.index(0)] = -1
                check[i] = -1
            else:
                flag = False
        elif check[i] != -1:
            check[i] = 0
    for i in range(N):
        if check[i] == 0:
            c += 1
    return c
print main()

### FIXED CODE ###

def main():
    x = int(raw_input())
    if x > 6:
       if (x - 6) % 11 == 0:
           op1 = (x - 6)/11
           op2 = x/11 + 1
       elif x % 11 == 0 :
           op1 = (x - 6)/11 + 1
           op2 = x/11
       else:
           op1 = (x - 6)/11 + 1
           op2 = x/11 + 1
       return op1+op2
    else:
        return 1
print main()
w0 = raw_input().lower()
c = 0
while True:
    s = raw_input()
    if s == 'END_OF_TEXT': break
    for w in s..lower().split():
        if w == w0:
            c += 1
print c

### FIXED CODE ###

w0 = raw_input().lower()
c = 0
while True:
    s = raw_input()
    if s == 'END_OF_TEXT': break
    for w in s.lower().split():
        if w == w0:
            c += 1
print c
n = int(input())
A = list(map(int,input().split()))

def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct


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

pc = True

fac = [0]*(10**3+1)
for a in A:
    lst = factorize(a)
    for p in lst:
        if not fac[p[0]]:
            fac[p[0]] = 1
        else:
            pc = False
            break
    if not pc:
        break
if pc:
    print('pairwise coprime')
else:
    g = A[0]
    for i in range(1,n):
        g = gcd(g, A[i])
    if g == 1:
        print('setwise coprime')
    else:
        print('not coprime')

### FIXED CODE ###

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

def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

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

pc = True

fac = [0]*(10**6+1)
for a in A:
    lst = factorize(a)
    for p in lst:
        if not fac[p[0]]:
            fac[p[0]] = 1
        else:
            pc = False
            break
    if not pc:
        break
if pc:
    print('pairwise coprime')
else:
    g = A[0]
    for i in range(1,n):
        g = gcd(g, A[i])
    if g == 1:
        print('setwise coprime')
    else:
        print('not coprime')
import math

n = input()

px = 0
py = 0
qx = 100
qy = 0

def koch(n, px, py, qx, qy):
 if n == 0:
  return
 
 s.x = (px*2+qx*1)/3
 s.y = (py*2+qy*1)/3
 t.x = (px*1+qx*2)/3
 t.y = (py*1+qy*2)/3
 u.x = (t.x-s.x)*math.cos(60) - (t.y-s.y)*math.sin(60) + s.x
 u.y = (t.x-s.x)*math.sin(60) - (t.y-s.y)*math.cos(60) + s.y

 koch(n-1, px, py, s.x, s.y)
 print s.x, s.y
 koch(n-1, s.x, s.y, u.x, s.y)
 print u.x, u.y
 koch(n-1, u.x, u.y, t.x, t.y)
 print t.x, t.y
 koch(n-1, t.x, t.u, qx, qy)

print px, py
koch(n, px, py, qx, qy)
print qx, qy

### FIXED CODE ###

import math
          
def koch(n, h, i, j, k):
 if n == 0:
  return
           
 sx = (h*2+j)/3
 sy = (i*2+k)/3
 tx = (h+j*2)/3
 ty = (i+k*2)/3
 ux = (tx-sx)*math.cos(math.pi/3) - (ty-sy)*math.sin(math.pi/3) + sx
 uy = (tx-sx)*math.sin(math.pi/3) + (ty-sy)*math.cos(math.pi/3) + sy
          
 koch(n-1, h, i, sx, sy)
 print sx, sy
 koch(n-1, sx, sy, ux, uy)
 print ux, uy
 koch(n-1, ux, uy, tx, ty)
 print tx, ty
 koch(n-1, tx, ty, j, k)
   
n = input()
          
px = float(0)
py = float(0)
qx = float(100)
qy = float(0)
          
print px, py
koch(n, px, py, qx, qy)
print qx, qy
import math
n,k = list(map(int, input().split()))

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

for ii in range(n*10):
    i = ii+1
    ar = ValueToArray10(i, int(1+(math.log(i)+0.00001)/math.log(10)))
    ok=1
    for j in ar:
        for k in a:
            if(j==k):
                ok=0
    if(ok==1 and i>=n):
        print(i)
        exit()



### FIXED CODE ###

import math
import fractions
#import sys
#input = sys.stdin.readline

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

def ValueToBits(x,digit):
    res = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        res[i]=now%2
        now = now >> 1
    return res

def BitsToValue(arr):
    n = len(arr)
    ans = 0
    for i in range(n):
        ans+= arr[i] * 2**i
    return ans

def ValueToArray10(x, digit):
    ans = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        ans[digit-i-1] = now%10
        now = now //10
    return ans
'''
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 2
N = 10 ** 6 + 2
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

'''

#a = list(map(int, input().split()))

#################################################
#################################################
#################################################
#################################################


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

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

for ii in range(n*10):
    i = ii+1
    ar = ValueToArray10(i, int(1+(math.log(i)+0.00001)/math.log(10)))
    ok=1
    for j in ar:
        for k in a:
            if(j==k):
                ok=0
    if(ok==1 and i>=n):
        print(i)
        exit()
n,m = map(int,input().split())
 
a = [ int(x) for x in input().split()]
limit = sum(a)//(4*m)
 
count=0
for x in a:
  	if(x>=limit):
      	count+=1
if(count<m):
  	print('No')
else:
  	print('Yes')



### FIXED CODE ###

n,m = map(int,input().split())
 
a = [ int(x) for x in input().split()]
limit = sum(a)/(4*m)
 
count=0
for x in a:
  	if(x>=limit):
      			count+=1
if(count<m):
  	print('No')
else:
  	print('Yes')
n=int(input())
s=set()
for i in range(n):
    s^=int(input())
print(len(s))


### FIXED CODE ###

n=int(input())
s=set()
for i in range(n):
    s ^= {input()}
print(len(s))
S = input()
if S == "Sunny":
    print("Cloudy")
elif S == "Cloudy"
    print("Rainy")
else:
    print("Sunny")

### FIXED CODE ###

S = input()
if S == "Sunny":
    print("Cloudy")
elif S == "Cloudy":
    print("Rainy")
else:
    print("Sunny")
import math
n = int(raw_input())

for i in range(n):
    x1,y1,x2,y2,x3,y3,x4,y4 = map(float, raw_input().split())
    if x2-x1==0.0 and x4-x3==0.0:
        print "YES"
    elif y2-y1==0.0 and y4-y3==0.0:
        print "YES"
    elif fabs((y2-y1)*(x4-x3) - (y4-y3)*(x2-x1))<0.000001:
        print "YES"
    else:
        print "NO"

### FIXED CODE ###

n = int(raw_input())

for i in range(n):
    x1,y1,x2,y2,x3,y3,x4,y4 = map(float, raw_input().split())
    if abs((y4-y3)*(x2-x1)-(y2-y1)*(x4-x3)) < 1e-10:
        print "YES"
    else:
        print "NO"
import sys
args = sys.argv[1]
#??????????????????????????????????????????????????§????????????????????????
with open(args) as f:
	x = f.readline()
	i = 0
	while x != 0:
		print("Case " + str(i+1) + ":" + str(x))
		i += 1
		x = f.readline()

### FIXED CODE ###

#x = []
i = 0
while True:
	x = int(input())
	if x == 0:
		break
	print("Case " + str(i+1) + ": " + str(x))
	i += 1
N,K = map(int,input().split())
S = input()
S[K-1] = S[K-1].lower()
print(S)

### FIXED CODE ###

N,K = map(int,input().split())
S = input()
s = []
for i in range(N):
    x = S[i]
    if i == K-1:
        if x == 'A':
            x = 'a'
        elif x == 'B':
            x = 'b'
        else:
            x = 'c'
    s.append(x)
ans = s[0]
for i in range(1,N):
    ans += s[i]
print(ans)
N, M = map(int,input().split())
a = [int(input()) for i in range(M)]
dp = [0 for i in range(N+1)]
dp[0] = 1
dp[1] = 1
for i in range(2,N+1)
  if (i-2 in a) and (i-1 in a):
    dp[-1] = 0
    break
  elif i-2 in a:
    dp[i] = dp[i-1]
  elif i-1 in a:
    dp[i] = dp[i-2]
  else:
    dp[i] = dp[i-1] + dp[i-2]

print(dp[-1]%(7+10**9))

### FIXED CODE ###

N, M = map(int,input().split())
a = set([int(input()) for i in range(M)])
dp = [0 for i in range(N+1)]
dp[0] = 1
dp[1] = 1
for i in range(2,N+1):
  if (i-2 in a) and (i-1 in a):
    dp[-1] = 0
    break
  elif i-2 in a:
    dp[i] = dp[i-1]
  elif i-1 in a:
    dp[i] = dp[i-2]
  else:
    dp[i] = dp[i-1] + dp[i-2]

print(dp[-1]%(7+10**9))
import heapq
L,R = map(int,input().split())
numMap=[10**19]*(R-L+1)
numheap=[]
k=0

AnsA=0
AnsB=0
for i in range(L,R+1):
    heapq.heappush(numheap,i%2019)
    if(numMap[k]==3):AnsA=i
    if(numMap[k]==673):AnsB=i
    k+=1

if(AnsA!=0 & AnsB!=0):
    print("0")
else:
    print(heapq.heappop(numheap)*heapq.heappop(numheap))

### FIXED CODE ###

import math
L, R = map(int, input().split())
R=min(R,L+2019)
m=2018
for i in range(L,R+1):
  for j in range(i,R+1):
    if i==j:
      continue
    if (i*j)%2019<m:
      m=(i*j)%2019
print(m)
import sys

a = sys.stdin.readline()
b = sys.stdin.readline()
t = sys.stdin.readline()

a1 = a.rstrip()
b1 = b.rstrip()
t1 = t.rstrip()

A = int(a1)
B = int(b1)
T = int(t1)

p1 = A*T

if B < p1:
    print(B)
elif B > p1:
    print(p1)
else:
    print(B)


### FIXED CODE ###

import sys
t = sys.stdin.readline()

t1 = t.rstrip()

t2 = t1.split(' ')

T = int(t2[0])
A = int(t2[1])
B = int(t2[2])
p1 = A*T

if B < p1:
    print(B)
elif B > p1:
    print(p1)
else:
    print(B)