Harryxun/stf_run huggingface dataset:
from collections import deque

def bfs():
    # たどり着くまでにかかった回数をいれる多重リスト。
    d = [[float("inf")] * w for i in range(h)]
    # 1ノード降りるときにforで回せるようリスト化しておく
    dx = [1, 0, -1, 0]
    dy = [0, 1, 0, -1]
    # 接したポイントを取り込む用のqueを定義
    que = deque([])
    # スタート地点をqueに加える。探索の際はqueから取り出すループを回すので最初だけ先に入れておく
    que.append(sx,sy)
    # スタートからスタートにかかる距離は0なのでinfを0にかえる。
    d[sx][sy] = 0
    # queがあるかぎり続ける
    while que:
        p = que.popleft()
        # 取り出した点がゴールなら終了
        if p[0] == gy and p[1] == gx:
            break
        #　それ以外の時は，接している点を4方向順に取得。一つずつ処理する。
        for i in range(4):
            nx = p[0] + dx[i]
            ny = p[1] + dy[i]
            # 新しく取得した座標に対しての処理
            # 迷路内に存在する座標であり，壁ではなく，まだ通ったことがなくdがinfの点なら処理する = 新しく取得した道候補の1つ
            if 0 <= nx < r and 0 <= ny < c and maze[nx][ny] != "#" and d[nx][ny] == float("inf"):
                # 道候補をqueに加える。
                que.append((nx, ny))
                # その道候補への経路までにかかった経路をdに加える。
                d[nx][ny] = d[p[0]][p[1]] + 1
    return d[gy][gx]

h, w = map(int, input().split())
maze = [list(input()) for i in range(h)]
sx, sy = 0, 0
gx, gy = h - 1, w - 1

white = 0
for i in range(h):
    for j in range(w):
        if maze[i][j] == ".":
            white += 1

res = bfs()
if 0 < res < float("inf"):
    # 白いマスの数から最短経路でかかるコスト分を引く
    # ゴールを黒いマスに変えることはできないためその分も引く
    print(white - res - 1)
else:
    print(-1)


### FIXED CODE ###

from collections import deque

def bfs():
    # たどり着くまでにかかった回数をいれる多重リスト。
    d = [[float("inf")] * w for i in range(h)]
    # 1ノード降りるときにforで回せるようリスト化しておく
    dx = [1, 0, -1, 0]
    dy = [0, 1, 0, -1]
    # 接したポイントを取り込む用のqueを定義
    que = deque([])
    # スタート地点をqueに加える。探索の際はqueから取り出すループを回すので最初だけ先に入れておく
    que.append((sx,sy))
    # スタートからスタートにかかる距離は0なのでinfを0にかえる。
    d[sx][sy] = 0
    # queがあるかぎり続ける
    while que:
        p = que.popleft()
        # 取り出した点がゴールなら終了
        if p[0] == gy and p[1] == gx:
            break
        #　それ以外の時は，接している点を4方向順に取得。一つずつ処理する。
        for i in range(4):
            nx = p[0] + dx[i]
            ny = p[1] + dy[i]
            # 新しく取得した座標に対しての処理
            # 迷路内に存在する座標であり，壁ではなく，まだ通ったことがなくdがinfの点なら処理する = 新しく取得した道候補の1つ
            if 0 <= nx < h and 0 <= ny < w and maze[nx][ny] != "#" and d[nx][ny] == float("inf"):
                # 道候補をqueに加える。
                que.append((nx, ny))
                # その道候補への経路までにかかった経路をdに加える。
                d[nx][ny] = d[p[0]][p[1]] + 1
    return d[gx][gy]

h, w = map(int, input().split())
maze = [list(input()) for i in range(h)]
sx, sy = 0, 0
gx, gy = h - 1, w - 1

white = 0
for i in range(h):
    for j in range(w):
        if maze[i][j] == ".":
            white += 1

res = bfs()
if 0 < res < float("inf"):
    # 白いマスの数から最短経路でかかるコスト分を引く
    # ゴールを黒いマスに変えることはできないためその分も引く
    print(white - res - 1)
else:
    print(-1)
from itertools import combinations

MOD = 1000000007

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

vec = [0, 0, 0]
num = 1

for i, a in enumerate(A):
    idx = [i for i, x in enumerate(vec) if x == a]
    if i > 0:
        num = (num * len(idx)) % MOD
    vec[idx[0]] += 1

