CodeEff/ECCO huggingface dataset:
# Original solution
x=0;y=0
for _ in range(int(eval(input()))):
  d,c=list(map(int,input().split()))
  x+=d*c
  y+=c
print((y-1+(x-1)//9))

# Optimized solution
x=y=-1
for _ in range(int(eval(input()))):
  d,c=list(map(int,input().split()))
  x+=d*c
  y+=c
print((y+x//9))
# Original solution
import sys
from collections import deque

def q(d, c, dq):
    if c == 1: 
        if d < 10: 
            dq.append(d)
            return 0
        else:
            a = d //10 + d % 10
            if a < 10: 
                dq.append(a)
                return 1
            else: 
                dq.append(a-9)
                return 2
    a = d * 2
    if a < 10: count = q(a, c//2, dq)
    else:
        count = q(a - 9, c//2, dq)
        count += c//2
    count += c//2
    if c % 2 == 1: dq.append(d)
    return count

def solve():
    input = sys.stdin.readline
    M = int(eval(input()))
    count = 0
    dq = deque()
    digit = 0
    for _ in range(M):
        d, c = list(map(int, input().split()))
        add = q(d, c, dq)
        count += add
    
    digit = len(dq)
    for _ in range(digit - 1):
        #print(dq)
        a = int(dq.pop())
        a += int(dq.pop())
        if a >= 10:
            dq.append(str(a % 10 + a // 10))
            count += 2
        else: 
            dq.append(str(a))
            count += 1

    print(count)
    
    return 0

if __name__ == "__main__":
    solve()

# Optimized solution
import sys
from collections import deque

def q(d, c): #dは9以下、cは桁数
    digsum = d * c
    add = c - 1 + (digsum - 1) // 9
    rem = digsum - 9 * ((digsum - 1) // 9)
    return add, rem

def solve():
    input = sys.stdin.readline
    M = int(eval(input()))
    count = -1
    ans = 0
    for _ in range(M):
        d, c = list(map(int, input().split()))
        add, rem = q(d, c)
        count += add
        ans += rem
        count += 1
        if ans > 9:
            ans -= 9
            count += 1

    print(count)
    
    return 0

if __name__ == "__main__":
    solve()
# Original solution
INF = float("inf")
IINF = 10 ** 18
MOD = 998244353


def main():
    M = int(eval(input()))
    digits = []
    S = 0

    for i in range(M):
        d, c = list(map(int, input().split()))

        if d == 0 and i == 0:
            continue

        for i in range(c):
            digits.append(d)
            S += d

    print(((len(digits) - 1) + (S - 1) // 9))


if __name__ == '__main__':
    main()


# Optimized solution
INF = float("inf")
IINF = 10 ** 18
MOD = 998244353


def main():
    M = int(eval(input()))
    N = 0
    S = 0

    for i in range(M):
        d, c = list(map(int, input().split()))

        if d == 0 and i == 0:
            continue

        S += d * c
        N += c

    print(((N - 1) + (S - 1) // 9))


if __name__ == '__main__':
    main()
# Original solution
def g(i,j):
    if i+j<10:
        return 1,i+j
    else:
        a = i+j
        b = a%10+a//10
        return 2,b
def f(c,d):
    if d==1:
        return 0,c
    if d==2:
        return g(c,c)
    if d%2==0:
        a,b = f(c,d//2)
        x,y = g(b,b)
        return 2*a+x,y
    else:
        a,b = f(c,d-1)
        x,y = g(c,b)
        return a+x,y
M = int(eval(input()))
A = [list(map(int,input().split())) for _ in range(M)]
cnt = 0
B = []
for i in range(M):
    c,d = A[i][0],A[i][1]
    a,b = f(c,d)
    cnt += a
    B.append(b)
b = B[0]
for i in range(1,M):
    a,b = g(b,B[i])
    cnt += a
print(cnt)   


# Optimized solution
def g(i,j):
    if i+j<10:
        return 1,i+j
    else:
        a = i+j
        b = a%10+a//10
        return 2,b
def f(c,d):
    if d==1:
        return 0,c
    if d==2:
        return g(c,c)
    if d%2==0:
        a,b = f(c,d//2)
        x,y = g(b,b)
        return 2*a+x,y
    else:
        a,b = f(c,(d-1)//2)
        x1,y1 = g(b,b)
        x2,y2 = g(c,y1)
        return 2*a+x1+x2,y2
M = int(eval(input()))
A = [list(map(int,input().split())) for _ in range(M)]
cnt = 0
B = []
for i in range(M):
    c,d = A[i][0],A[i][1]
    a,b = f(c,d)
    cnt += a
    B.append(b)
b = B[0]
for i in range(1,M):
    a,b = g(b,B[i])
    cnt += a
print(cnt)
# Original solution
M = int(eval(input()))
ans = 0

c1 = []
for _ in range(M):
    d, c = list(map(int, input().split()))
    v1 = ((d*c)//9)-((d*c)%9==0 and d*c>0)
    v2 = c-1
    ans += v1+v2
    c1.append(d*c-9*v1)

ans += M-1
s = sum(c1)
ans += (s//9)-(s%9==0 and s>0)
print(ans)


# Optimized solution
M = int(eval(input()))
ans, s = 0, 0

for _ in range(M):
    d, c = list(map(int, input().split()))
    s += d*c
    ans += c

ans += (s-1)//9 - 1
print(ans)
# Original solution
M = int(eval(input()))
ans, s = 0, 0

for _ in range(M):
    d, c = list(map(int, input().split()))
    s += d*c
    ans += c

ans += (s-1)//9 - 1
print(ans)


# Optimized solution
import sys
input=sys.stdin.readline


def solve():
    M = int(eval(input()))
    ans, s = 0, 0

    for _ in range(M):
        d, c = list(map(int, input().split()))
        s += d*c
        ans += c

    ans += (s-1)//9 - 1
    print(ans)

solve()
# Original solution
from collections import Counter

mod = 1000000007


def inverse(a):
    return pow(a, mod - 2, mod)


def usearch(x, a):
    lft = 0
    rgt = len(a) + 1
    while rgt - lft > 1:
        mid = (rgt + lft) // 2
        if a[mid] <= x:
            lft = mid
        else:
            rgt = mid
    return lft

memo = [
    [0, 1, 1],
    [1,10,9],
    [2,11,9],
    [3,4,3],
    [4,13,9],
    [5,14,9],
    [6,5,3],
    [7,16,9],
    [8,17,9],
    [9,2,1],
]


def main():
    m = int(eval(input()))
    dc = [[int(i) for i in input().split()] for _ in range(m)]
    s = []
    ans = 0
    for i in range(m):
        d = dc[i][0]
        c = dc[i][1]
        ans += c // memo[d][2] * memo[d][1]
        if d == 9:
            ans -= 2
            s.append([d, 1])
        else:
            s.append([d, (c % memo[d][2])])
    if not s:
        print(ans)
        return

    t = s[0][0]
    s[0][1] -= 1
    for i in range(len(s)):
        while s[i][1]:
            s[i][1] -= 1
            ans += 1
            t += s[i][0]
            if t > 9:
                ans += 1
                t = t % 10 + t // 10

    print(ans)

main()


# Optimized solution
from collections import Counter

mod = 1000000007


def inverse(a):
    return pow(a, mod - 2, mod)


def usearch(x, a):
    lft = 0
    rgt = len(a) + 1
    while rgt - lft > 1:
        mid = (rgt + lft) // 2
        if a[mid] <= x:
            lft = mid
        else:
            rgt = mid
    return lft

def main():
    m = int(eval(input()))
    ans = 0
    a = 0
    for i in range(m):
        d, c = list(map(int, input().split()))
        ans += c
        a += d * c
    print((ans + (a - 1) // 9 - 1))

main()
# Original solution
from collections import deque
M = int(eval(input()))
deq = deque()

for _ in range(M):
  d,c = list(map(int,input().split()))
  for _ in range(c):
    deq.append(d)

def is_handred():
  if deq[0]==1 and deq[1]==0 and deq[2]==0:
    return True
  return False

times = 0
while len(deq) > 1:
  if len(deq) == 3 and is_handred():
    deq = deque([1,0])
  else:
    i,j = deq.popleft(), deq.popleft()
    for x in list(str(i+j)):
      deq.append(int(x))

  times += 1

print(times)

# Optimized solution
M = int(eval(input()))

cur = 0

keta = 0
csum = 0
for _ in range(M):
  d,c = list(map(int,input().split()))
  s = 0
  for i in str(d):
    s += int(i)
  csum += s * c
  keta += c

# 9をカウントしたくないため
print((keta-1 + (csum-1)//9))
# Original solution
m,*t=list(map(int,open(0).read().split()))
*z,=list(zip(*[iter(t)]*2))
a=0
flag=False
for d,c in z:
    if flag:
        m=[b]
    else:
        m=[]
        flag=True
    while c//2:
        cd=c//2
        a+=cd
        if c%2:
            m+=d,
        d*=2
        if d>9:
            a+=cd
            d=sum(map(int,str(d)))
        c=cd
    for t in m[::-1]:
        d+=t
        a+=1
        if d>9:
            d=sum(map(int,str(d)))
            a+=1
    b=d
print(a)

# Optimized solution
m,*t=list(map(int,open(0).read().split()))
a=b=0
for d,c in zip(*[iter(t)]*2):
    m=[b]
    while c//2:
        cd=c//2
        a+=cd
        if c%2:
            m+=d,
        d*=2
        if d>9:
            a+=cd
            d=d//10+d%10
        c=cd
    for t in m[::-1]:
        d+=t
        a+=1
        if d>9:
            d=d//10+d%10
            a+=1
    b=d
print((a-1))
# Original solution
m,*t=list(map(int,open(0).read().split()))
a=b=0
for d,c in zip(*[iter(t)]*2):
    m=[b]
    while c//2:
        cd=c//2
        a+=cd
        if c%2:
            m+=d,
        d*=2
        if d>9:
            a+=cd
            d=d//10+d%10
        c=cd
    for t in m[::-1]:
        d+=t
        a+=1
        if d>9:
            d=d//10+d%10
            a+=1
    b=d
print((a-1))

# Optimized solution
_,*t=open(0)
a=b=0
for t in t:d,c=list(map(int,t.split()));a+=d*c;b+=c
print((~-a//9+b-1))
# Original solution
M = int(eval(input()))
DC = [tuple(map(int,input().split())) for i in range(M)]

sumd = sumc = 0
for d,c in DC:
    sumd += d*c
    sumc += c

ans = sumc-1 + (sumd-1)//9
print(ans)

# Optimized solution
M = int(eval(input()))
DC = [tuple(map(int,input().split())) for i in range(M)]
s = k = 0
for d,c in DC:
    k += c
    s += d*c
ans = k-1 + (s-1)//9
print(ans)
# Original solution
import sys

def answer():
    input = sys.stdin.readline
    M = int(eval(input()))

    Ds = [0] * M
    Cs = [0] * M
    total = 0

    for i in range(M):
        c, d = list(map(int, input().split()))
        Cs[i] = c
        Ds[i] = d
        total += d * c

    digits = sum(Ds)

    ans = (digits-1) + (total-1) // 9

    print(ans)


if __name__ == '__main__':
    answer()


# Optimized solution
import sys

def answer():
    input = sys.stdin.readline
    M = int(eval(input()))

    digits = 0
    total = 0

    for i in range(M):
        c, d = list(map(int, input().split()))
        digits += d
        total += d * c

    ans = (digits-1) + (total-1) // 9

    print(ans)


if __name__ == '__main__':
    answer()
# Original solution
import sys
input=sys.stdin.readline

def main():
    m=int(eval(input()))
    DC=[list(map(int,input().split())) for _ in range(m)]
    s=0
    digit=0
    for d,c in DC:
        digit+=c
        s+=d*c
    ans=digit-1
    m=s%9
    if m==0:
        m=9
    ans+=(s-m)//9
    print(ans)
    
if __name__=='__main__':
    main()

# Optimized solution
import sys
input=sys.stdin.readline

def main():
    m=int(eval(input()))
    DC=[list(map(int,input().split())) for _ in range(m)]
    s=0
    digit=0
    for d,c in DC:
        digit+=c
        s+=d*c
    print((digit-1+(s-1)//9))
    
if __name__=='__main__':
    main()
# Original solution
m = int(eval(input()))
d = [list(map(int, input().split())) for _ in range(m)]
print((sum([x[1] for x in d]) - 1 + (sum([x[0]*x[1] for x in d]) - 1) // 9))


# Optimized solution
M=int(eval(input()))
#Get the number that needs to be handled
num=''
D,C=[],[]
for _ in range(M):
    D1,C1=list(map(int, input().split()))
    D.append(D1)
    C.append(C1)
S = sum(d * c for d, c in zip(D, C))
print((sum(C)-1+(S-1)//9))
# Original solution
m = int(eval(input()))
dc = [list(map(int, input().split())) for _ in range(m)]

def zero(n):
    return n - 1, "0"

def one(n):
    ret = 0
    while n // 10:
        q, r = divmod(n, 10)
        n = q + r
        ret += 10 * q
    return ret, "1" * n

def two(n):
    ret = 0
    q, r = divmod(n, 5)
    ret += 5 * q
    one_cnt, ones = one(q)
    ret += one_cnt
    return ret, ones + "2" * r

def three(n):
    ret = 0
    while n // 4:
        q, r = divmod(n, 4)
        n = q + r
        ret += 4 * q
    return ret, "3" * n

def four(n):
    ret = 0
    q, r = divmod(n, 3)
    ret += 3 * q
    three_cnt, threes = three(q)
    ret += three_cnt
    return ret, threes + "4" * r

def five(n):
    ret = 0
    q, r = divmod(n, 2)
    ret += 2 * q
    one_cnt, ones = one(q)
    ret += one_cnt
    return ret, ones + "5" * r

def six(n):
    ret = 0
    q, r = divmod(n, 2)
    ret += 2 * q
    three_cnt, threes = three(q)
    ret += three_cnt
    return ret, threes + "6" * r

def seven(n):
    ret = 0
    q, r = divmod(n, 2)
    ret += 2 * q
    five_cnt, fives = five(q)
    ret += five_cnt
    return ret, fives + "7" * r

def eight(n):
    ret = 0
    q, r = divmod(n, 2)
    ret += 2 * q
    one_cnt, ones = seven(q)
    ret += one_cnt
    return ret, ones + "8" * r

def nine(n):
    ret = 0
    while n // 2:
        q, r = divmod(n, 2)
        n = q + r
        ret += 2 * q
    return ret, "9" * n

new_dc = []
fs = [zero, one, two, three, four, five, six, seven, eight, nine]
for d, c in dc:
    cnt, s = fs[d](c)
    new_dc.append([cnt, s])

s = ""
cnt = 0
for d, c in new_dc:
    s += c
    cnt += d

while len(s) > 1:
    tmp = int(s[-1]) + int(s[-2])
    s = s[:-2] + str(tmp)
    cnt += 1

print(cnt)


# Optimized solution
m = int(eval(input()))
dc = [list(map(int, input().split())) for _ in range(m)]

sm = 0
n = 0
for d, c in dc:
    sm += d * c
    n += c

ans = n - 1 + (sm - 1) // 9
print(ans)
# Original solution
m = int(eval(input()))
c = []
d = []
for i in range(m):
    D,C = list(map(int,input().split()))
    c.append(C)
    d.append(D)

ans = 0
for i in range(m):
    ans += c[i]*d[i]

print(((ans-1)//9 + sum(c)-1))

# Optimized solution
m = int(eval(input()))
C, D = [], []
for i in range(m):
    d, c = list(map(int, input().split()))
    C.append(c)
    D.append(d)


x = sum([C[i] * D[i] for i in range(m)])
ans = sum(C) - 1 + (x - 1) // 9
print(ans)
# Original solution
from sys import stdin

input = stdin.readline

m, *t = list(map(int, open(0).read().split()))

from functools import lru_cache


@lru_cache()
def cal(d, c):
    if c == 1:
        return [0, d]
    t = 1 + (d + d >= 10)
    a = (d + d >= 10) + (d + d) % 10

    ca = cal(a, c // 2)

    if c % 2:
        return [(c // 2) * t + ca[0] + 1 + (ca[1] + d >= 10), (ca[1] + d >= 10) + (ca[1] + d) % 10]
    else:
        return [(c // 2) * t + ca[0], ca[1]]


ans = 0
now = []
for d, c in zip(*[iter(t)] * 2):
    ca = cal(d, c)
    ans += ca[0]
    now.append(ca[1])

pre = 0
for i in now:
    pre = pre + i
    ans += 1
    if pre >= 10:
        ans += 1
        pre = pre % 10 + 1

print((ans - 1))


# Optimized solution
from sys import stdin

input = stdin.readline

m = int(eval(input()))
dc = []
for _ in range(m):
    d, c = list(map(int,input().split()))
    dc.append((d, c))

def cal(d, c):
    if c == 1:
        return [0, d]
    t = 1 + (d + d >= 10)
    a = (d + d >= 10) + (d + d) % 10

    ca = cal(a, c // 2)

    if c % 2:
        return [(c // 2) * t + ca[0] + 1 + (ca[1] + d >= 10), (ca[1] + d >= 10) + (ca[1] + d) % 10]
    else:
        return [(c // 2) * t + ca[0], ca[1]]


ans = 0
now = []
for d, c in dc:
    ca = cal(d, c)
    ans += ca[0]
    now.append(ca[1])

pre = 0
for i in now:
    pre = pre + i
    ans += 1
    if pre >= 10:
        ans += 1
        pre = pre % 10 + 1

print((ans - 1))
# Original solution
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60


def main():
    M, *DC = list(map(int, read().split()))
    D = DC[::2]
    C = DC[1::2]

    total = sum(d * c for d, c in zip(D, C))
    q, r = divmod(total, 9)
    ans = sum(C) - 1 + q - (r == 0)
    print(ans)
    return


if __name__ == '__main__':
    main()


# Optimized solution
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60


def main():
    M, *DC = list(map(int, read().split()))
    D = DC[::2]
    C = DC[1::2]

    total = sum(d * c for d, c in zip(D, C))
    ans = sum(C) - 1 + (total - 1) // 9
    print(ans)
    return


if __name__ == '__main__':
    main()
# Original solution
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60


def main():
    M, *DC = list(map(int, read().split()))
    D = DC[::2]
    C = DC[1::2]

    total = sum(d * c for d, c in zip(D, C))
    ans = sum(C) - 1 + (total - 1) // 9
    print(ans)
    return


if __name__ == '__main__':
    main()


# Optimized solution
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60


def main():
    M, *DC = list(map(int, read().split()))

    total = digits = 0
    for d, c in zip(DC[::2], DC[1::2]):
        total += d * c
        digits += c

    ans = digits - 1 + (total - 1) // 9

    print(ans)
    return


if __name__ == '__main__':
    main()
# Original solution
m=int(eval(input()))
d=[0]*m
c=[0]*m
for i in range(m):
  d[i],c[i]=list(map(int,input().split()))
a=0
for i in range(m):
  a=a+d[i]*c[i]
print((sum(c)-1+(a-1)//9))

# Optimized solution
m=int(eval(input()))
a=0
b=0
for i in range(m):
  d,c=list(map(int,input().split()))
  a=a+d*c
  b=b+c
print(((a-1)//9+b-1))
# Original solution
while 1:
	n=eval(input())
	if n==0:break
	a=[0]*n
	c=input()
	b=0
	for i in range(100):
		if c[i]=="M":
			a[i%n]+=1
		elif c[i]=="S":
			b+=1+a[i%n]
			a[i%n]=0
		else:
			a[i%n]+=1+b
			b=0
	print(" ".join(map(str,sorted(a))),b)

# Optimized solution
while 1:
	n=eval(input())
	if n==0:break
	a,b,c=[0]*n,0,input()
	for i in range(100):
		if c[i]=="M":
			a[i%n]+=1
		elif c[i]=="S":
			b+=1+a[i%n]
			a[i%n]=0
		else:
			a[i%n]+=1+b
			b=0
	print(" ".join(map(str,sorted(a))),b)
# Original solution
from math import sqrt
from bisect import bisect_left
def circle_center(x1, y1, x2, y2):
    xd = x2 - x1; yd = y2 - y1
    d = xd**2 + yd**2
    k = sqrt((4.0 - d) / d) / 2.0
    xc = (x1 + x2) / 2.0
    yc = (y1 + y2) / 2.0
    return [[xc - k*yd, yc + k*xd], [xc + k*yd, yc - k*xd]]
while 1:
    n = int(input())
    if n==0: break
    p = [list(map(float, input().split())) for i in range(n)]
    p.sort()
    prev = 0
    ans = 1
    for i in range(n):
        bx, by = p[i]
        while bx - p[prev][0] >= 2.0: prev += 1
        for j in range(i+1, n):
            cx, cy = p[j]
            if cx - bx >= 2.0: break
            if (bx - cx)**2 + (by - cy)**2 <= 4.0:
                for ex, ey in circle_center(bx, by, cx, cy):
                    count = 2
                    for k in range(prev, n):
                        if k==i or k==j: continue
                        dx, dy = p[k]
                        if dx - bx >= 2.0: break
                        if (ex - dx)**2 + (ey - dy)**2 <= 1.0:
                            count += 1
                    ans = max(ans, count)
    print(ans)

# Optimized solution
from math import sqrt
from bisect import bisect_left
def circle_center(x1, y1, x2, y2):
    xd = x2 - x1; yd = y2 - y1
    d = xd**2 + yd**2
    k = sqrt((4.0 - d) / d) / 2.0
    xc = (x1 + x2) / 2.0; yc = (y1 + y2) / 2.0
    xd *= k; yd *= k
    return [[xc - yd, yc + xd], [xc + yd, yc - xd]]
while 1:
    n = int(input())
    if n==0: break
    p = sorted(list(map(float, input().split())) for i in range(n))
    prev = 0
    ans = 1
    for i in range(n):
        bx, by = p[i]
        while bx - p[prev][0] >= 2.0: prev += 1
        for j in range(i+1, n):
            cx, cy = p[j]
            if cx - bx >= 2.0: break
            if (bx - cx)**2 + (by - cy)**2 <= 4.0:
                for ex, ey in circle_center(bx, by, cx, cy):
                    count = 2
                    for k in range(prev, n):
                        if k==i or k==j: continue
                        dx, dy = p[k]
                        if dx - ex >= 1.0: break
                        if (ex - dx)**2 + (ey - dy)**2 <= 1.0:
                            count += 1
                    ans = max(ans, count)
    print(ans)
# Original solution
from math import sqrt
from bisect import bisect_left
def circle_center(x1, y1, x2, y2):
    xd = x2 - x1; yd = y2 - y1
    d = xd**2 + yd**2
    k = sqrt((4.0 - d) / d) / 2.0
    xc = (x1 + x2) / 2.0; yc = (y1 + y2) / 2.0
    xd *= k; yd *= k
    return [[xc - yd, yc + xd], [xc + yd, yc - xd]]
while 1:
    n = int(input())
    if n==0: break
    p = sorted(list(map(float, input().split())) for i in range(n))
    px = [e[0] for e in p]; py = [e[1] for e in p]
    prev = 0
    ans = 1
    for i in range(n):
        bx = px[i]; by = py[i]
        while bx - px[prev] >= 2.0: prev += 1
        for j in range(i+1, n):
            cx = px[j]; cy = py[j]
            if cx - bx >= 2.0: break
            if (bx - cx)**2 + (by - cy)**2 <= 4.0:
                for ex, ey in circle_center(bx, by, cx, cy):
                    count = 2
                    for k in range(prev, n):
                        if k==i or k==j: continue
                        dx = px[k]; dy = py[k]
                        if dx - ex >= 1.0: break
                        if (ex - dx)**2 + (ey - dy)**2 <= 1.0:
                            count += 1
                    ans = max(ans, count)
    print(ans)

# Optimized solution
from math import sqrt
def circle_center(x1, y1, x2, y2):
    xd = x2 - x1; yd = y2 - y1
    d = xd**2 + yd**2
    k = sqrt((4.0 - d) / d) / 2.0
    xc = (x1 + x2) / 2.0; yc = (y1 + y2) / 2.0
    xd *= k; yd *= k
    return [[xc - yd, yc + xd], [xc + yd, yc - xd]]
while 1:
    n = int(input())
    if n==0: break
    p = sorted(list(map(float, input().split())) for i in range(n))
    prev = 0
    ans = 1
    for i in range(n):
        bx, by = p[i]
        while bx - p[prev][0] >= 2.0: prev += 1
        for j in range(i+1, n):
            cx, cy = p[j]
            if cx - bx >= 2.0: break
            if abs(by - cy) <= 2.0 and (bx - cx)**2 + (by - cy)**2 <= 4.0:
                for ex, ey in circle_center(bx, by, cx, cy):
                    count = 2
                    for k in range(prev, n):
                        if k==i or k==j: continue
                        dx, dy = p[k]
                        if ex - dx >= 1.0: continue
                        if dx - ex >= 1.0: break
                        if abs(ey - dy) <= 1.0 and (ex - dx)**2 + (ey - dy)**2 <= 1.0:
                            count += 1
                    ans = max(ans, count)
    print(ans)