Harryxun/stf_run huggingface dataset:
a,b,x = map(int,input().split())

import math
if x > a**2 * b/2:
  tan = a/(2*b-2*x/a**2)
  t = math.atan(tan)
else:
  tan = 2 * x/(a * b**2)
  t = math.atan(tan)
  
print(90 - math.degrees(t))

### FIXED CODE ###

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

import math
if 2*x > b * a**2:
  tan = 2*(b*a**2-x)/a**3
  t = math.atan(tan)
else:
  tan = (a * b**2)/x/2
  t = math.atan(tan)
  
print(math.degrees(t))
s=input()
t=input()
a=0
b=[]
c=[]
for i in range(len(s)-len(t)):
    b.append(s[i:len(t)+i])


for i in range(len(b)):
    for j in range(len(b[i])):
        if b[i][j]!=t[j]:
            a+=1
    c.append(a)
    a=0
        
print(min(c))

    



### FIXED CODE ###

s=input()
t=input()
import sys
a=0
b=[]
c=[]
if len(s)==len(t):
    for i in range(len(s)):
        if s[i]!=t[i]:
            a+=1
    print(a)
    sys.exit()
for i in range(len(s)-len(t)):
    b.append(s[i:len(t)+i])


for i in range(len(b)):
    for j in range(len(b[i])):
        if b[i][j]!=t[j]:
            a+=1
    c.append(a)
    a=0
        
print(min(c))
N = int(input())
A = list(map(int, input().split()))
A.sort()
i = 0

while i < len(A) - 2:
    if A[i] == A[i + 1]:
        A.pop(i)
        A.pop(i + 2)
        i -= 1
    else:
        i += 1

print(len(A))
        



### FIXED CODE ###

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

B = list(set(A))

if len(B) % 2 == 0:
    print(len(B) - 1)
else:
    print(len(B))
def fill0(s,x,y):
     A[y][x] = 0
     if x < W-1 and A[y][x+1] == s: fill0(s,x+1,y)
     if y < H-1 and A[y+1][x] == s: fill0(s,x,y+1)
     if x > 0   and A[y][x-1] == s: fill0(s,x-1,y)
     if y > 0   and A[y-1][x] == s: fill0(s,x,y-1)

while 1:
     H,W = map(int,raw_input().split())
     if H == 0: break
     A = [list(raw_input()) for i in range(H)]
     ans = 0
     for y in range(H):
          for x in range(W):
               if A[y][x] in ["#","@","*"]:
					try:
	                    fill0(A[y][x],x,y)
	                    ans += 1
                    except:
                    	pass
     print ans

### FIXED CODE ###

import sys
sys.setrecursionlimit(20000)
def solve(h,w,count,c):
    if 0 <= h < H and 0 <= w < W and A[h][w] == c:
        A[h][w] = count
        for dh,dw in zip([1,0,-1,0],[0,1,0,-1]):
            solve(h+dh,w+dw,count,c)
while 1:
    H,W = map(int,raw_input().split())
    if H == W == 0: break
    A = [list(raw_input()) for _ in range(H)]
    count = 0
    for h in range(H):
        for w in range(W):
            if type(A[h][w]) is not int:
                solve(h,w,count,A[h][w])
                count += 1
    print count
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


import numpy as np
N, K = read_ints()
H = read_ints()

dp = np.full((N), float('inf'))
dp[0] = 0
dp[1] = abs(H[0] - H[1])
# Kまで初期化しておかないと厄介なことになる
# i-kのコストは直接飛ぶのが必ず最小になる
dp[1:K+1] = [abs(H[0]-H[k]) for k in range(1, K+1)]


for i in range(K+1, N):
    # i-Kまでのコストリストを作成しておく
    costs = [dp[i-k] + abs(H[i] - H[i - k]) for k in range(1, K + 1)]
    dp[i] = min(costs)

print(int(dp[-1]))


### FIXED CODE ###

import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