num_color = sum([x != 0 for x in vec])

if num_color == 1:
    c = 3
if num_color == 2:
    c = 3
if num_color == 3:
    c = 3

ans = c * num % MOD
print(ans)


### FIXED CODE ###

MOD = 1000000007

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

vec = [0, 0, 0]
num = 1

for a in A:
    idx = [i for i, x in enumerate(vec) if x == a]
    if len(idx) == 0:
        print(0)
        exit()
    num = (num * len(idx)) % MOD
    vec[idx[0]] += 1

print(num)
import numpy as np
N, M = [int(x) for x in input().split()]
H = [float(x) for x in input().split()]
AB = [[int(x) for x in input().split()] for _ in range(M)]

graph = np.zeros((N,N))
for A, B in AB:
  graph[A-1][B-1] = 1
  graph[B-1][A-1] = 1

ans = 0
for i in range(N):
  h = 0
  for j in range(N):
    if(graph[i][j]!=0):
      if(H[i]<=H[j]):
        h += 1
  if(h==0):
    ans += 1

### FIXED CODE ###

import numpy as np
N, M = [int(x) for x in input().split()]
H = [float(x) for x in input().split()]
AB = [[int(x) for x in input().split()] for _ in range(M)]

max_h = [0 for _ in range(N)]

for A, B in AB:
  max_h[A-1] = max(max_h[A-1], H[B-1])
  max_h[B-1] = max(max_h[B-1], H[A-1])

ans = 0
for i in range(N):
  if(H[i]>max_h[i]):
    ans += 1
print(ans)
l = list(map(int.input().split()))

l.sort()

print(l[2]-l[1])

### FIXED CODE ###

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

if l[1] < l[2]:
    print(0)
elif l[0] > l[3]:
    print(0)
else:
    l.sort()
    print(l[2]-l[1])
s,w=input().split()
s=int(s)
w=int(w)
if s>w:
    print("safe")
else:
    print("unsafe")

### FIXED CODE ###

s,w=input().split()
s=int(s)
w=int(w)
if s>w:
    print("safe")
if w>s:
   print("unsafe")
if w==s:
   print("unsafe")
a, b = map(int, input().split())
print("Impossible" if (a % 3) or (b % 3) or(sum(a, b) % 3) else "Possible")

### FIXED CODE ###

a, b = map(int, input().split())
print("Impossible" if (a % 3) and (b % 3) and ((a + b) % 3) else "Possible")
import math
N = int(inport())
 
print(math.factrial(N)%(10**9+7))

### FIXED CODE ###

import math
N = int(input())
 
print(math.factorial(N)%(10**9+7))
A, B = map(float, input().split())

BB = int(B*100)

C = BB * A /100

C =math.floor(C)

### FIXED CODE ###

a, b = input().split()
a = int(a)
b = round(100*float(b))
print(a*b//100)
n=input()
if n<2:
    print(1)
elif n<4:
    print(2)
elif n<8:
    print(4)
elif n<16:
    print(8)
elif n<32:
    print(16)
elif n<64:
    print(32)
else:
    print(64)

### FIXED CODE ###

n=int(input())
if n<2:
    print(1)
elif n<4:
    print(2)
elif n<8:
    print(4)
elif n<16:
    print(8)
elif n<32:
    print(16)
elif n<64:
    print(32)
else:
    print(64)
N,X = map(int, input().split())
List = [int(x) for x in input().split()]
 
import math
List.append(X)
List.sort()
 
distance = []
for i in range(N):
    distance.append(List[i+1]-List[i])
 
d_min = min(distance)
 
num_list = []
 
c = 1
while c <= math.sqrt(d_min):
    if d_min%c == 0:
        num_list.append(c)
    c += 1
 
num_list2 = [0]*len(num_list)
for i in range(len(num_list)):
    num_list2[len(num_list)-i-1] = int(d_min/num_list[i])
 
num_list = num_list + num_list2
 
j = len(num_list)-1
c2 = 0
while j >= 0:
    for k in range(len(distance)):
        if distance[k]%num_list[j] == 0:
            c2 += 1
    if c2 == len(distance):
        ans = num_list[j]
        j = 0
    j -= 1
 
print(ans)

### FIXED CODE ###

N,X = map(int, input().split())
List = [int(x) for x in input().split()]
 
import math
List.append(X)
List.sort()
 
distance = []
for i in range(N):
    distance.append(List[i+1]-List[i])
 
d_min = min(distance)
 
num_list = []
 
c = 1
while c <= math.sqrt(d_min):
    if d_min%c == 0:
        num_list.append(c)
    c += 1
 
num_list2 = [0]*len(num_list)
for i in range(len(num_list)):
    num_list2[len(num_list)-i-1] = int(d_min/num_list[i])
 
num_list = num_list + num_list2

num_list.append(d_min)

j = len(num_list)-1

while j >= 0:
    c2 = 0
    for k in range(len(distance)):
        if distance[k]%num_list[j] == 0:
            c2 += 1
    if c2 == len(distance):
        ans = num_list[j]
        j = 0
    j -= 1
 
print(ans)
a.b.c.d.e.k=map(int,input().split())
if abs(a-b)<=k and abs(a-c)<=k and abs(a-d)<=k and abs(a-e)<=k and abs(b-c)<=k and abs(b-d)<=k and abs(b-e)<=k abs(c-d)<=k and abs(c-e)<=k and abs(d-e)<=k:
  print("Yey!")
else:
  print(":(")


### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if e - a > k:
    print(":(")
elif e - b > k:
    print(":(")
elif e - c > k:
    print(":(")
elif e - d > k:
    print(":(")
else:
    print("Yay!")
a,b,t=list(map(int,input()))
print(t(*b//a))


### FIXED CODE ###

a,b,t=list(map(int,input().split()))
print((t//a)*b)
input_length = int(input())
length = len(list(set([int(i) for i in input.split(' ')]))) 

if length == input_length:
  print('YES')
else:
  print('NO')

### FIXED CODE ###

input_length = int(input())
length = len(list(set([int(i) for i in input().split(' ')]))) 
 
if length == input_length:
  print('YES')
else:
  print('NO')
S=int(input())
ans=0
for i in range(S // 3):
  ans+=(math.factorial(S-2*i)%1000000007)//((math.factorial(i)%1000000007)*(math.factorial(S-3*i))%1000000007)%1000000007
print(ans%1000000007)

### FIXED CODE ###

from math import factorial
S=int(input())
ans=0
for i in range(S // 3):
  ans+=factorial(S-2*i-3)//factorial(i)//factorial(S-3*i-3)
print(ans%1000000007)
a,b=map(int,input().split())
if 1=<a<=20 AND 1=<b<=20:
  print(a*b)
else:
  print("-1")


### FIXED CODE ###

a,b=map(int,input().split())
if 1<=a<=9 and 1<=b<=9:
  print(a*b)
else:
  print("-1")
import math

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

if math.fabs(a - c) <= d:
  print("Yes")
elif math.fabs(a - b) <= d and math.fabs(b - c) <= d:
  print("Yes")
else:
  print("No")


### FIXED CODE ###

import math

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

if math.fabs(a - c) <= d:
  print("Yes")
elif math.fabs(a - b) <= d and math.fabs(b - c) <= d:
  print("Yes")
else:
  print("No")
from sys import stdin

def deal(x):
    if abs(x) < 1e-6: return 0
    else: return x

def solve(a, b, c, d, e, f):
    x = 0
    y = 0
    if b == 0:
        x = c / a
        y = (f - d * x) / e
    else:
        x = (b * f - e * c) / (b * d - e * a)
        y = (c - a * x) / b
    
    p = [deal(x), deal(y)]
    return p

for s in stdin:
    s = s[:-1]
    s = map(float, s.split())
    p = solve(s[0], s[1], s[2], s[3], s[4], s[5])
    print ("%.3f "%p[0] + "%.3f"%p[1])

### FIXED CODE ###

from sys import stdin

def deal(x):
    if abs(x) < 1e-6: return 0
    else: return x

def solve(a, b, c, d, e, f):
    x = 0
    y = 0
    if b == 0:
        x = c / a
        y = (f - d * x) / e
    else:
        x = (b * f - e * c) / (b * d - e * a)
        y = (c - a * x) / b
    
    p = [deal(x), deal(y)]
    return p

for s in stdin:
    s = s[:-1]
    s = map(float, s.split())
    p = solve(s[0], s[1], s[2], s[3], s[4], s[5])
    print ("%.3f "%p[0] + "%.3f"%p[1])
s = input()
lis = list(s)
count_str = 0
if s.count(lis[0]) == 2:
   count+=1
else:
    if s.count(lis[1]) == 2:
        count+=1
    else:
        if s.count(lis[2]) == 2:
            count+=1
        else if count == 3:
            print("YES")
        else:
            print("NO")

### FIXED CODE ###

s = input()
lst = list(s)
for c in s:
    k = s.count(c)
    if k != 2:
        print('No')
        exit()
print('Yes')
N, M = map(int, input().split())
matrix=[[0]*N for i in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    matrix[a-1][b-1]=1
    matrix[b-1][a-1]=1
import itertools 
count=0
result=1
for i in itertools.permulations(range(N)):
    if i==0:
        for j in range(N-1):
            result*=matrix[i[j]][i[j+1]]
            if result=1:
                count+=1
            else:
                result=1
    else:
        break
print(count)

### FIXED CODE ###


import itertools

N, M = map(int, input().split())
adj_matrix = [[0]* N for _ in range(N)]

for i in range(M): #隣接行列
    a, b = map(int, input().split())
    adj_matrix[a-1][b-1] = 1
    adj_matrix[b-1][a-1] = 1

cnt = 0

for each in itertools.permutations(range(N)):
    if each[0] != 0:
        break
    factor = 1
    for i in range(N-1):
        factor *= adj_matrix[each[i]][each[i+1]]
    cnt += factor

print(cnt)
n = int(input())
 a = list(map(int, input().split()))
 stock = 0
 rest  = 0
 value = 1000
 for i in range(1, n + 1):
    value = max(value, stock * a[i - 1] + rest)
    stock = value // a[i - 1]
    rest = value % a[i - 1]
 print(value)

### FIXED CODE ###

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

stock_dp = [[0, 0] for _ in range(n+1)]
value_dp = [0] * (n + 1)

value_dp[0] = 1000
for i in range(1, n + 1):
    x = value_dp[i - 1]
    y = stock_dp[i - 1][0] + stock_dp[i - 1][1] * a[i - 1]
    if x > y:
        value_dp[i] = x
    else:
        value_dp[i] = y
    x = value_dp[i - 1] // a[i - 1] 
    y = stock_dp[i - 1][0] // a[i - 1] + stock_dp[i - 1][1]
    rx = value_dp[i - 1] % a[i - 1]
    ry = stock_dp[i - 1][0] % a[i - 1]
    if x > y:
        stock_dp[i][0] = rx
        stock_dp[i][1] = x
    elif x < y:
        stock_dp[i][0] = ry
        stock_dp[i][1] = y
    else:
        stock_dp[i][0] = max(rx, ry)
        stock_dp[i][1] = x
print(value_dp[n])
n=int(input())
a=[0]*10007

for i in range(n):
  a[i+1]=int(input())

cnt=0
needle=1
while not(needle==2 or cnt >10007):
  needle=a[needle]
  cnt+=1


### FIXED CODE ###

n=int(input())
a=[0]*100097

for i in range(n):
  a[i+1]=int(input())

cnt=0
needle=1
while not(needle==2 or cnt >100097):
  needle=a[needle]
  cnt+=1

if cnt>100001:
  cnt=-1
print(cnt)
import collections
_=int(input())
l = list(map(int, input().split()))
c = collections.Counter(l)
M={}

for i,v in c.items():
    if v>1:
        M[i] =  v*(v-1)/2

for k in l:
    M_ = M.copy()
    M_[k] =  M_[k]*(c[k]-2)/c[k]
    print(int(sum(M_.values())))

### FIXED CODE ###

import collections
_ = int(input())
l = list(map(int, input().split()))
c = collections.Counter(l)
M=0
for v in c.values():
    if v>1:
        M +=  v*(v-1)/2

for k in l:
    print(int(M-c[k]+1))
bool ans = True
S = input()
i = 0
while i < len(S):
  if S[i] == "L":
    ans = False
  i += 2
j = 1
while j < len(S):
  if S[j] == "R":
    ans = False
  j += 2
if ans:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

ans = True
S = input()
i = 0
while i < len(S):
  if S[i] == "L":
    ans = False
  i += 2
j = 1
while j < len(S):
  if S[j] == "R":
    ans = False
  j += 2
if ans:
  print("Yes")
else:
  print("No")
N, X = map(int, input().split())
listx = list(map(int, input().split()))
subx = []

for i in range(N):
  subx.append(abs(listx[i] - X))
if N = 1:
  subx.append(subx[0])

def gcd(a,b):
  if a < b:
    a, b = b, a
  while a % b != 0:
    a, b = b, a % b
  return b

ans = gcd(subx[0], subx[1])

if N > 2:
  for i in range(2, N):
    ans = gcd(ans, subx[i])
  
print(ans)

### FIXED CODE ###

import fractions
from functools import reduce
N, X = map(int, input().split())
listx = list(map(int, input().split()))
subx = []
for i in range(N):
  subx.append(abs(listx[i] - X))
  
def lcm_list(numbers):
    return reduce(fractions.gcd, numbers)

ans = lcm_list(subx)

print(ans)
n,a,b=map(int,input().split()),print(min(n*a,b))

### FIXED CODE ###

n,a,b=map(int,input().split());print(min(n*a,b))
import sys
from collections import deque

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def solve():
    h, w, k = nm()
    sy, sx, gy, gx = nm()
    d = [(0, 1), (1, 0), (-1, 0), (0, -1)]
    sx -= 1; sy -= 1
    gx -= 1; gy -= 1
    C = [ns() for _ in range(w)]
    G = [[10**10]*w for _ in range(h)]
    G[sy][sx] = 0
    q = deque([(sy, sx)])
    while q:
        y, x = q.popleft()
        for i in range(4):
            dy, dx = d[i]
            ny, nx = y, x
            for _ in range(k):
                ny += dy; nx += dx
                if ny < 0 or h <= ny or nx < 0 or w <= nx:
                    break
                if C[ny][nx] == '@' or G[ny][nx] <= G[y][x]:
                    break
                if G[ny][nx] > G[y][x] + 1:
                    G[ny][nx] = G[y][x] + 1
                    q.append((ny, nx))
    ans = G[gy][gx]
    print(ans if ans < 10**10 else -1)
    return

solve()


### FIXED CODE ###

import sys
from collections import deque

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))


def solve():
    h, w, k = nm()
    sy, sx, gy, gx = nm()
    d = [(0, 1), (1, 0), (-1, 0), (0, -1)]
    sx -= 1; sy -= 1
    gx -= 1; gy -= 1
    C = [ns() for _ in range(h)]
    G = [[10**7]*w for _ in range(h)]
    G[sy][sx] = 0
    q = deque([(sy, sx)])
    while q:
        y, x = q.popleft()
        for i in range(4):
            dy, dx = d[i]
            ny, nx = y, x
            for _ in range(k):
                ny += dy; nx += dx
                if ny < 0 or h <= ny or nx < 0 or w <= nx:
                    break
                if C[ny][nx] == '@' or G[ny][nx] <= G[y][x]:
                    break
                if G[ny][nx] > G[y][x] + 1:
                    G[ny][nx] = G[y][x] + 1
                    q.append((ny, nx))
    ans = G[gy][gx]
    print(ans if ans < 10**7 else -1)
    return

solve()
a=[]
n=int(input())
s=input()
a=list(map(int,s.split()))
insertionSort(a,n)

def insertionSort(a,n):
    for i in range(n):
        print(a[i],end="")
        if(i!=n-1):
            print(" ",end="")
    print("")    
    for i in range(1,n):
        v=a[i]
        j=i-1
        while(j>=0 and a[j]>v):
            a[j+1] = a[j]
            j-=1
        a[j+1] = v
        for i in range(n):
            print(a[i],end="")
            if(i!=n-1):
                print(" ",end="")
        print("")

### FIXED CODE ###

def insertionSort(a,n):
    for i in range(n):
        print(a[i],end="")
        if(i!=n-1):
            print(" ",end="")
    print("")    
    for i in range(1,n):
        v=a[i]
        j=i-1
        while(j>=0 and a[j]>v):
            a[j+1] = a[j]
            j-=1
        a[j+1] = v
        for i in range(n):
            print(a[i],end="")
            if(i!=n-1):
                print(" ",end="")
        print("")

a=[]
n=int(input())
s=input()
a=list(map(int,s.split()))
insertionSort(a,n)
N = input()
l = len(N)

if N[i::] == "9"*(l-1):
    print(int(N[0])+9*(l-1))
else:
    print(int(N[0])-1+9*(l-1))

### FIXED CODE ###

N = input()
l = len(N)

if N[1::] == '9'*(l-1):
    print(int(N[0])+9*(l-1))
else:
    print(int(N[0])-1+9*(l-1))
n = int(input())
a = list(map(int, input().split()))
 
ops = []
while len(a):
  if not any(a[i] == i + 1 for i in range(len(a))):
    print(-1)
    exit()
  for i in range(reversed(len(a))):
    if a[i] == i + 1:
      ops.append(a[i])
      a.pop(i)
      break

for op in reversed(ops):
  print(op)


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
 
ops = []
while len(a):
  if not any(a[i] == i + 1 for i in range(len(a))):
    print(-1)
    exit()
  for i in reversed(range(len(a))):
    if a[i] == i + 1:
      ops.append(a[i])
      a.pop(i)
      break
 
for op in reversed(ops):
  print(op)
#pypyは内包表記使わない
def main():
    import sys
    #input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations
    #from itertools import accumulate, product
    from bisect import bisect_left,bisect_right
    from math import floor, ceil
    #from operator import itemgetter

    #mod = 1000000007

    A, B, C, D, E, F = map(int, input().split())
    rate = 0
    for i in range(30//A+1):
        for j in range(30//B+1):
            if i==0 and j==0:
                continue
            water = A*i + B*j
            if water*100 > F:
                continue
            limit = water * E
            for s in range(limit//C+1):
                sugar = limit-((limit-C*s)%D)
                if sugar==0:
                    continue
                if water*100 + sugar > F:
                    continue
                if rate < sugar/(sugar+water):
                    rate = sugar/(sugar+water)
                    res_water = water * 100
                    res_sugar = sugar
    print(res_water+res_sugar, res_sugar)


if __name__ == '__main__':
    main()

### FIXED CODE ###

A,B,C,D,E,F = map(int,input().split())
f = F//100

ans = [0,0]
per = -1
#水の量を100g単位ずつ全探索
for w in range(1,f+1):
    #そのような水の取り方があるか確認
    wt = 0
    for b in range(0,w+1,B):
        if (w-b)%A == 0:
            wt = 1
            break
    if wt == 0:
        continue

    water = w*100
    sugar = min(w*E,F-water)
    if ans[0] == 0:
        ans[0] = water
    st = 0
    #砂糖として考えられる量を大きい順に0gまでに全探索
    for s in range(sugar,0,-1):
        st = 0
        for d in range(0,s+1,D):
            if (s-d)%C == 0:
                st = 1
                break
        if st == 1:
            break
    if st == 1 and s+water <= F and s/(s+water) > per:
        ans = [s+water,s]
        per = s/(s+water)

print(' '.join(map(str,ans)))
n=input().split()
a=int(n[0])/int(n[1])
if int(n[0])%int(n[1])!=0:
  a+1
print(a*int(n[2])

### FIXED CODE ###

# coding: utf-8
# Your code here!
import math
n=input().split()
a=int(n[0])/int(n[1])
b=math.floor(a)
if int(n[0])%int(n[1])!=0:
  b=b+1
print(b*int(n[2]))
n = input()
max = -10**9
min = 0
 
for i in range(0, n-1):
 R[i] = input()
 if R[i] <= min:
   min = R[i]
 if max <= R[i] - min:
  max = R[i] - min
 
print max

### FIXED CODE ###

n = input()
n_max = -(10**9)
n_min = input() 

for i in range(0, n-1):
 R = input()
 if n_max < R - n_min:
  n_max = R - n_min
 if R < n_min:
  n_min = R
 
print n_max
a = input().aplit(" ")
cnt=0
for i, ai in enumerate(a):
  if ai==0
  return i+1

### FIXED CODE ###

a = input().split(" ")
temp = 0
for i, ai in enumerate(a):
    if int(ai)==0:
        temp=i
        break
 
print(temp+1)
# -*- coding: utf-8 -*-


N = input()
A = [input().split() for i in range(N)]

sum = 0
for i in range(N-1):
  for j in range(i+1, N):
    sum += (A[i]^A[j])

dst = sum % (10**9+7)
print(dst)
    
    

### FIXED CODE ###

import numpy as np

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

mod = 10 ** 9 + 7
s = 0

for i in range(60):# Aは2の6乗より小さい
    c = np.count_nonzero(A & 1) # 最下位のbitで0じゃないものの個数
    s += 2 ** i * c * (N - c) # https://qiita.com/ZhangChaoran/items/0d59eb5c95cd9414801d
    A >>= 1 #　1bitずつ右にずらす。これを繰り返し続ける
print(s % mod)