import numpy as np
N, K = read_ints()
H = np.array(read_ints())
K = min(len(H), K)

dp = np.full((N), np.inf)
dp[0] = 0
# Kまで初期化しておかないと厄介なことになる
# i-kのコストは直接飛ぶのが必ず最小になる
dp[1:K+1] = np.abs(H[0]-H[1:K+1])

for i in range(K+1, N):
    # i-Kまでのコストリストを作成しておく
    dp[i] = (dp[(i - K):(i)] + np.abs(H[i] - H[(i - K):(i)])).min()


print(int(dp[-1]))


# 配るDPでもやってみる
A = list(map(int,input().split()))
A.insert(0,0)
tot = 0
for i in range(1,N+1):
    tot += abs(A[i]-A[i-1])
tot += abs(A[0]-A[N])
for i in range(1,N):
    a = tot-abs(A[i]-A[i-1])-abs(A[i+1]-A[i])+abs(A[i+1]-A[i-1])
    print(a)
a = tot-abs(A[N]-A[N-1])-abs(0-A[N])+abs(0-A[N-1])
print(a)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
A.insert(0,0)
tot = abs(A[1])+abs(A[N])
for i in range(2,N+1):
    tot += abs(A[i]-A[i-1])
for i in range(1,N+1):
    if i==1:
        print(tot-abs(A[1])-abs(A[2]-A[1])+abs(A[2]))
    elif i==N:
        print(tot-abs(A[N])-abs(A[N]-A[N-1])+abs(A[N-1]))
    else:
        print(tot-abs(A[i]-A[i-1])-abs(A[i+1]-A[i])+abs(A[i+1]-A[i-1]))
n = input()
n = set(n[0], n[1], n[2], n[3])

if len(n)<=2:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

n = input()

if n[0]==n[1]==n[2] or n[1]==n[2]==n[3]:
    print('Yes')
else:
    print('No')
W, H, r, x ,y = list(map(int,input().split()))
 if 0 <= x - r <= x + r = W and 0 <= y - r <= y + r = H:
  print('Yes')
 else:
  print('No')

### FIXED CODE ###

W, H, x, y, r = list(map(int, input().split()))
print('Yes' if 0 <= x - r <= x + r <= W and 0 <= y - r <= y + r <= H else 'No')
import sys

#f = open('sample.txt', 'r')

list_line = sys.stdin.readlines()

for index, element in enumerate(list_line):
    list_line[index] = element.rstrip('\n')

for element in list_line:
    if int(element[0]) == 0 and int(element[2]) == 0:
        sys.exit()
    if(int(element[0]) > int(element[2])):
        print(element[2] + " " + element[0])
    else:
        print(element)

### FIXED CODE ###

import sys


list_line = sys.stdin.readlines()

for index, element in enumerate(list_line):
    list_line[index] = element.rstrip('\n')

for element in list_line:
    x_y_list = element.split(" ")
    x = int(x_y_list[0])
    y = int(x_y_list[1])
    if x == 0 and y == 0:
        sys.exit()
    if x > y:
        print(str(y) + " " + str(x))
    else:
        print(element)
# -*- coading: utf-8 -#-

A = raw_input()
B = A.split( )
C, D = int(B[0]), int(B[1])

if C == 1:
  if D == 1:
    print 'Draw'
  else:
    print 'Alice'
else:
  if D == 1:
    print 'Bob'
  else:
    if C ＞ D:
      print 'Alice'
    elif C ＜ D:
      print 'Bob'
    else:
      print 'Draw'

### FIXED CODE ###

# -*- coading: utf-8 -#-

A = raw_input()
B = A.split()
C, D = int(B[0]), int(B[1])

if C == 1:
  if D == 1:
    print 'Draw'
  else:
    print 'Alice'
else:
  if D == 1:
    print 'Bob'
  else:
    if C > D:
      print 'Alice'
    elif C < D:
      print 'Bob'
    else:
      print 'Draw'
a = int(input())
b = input()
c = int(input())
for i in range(a):
  if b[i] != b[c]:
    b[i] = "*"
print(b)
    

### FIXED CODE ###

a = int(input())
b = list(input())
c = int(input())
for i in range(a):
  if b[i] != b[c-1]:
    b[i] = "*"
print("".join(b))
n=int(input())
s=input()
c=0
for i in range(1,N):
  x=set(s[:i])
  y=set(s[i:])
  a=len(x&y)
  c=max(c,a)
print(c)


### FIXED CODE ###

n=int(input())
s=input()
c=0
for i in range(1,n):
  x=set(s[:i])
  y=set(s[i:])
  a = len(x & y)
  if a > c:
    c = a
print(c)
while True:
    H,W= map(int, input().split())
    s = "#"
    a = H
    b = "."
    for i in range(H):
        if 1<a<H:
            y = s+b*(W-2)+s
            print(y)
            a-=1
        elif a==H or a==1:
            x = s*W
            print(x)
            a-=1
        
        else:
            H==0 and W==0
            break
    print("")

### FIXED CODE ###

while True:
    H,W= map(int, input().split())
    if H==0 and W==0:
        break
    s = "#"
    a = H
    b = "."
    for i in range(H):
        if 1<a<H:
            y = s+b*(W-2)+s
            print(y)
            a-=1
        elif a==H or a==1:
            x = s*W
            print(x)
            a-=1                    
    print("")
s = input()
l = list(s)
a = len(l)-2
print(l[0],end='')
print(a,end='')
print(l[len(l)-1]

### FIXED CODE ###

s = input()
l = list(s)
a = len(l)-2
print(l[0],end='')
print(a,end='')
print(l[len(l)-1])
a,b=input().split()
x,d,y,z=b
nb=int(x)+int(y+z)/100
print(int(a*nb))

### FIXED CODE ###

from decimal import Decimal
a,b=map(Decimal,input().split())
print(int(a*b))
import sys
import time
st = time.perf_counter()
# ------------------------------

N, K = map(int, input().split())
A = list(map(int, input().split()))
A = [i-1 for i in A]

cnt = [-1] * N
cnt[0] = 0
now = 0
for i in range(1, 1001001001):
    now = A[now]
    if cnt[now] == -1:
        cnt[now] = i
    else:
        circle = i - cnt[now]
        t = cnt[now]
        break
if K - t > 0:
    amari = (K - t) % circle
    for _ in range(amari):
    now = A[now]
else:
    now = 0
    for i in range(K):
        now = A[now]
print(now + 1)

# ------------------------------
ed = time.perf_counter()
print('time:', ed-st, file=sys.stderr)


### FIXED CODE ###

import sys
import time
st = time.perf_counter()
# ------------------------------

N, K = map(int, input().split())
A = list(map(int, input().split()))
A = [i-1 for i in A]

cnt = [-1] * N
cnt[0] = 0
now = 0
for i in range(1, 1001001001):
    now = A[now]
    if cnt[now] == -1:
        cnt[now] = i
    else:
        circle = i - cnt[now]
        t = cnt[now]
        break
if K - t > 0:
    amari = (K - t) % circle
    for _ in range(amari):
        now = A[now]
else:
    now = 0
    for i in range(K):
        now = A[now]
print(now + 1)

# ------------------------------
ed = time.perf_counter()
print('time:', ed-st, file=sys.stderr)
n = int(input())
left = [None for i in range(n)]
right = [None for i in range(n)]
root = set(range(n))

for i in range(n):
    i, l, r = map(int, input().split())
    left[i] = l
    right[i] = r
    root -= {l, r}

def Preorder(i):
    if i == -1:
        return
    (l, r) = tree[i]
    print(" {}".format(i), end = "")
    Preorder(left[i])
    Preorder(right[i])

def Inorder(i):
    if i == -1:
        return
    (l, r) = tree[i]
    Inorder(left[i])
    print(" {}".format(i), end = "")
    Inorder(right[i])

def Postorder(i):
    if i == -1:
        return
    (l, r) = tree[i]
    Postorder(left[i])
    Postorder(right[i])
    print(" {}".format(i), end = "")

print("Preorder")
Preorder(root)
print()

print("Inorder")
Inorder(root)
print()

print("Postorder")
Postorder(root)
print

### FIXED CODE ###

n = int(input())
left = [None for i in range(n)]
right = [None for i in range(n)]
root = sum(range(n)) - n - 1

for i in range(n):
    i, l, r = map(int, input().split())
    left[i] = l
    right[i] = r
    root -= (l + r)

def Preorder(i):
    if i == -1:
        return
    print(" {}".format(i), end = "")
    Preorder(left[i])
    Preorder(right[i])

def Inorder(i):
    if i == -1:
        return
    Inorder(left[i])
    print(" {}".format(i), end = "")
    Inorder(right[i])

def Postorder(i):
    if i == -1:
        return
    Postorder(left[i])
    Postorder(right[i])
    print(" {}".format(i), end = "")

print("Preorder")
Preorder(root)
print()

print("Inorder")
Inorder(root)
print()

print("Postorder")
Postorder(root)
print()
text = input()

for i in range(len(text)):
    code = ord(text[i])
    if ord('A') <= code <= ord('Z'):
        result += chr(code + 32)
    elif ord('a') <= code <= ord('z'):
        result += chr(code - 32)
    else:
        result += chr(code)

print(result)

### FIXED CODE ###

text = input()

result = ''
for i in range(len(text)):
    code = ord(text[i])
    if ord('A') <= code <= ord('Z'):
        result += chr(code + 32)
    elif ord('a') <= code <= ord('z'):
        result += chr(code - 32)
    else:
        result += chr(code)

print(result)
n,l = map(int,input().split())
str1 = input()
str2 = input()
str3 = input()

blank = []
blank.append(str1)
blank.append(str2)
blank.append(str3)

blank.sort()
new = blank[0]+blank[1]+blank[2]
print(new)



### FIXED CODE ###

n,l = map(int,input().split())
l = []
for i in range(n):
	string = input()
	l.append(string)


l.sort()
blank = ""
for i in range(len(l)):
	blank = blank + l[i]

print(blank)
N = int(input())

if N%2==0:
  print(N)
else:
  print(2 ＊ N)


### FIXED CODE ###

n = int(input())

if n%2==0:
    print(n)

else:
    print(2 * n)
ef resolve():
    n = int(input())
    v = map(int,input().split())
    c = map(int,input().split())
    s = [x-y for x,y in zip(v,c) if (x-y)>0]
    ans = 0
    if s:
        ans = sum(s)
    print(ans)

if __name__ == "__main__":
    resolve()

### FIXED CODE ###

def resolve():
    n = int(input())
    v = map(int,input().split())
    c = map(int,input().split())
    s = [x-y for x,y in zip(v,c) if (x-y)>0]
    ans = 0
    if s:
        ans = sum(s)
    print(ans)

if __name__ == "__main__":
    resolve()
s = input(input())
a, b = map(int, input())

a_1 = a / s
b_1 = b / s

if b_1 - a_1 > 1 :
    print('OK')
else :
    print('NG')

### FIXED CODE ###

import math as M
k = int(input())
a, b = map(int, input().split())

a_1 = M.floor(a/k)
b_1 = M.floor(b/k)

if a%k == 0 or b%k == 0:
    print('OK')
elif b_1 - a_1 < 1:
    print('NG')

else :
    print('OK')
def main():
    if x =1:
        return 0
    elif x !=1:
        return 1

main()

### FIXED CODE ###

x=int(input())

def main(x):
    if x ==1:
        return 0
    else:
        return 1
print(main(x))
time = T + 0.5
bisckets = (time //   A) * B

print(bisckets)

### FIXED CODE ###

str = input().split()
A = int(str[0])
B = int(str[1])
T = int(str[2])

time = T + 0.5
biscuits = (time //   A) * B

print(int(biscuits))
a=input(int)
s=list(map(int,input().split()))
count=0
min=s[0]
for i in range(0,a):
    if min>=s[i]:
        count+=1
        min=s[i]
print(count) 

### FIXED CODE ###

a=int(input())
s=list(map(int,input().split()))
count=0
min=s[0]
for i in range(0,a):
    if min>=s[i]:
        count+=1
        min=s[i]
print(count)
# import bisect
# import heapq
# import math
# import random
# import sys
# from collections import Counter, defaultdict
# from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
# from functools import lru_cache, reduce
# from itertools import combinations, combinations_with_replacement, product


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args, **kwargs):
    print(*args, **kwargs, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


# @mt
def slv(A, B, C, K):
    ans = A - B if K % 2 == 0 else B - A
    if abs(ans) > 1e+18:
        return 'Unfair'
    return ans


def main():
    A, B, C, K = read_int_n()

    print(slv(A, B, C, K))


if __name__ == '__main__':
    main()


### FIXED CODE ###

import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input()


def read_str_n():
    return list(map(str, input().split()))


# @mt
def slv(A, B, C, K):
    ans = A - B if K % 2 == 0 else B - A
    if abs(ans) > 1e+18:
        return 'Unfair'
    return ans


def main():
    A, B, C, K = read_int_n()

    print(slv(A, B, C, K))


if __name__ == '__main__':
    main()
N = int(input())
X = input()

x_num = int(X, 2)
cnt1 = X.count('1')

p_zero = x_num % (cnt1 + 1)
p_one = x_num % (cnt1 - 1)


def f(cnt):
    if (cnt > 0):
        pcount = p_count(cnt)
        return f(cnt % pcount) + 1
    else:
        return 0


def p_count(x):
    cnt = 0
    while (x > 0):
        if x % 2 != 0:
            cnt += 1
        x //= 2
    return cnt


def f1(x):
    cnt = 0
    while (x > 0):
        x %= bin(x).count('1')
        cnt += 1
    return cnt


for i, x in enumerate(list(X)):
    if (x == '1'):
        #x_num = int(''.join(X), 2)
        if cnt1 - 1 > 0:
            xxx = (p_one - pow(2, (N - (i + 1)), cnt1 - 1)) % (cnt1 - 1)
            xxx += cnt1 - 1 if xxx < 0: else: 0
            print(f1(xxx) + 1)
        else:
            print(0)
    else:
        #x_num = int(''.join(X), 2)
        xxx = (p_zero - pow(2, (N - (i + 1)), cnt1 + 1)) % (cnt1 + 1)
        xxx += cnt1 + 1 if xxx < 0: else: 0
        print(f1(xxx) + 1)

### FIXED CODE ###

#!/usr/bin/env python3
N = int(input())
X = input()

x_num = int(X, 2)
cnt1 = X.count('1')

p_zero = x_num % (cnt1 + 1)
p_one = (x_num % (cnt1 - 1) if cnt1 - 1 > 0 else 1)


def f(cnt):
    if (cnt > 0):
        pcount = p_count(cnt)
        return f(cnt % pcount) + 1
    else:
        return 0


def p_count(x):
    cnt = 0
    while (x > 0):
        if x % 2 != 0:
            cnt += 1
        x //= 2
    return cnt


def f1(x):
    cnt = 0
    while (x > 0):
        x %= bin(x).count('1')
        cnt += 1
    return cnt


for i, x in enumerate(list(X)):
    if (x == '1'):
        #x_num = int(''.join(X), 2)
        if cnt1 - 1 > 0:
            xxx = (p_one - pow(2, (N - (i + 1)), cnt1 - 1)) % (cnt1 - 1)
            xxx += cnt1 - 1 if xxx < 0 else 0
            print(f1(xxx) + 1)
        else:
            print(0)
    else:
        #x_num = int(''.join(X), 2)
        xxx = (p_zero + pow(2, (N - (i + 1)), cnt1 + 1)) % (cnt1 + 1)
        xxx += cnt1 + 1 if xxx < 0 else 0
        print(f1(xxx) + 1)
n = int(input())
A = list(map(int, input().split()))

MAX_N = max(A)+1
cnt = [0] * MAX_N 

for a in A:
  for i in range(1, MAX_N):
    if cnt[a] <= 2: 
      tmp = a * i
      if tmp > MAX_N: break
      cnt[tmp] += 1
ans = 0
for a in tuple(set(A)):
  if cnt[a] == 1:
    ans += 1
print(ans)

### FIXED CODE ###

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

MAX_N = max(A)+1
cnt = [0] * MAX_N 

for a in A:
  for i in range(a, MAX_N, a):
    if cnt[i] <= 2: cnt[i] += 1

ans = 0
for a in A:
  if cnt[a] == 1: ans += 1
print(ans)
a,b,c,k = map(int,input().split())
ans = 0
if k==0 and k%2==0:
    ans = a-b
else:
    ans = b-a
if len(ans)==20:
    print("Unfair")
else:
    print(ans)

### FIXED CODE ###

a,b,c,k = map(int,input().split())
ans = 0
if k==0 or k%2==0:
    ans = a-b
else:
    ans = b-a
if len(str(abs(ans)))==20:
    print("Unfair")
else:
    print(ans)
from collections import *
mod=10**6+3
fac=[0 for i in range(mod-1)]
fac[0]=1
for i in range(0,len(fac)-1):
    fac[i+1]=(fac[i]*(i+1))%mod
Q=int(input())
for q in range(Q):
    x,d,n=map(int,input().split())
    D=pow(d,mod-2,mod)
    a,b=x*D%mod,(x+(n-1)*d)*D%mod
    if d>5:
        if a>=0 and a<b and b<mod-1:
            if a>0:
                value=fac[b]*pow(fac[a-1],mod-2,mod)*pow(d,n,mod)
            elif a==0:
                value=fac[b]*pow(d,n,mod)
            print(value%mod)
        else:
            print(0)
    else:
        print(unko)


### FIXED CODE ###

from collections import *
mod=10**6+3
fac=[0 for i in range(mod)]
fac[0]=1
for i in range(0,len(fac)-1):
    fac[i+1]=(fac[i]*(i+1))%mod
fac[0]=0
Q=int(input())
for q in range(Q):
    x,d,n=map(int,input().split())
    if d>0:
        D=pow(d,mod-2,mod)
        a=(x-d%mod)*D%mod
        b=(a+n)%mod
        if a<b and a+n<mod:
            if a>0:
                value=fac[b]*pow(fac[a],mod-2,mod)*pow(d,n,mod)
            else:
                value=fac[b]*pow(d,n,mod)
            print(value%mod)
        else:
            print(0)
    else:
        print(pow(x,n,mod))
import copy

N = int(input())
A = list(int(i) for i in input().split())
A.insert(0, 0)
A.append(0)
B = copy.deepcopy(A)
Q = 0

for i in range(N):
    A.pop(i+1)
    for j in range(N):            
        Q += abs(A[j] - A[j+1])
    print("%d" % (Q))
    Q = 0
    A = copy.deepcopy(B)

### FIXED CODE ###

A = int(input())
B = int(input())
C = int(input())
D = int(input())

if A > B:
    if C > D:
        print("%d" % (B+D))
    else:
        print("%d" % (B+C))
else:
    if C > D:
        print("%d" % (A+D))
    else:
        print("%d" % (A+C))
n,k = map(int, input().split())
a = list(map(int, input().split()))
if n==1:
  print(*a)
  exit()
g = []
for i in range(n-k):
  b = a[i]
  c = a[i+k-1]
  if c<=0:
    g.append(-b)
  elif b>=0:
    g.append(c)
  else:
    g.append(c-b+min(abs(b),abs(c)))
print(min(g))

### FIXED CODE ###

n,k = map(int, input().split())
if n==1:
  print(abs(int(input())))
  exit()
a = list(map(int, input().split()))
g = []
for i in range(n-k+1):
  b = a[i]
  c = a[i+k-1]
  if c<=0:
    g.append(-b)
  elif b>=0:
    g.append(c)
  else:
    g.append(c-b+min(abs(b),abs(c)))
print(min(g))
N = int(input())
ans = []
lis = []
for i in range(N):
    lis.append(i + 1)
if N % 2 == 0:
    M = (N - 2) * N // 2
    for i in range(1, N):
        for j in range(1, N):
            if j != i and i != lis[-j]:
              	tmp = sorted([i, lis[-j]]) 
                if tmp not in ans:
                    ans.append(tmp)
    print(M)
    for i in range(M):
        print(' '.join(map(str, ans[i])))
else:
    M = (N - 1) ** 2 // 2
    for i in range(1, N):
        for j in range(2, N):
            if j != i + 1 and i != lis[-j]:
              	tmp = sorted([i, lis[-j]])
                if tmp not in ans:
                    ans.append(tmp)
    for i in range(1, N):
        ans.append([N, i])
    print(M)
    for i in range(M):
        print(' '.join(map(str, ans[i])))

### FIXED CODE ###

N = int(input())
ans = []
lis = []
for i in range(N):
    lis.append(i + 1)
if N % 2 == 0:
    M = (N - 2) * N // 2
    for i in range(1, N):
        for j in range(1, N):
            if j != i and i != lis[-j]:
                if sorted([i, lis[-j]]) not in ans:
                    ans.append(sorted([i, lis[-j]]))
    print(M)
    for i in range(M):
        print(' '.join(map(str, ans[i])))
else:
    M = (N - 1) ** 2 // 2
    for i in range(1, N):
        for j in range(2, N):
            if j != i + 1 and i != lis[-j]:
                if sorted([i, lis[-j]]) not in ans:
                    ans.append([i, lis[-j]])
    for i in range(1, N):
        ans.append([N, i])
    print(M)
    for i in range(M):
        print(' '.join(map(str, ans[i])))
n = int(input())

s = set()
for i in range(n):
  s.add(int(input())

print(min(3,len(s)))

### FIXED CODE ###

n = int(input())
 
s = set()
for i in range(n):
  s.add(int(input()))
 
print(len(s))
print(~-(1<<len(bin(int(input()))[2:])))

### FIXED CODE ###

#!/usr/bin/env python3
n, k, *h = map(int, open(0).read().split())
print(sum(sorted(h)[-k-1::-1]))
a = int(input())

for i in range(int(i**0.5),0,-1):
    if a % i == 0:
        print(a/i + i -2)
        break


### FIXED CODE ###

a = list(map(int, input().split()))
if 1<=a[0] and a[0]<=9:
    if 1<=a[1] and a[1]<=9:
        print(a[0]*a[1])
    else:
        print(-1)
else:
    print(-1)
N, K = map(int, input().split())
withSnacks = []
for x in range(K):
  nUmsnakes = int(input)
  snakes = list(map(int, input().split()))
  withSnacks.extend(snakes)
withSnacks = list(set(withSnacks))
count = 0
for x in range(1, x + 1):
  if not x in withSnacks:
    count += 1

print(count)
  
    

### FIXED CODE ###

N, K = map(int, input().split())
withSnacks = []
for x in range(K):
	nUmsnakes = int(input())
	snakes = list(map(int, input().split()))
	withSnacks.extend(snakes)
withSnacks = list(set(withSnacks))
count = 0
for x in range(1, N + 1):
	if not x in withSnacks:
		count += 1
 
print(count)