Harryxun/stf_run huggingface dataset:
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")
S = str(input())
odd = ""
even = ""
flag=0
for i in range(len(S)):
  if i % 2 == 0:
    odd += S[i]
  else:
    even += S[i]    
odd = list(set(odd))
even = list(set(even))
if len(odd) <= 3 and len(even) <= 3:
  for i in range(len(odd)):
    if (odd[i] == 'R') or (odd[i] == 'U') or (odd[i] == 'D'):
      pass
    else:
      flag=1
  for i in range(len(even)):
    if (odd[i] == 'L') or (odd[i] == 'U') or (odd[i] == 'D'):
      pass
    else:
      flag=1
  if flag==0:
    print('Yes')
  else:
    print('No')
else:
  print('No')


### FIXED CODE ###

S = str(input())
for i in range(len(S)):
  if i % 2 == 0:
    if S[i] == 'L':
      print('No')
      exit()
    else:
      pass
  else:
    if S[i] == 'R':
      print('No')
      exit()
    else:
      pass
print('Yes')
a,b,c,d = map(int, raw_input().split())
m = a*c
n = a*d
o = b*c
p = b*d
if(m>n and m>o and m>p):
    print(m)
elif (n>m and n>o and n>p):
    print(n)
elif (o> m and o>n and o>p):
    print(o)
else:
    print(p)


### FIXED CODE ###

a,b,c,d = map(int, input().split())
m = a*c
n = a*d
o = b*c
p = b*d
if(m>n and m>o and m>p):
    print(m)
elif (n>m and n>o and n>p):
    print(n)
elif (o> m and o>n and o>p):
    print(o)
else:
    print(p)
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

s = STR()
if len(s) < 26:
    for i in range(26):
        tmp = chr(i + ord('a'))
        if not tmp in s:
            print(s + tmp)
            exit()
else:
    for i in reversed(26):
        for j in range(ord(s[i]) + 1, ord('z') + 1):
            if not chr(j) in s[:i]:
                print(s[:i] + chr(j))
                exit()
    print(-1)
    exit()

### FIXED CODE ###

import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

s = STR()
if len(s) < 26:
    for i in range(26):
        tmp = chr(i + ord('a'))
        if not tmp in s:
            print(s + tmp)
            exit()
if len(set(s)) == 26:
    for i in reversed(range(len(s))):
        for j in range(ord(s[i]) + 1, ord('z') + 1):
            if not chr(j) in s[:i]:
                print(s[:i] + chr(j))
                exit()
    print(-1)
    exit()
ans = [i for i in s]
for i in reversed(range(len(s))):
    tmp = chr(ans[i] + 1)
    if not tmp in ans:
        ans[i] = tmp
    print(''.join(ans))
import numpy as np
import functools
import math
import collections
import scipy
import fractions
import itertools

def solve():
  a, b, c, d = map(int, input().split())
  a -= 1
  lc = (c*d)//math.gcd(c,d)
  ans = (b-a)-(b//c-a//c)-(b//d-a//d)+(b//lc-a//lc)
  print(ans)
  return 0
 
if __name__ == "__main__":
  solve()


### FIXED CODE ###

import numpy as np
import functools
import math
import collections
import scipy
import fractions
import itertools
 
def solve():
  a, b, c, d = map(int, input().split())
  a -= 1
  lc = (c*d)//fractions.gcd(c,d)
  ans = (b-a)-(b//c-a//c)-(b//d-a//d)+(b//lc-a//lc)
  print(ans)
  return 0
 
if __name__ == "__main__":
  solve()
n = int(input())
print(r ** 2 * 3)

### FIXED CODE ###

n = int(input())
print(n ** 2 * 3)
print(chr(ord(input())+1)

### FIXED CODE ###

print(chr(ord(input())+1))
pi = 3.14159265359 
r = int(input()) 
area = pi*pi*r 
length = pi*r*2 

print('{:.6f}'.format(area),'{:.6f}'.format(length))


### FIXED CODE ###

pi = 3.14159265359 
r = float(input()) 
area = r*r*pi 
length = 2*r*pi 

print('{:.6f}'.format(area),'{:.6f}'.format(length))
A = input()
b,c = (A.split(' '))
d = int(b)
e = int(c)
f = e - 100d + 1000

if 0 < d < 11:
    print(f)
else:
    print(e)

### FIXED CODE ###

A = input()
b,c = (A.split(' '))
d = int(b)
e = int(c)
f = e - d * 100 + 1000

if 0 < d < 11:
    print(f)
else:
    print(e)
import math
from functools import reduce

def main():
    n = int(input())  #nは入力回数
    t = [int(input()) for _ in range(n)]

    if not (1 <= n and n <= 100 and isinstance(n, int)):
        return
    for i in t:
        if not (1 <= i and i <= 10**18 and isinstance(i, int)):
            return

    k = lcm_list(t)
    if k <= 10**18:
        print(k)

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

if __name__ == "__main__":
    main()

### FIXED CODE ###

import fractions

def main():
    n = int(input())  #nは入力回数
    t = [int(input()) for _ in range(n)]

    if not (1 <= n and n <= 100 and isinstance(n, int)):
        return
    for i in t:
        if not (1 <= i and i <= 10**18 and isinstance(i, int)):
            return

    k = t[0]
    for i in range(1, n):
        k = k * t[i] // fractions.gcd(k, t[i])

    if k <= 10**18:
        print(k)

if __name__ == "__main__":
    main()
L = input()
n = len(L)
mod = 10**9+8
dp1 = [0]*(n+1)
dp2 = [0]*(n+1)
dp1[0] = 1
for i in range(n):
    if L[i] == "1":
        dp1[i+1] = (dp[i]*2)%mod
        dp2[i+1] = (dp1[i] + dp2[i]*3)%mod
    else:
        dp1[i+1] = dp1[i]
        dp2[i+1] = (dp2[i]*3)%mod
print((dp1[n]+dp2[n])%mod)

### FIXED CODE ###

L = input()
n = len(L)
mod = 10**9+7
dp1 = [0]*(n+1)
dp2 = [0]*(n+1)
dp1[0] = 1
for i in range(n):
    if L[i] == "1":
        dp1[i+1] = (dp1[i]*2)%mod
        dp2[i+1] = (dp1[i] + dp2[i]*3)%mod
    else:
        dp1[i+1] = dp1[i]
        dp2[i+1] = (dp2[i]*3)%mod
print((dp1[n]+dp2[n])%mod)
N = int(input())
L = list(map(int, input().split()))

L_max = max(L)

print(L_max)

L_Down =sorted(L,reverse=True)

print(L_Down)

L_Down_Re = L_Down[1:len(L_Down)]

print(L_Down_Re)

L_Down_Re_Sum =  sum(L_Down_Re)

print(L_Down_Re_Sum)

if L_max <= L_Down_Re_Sum:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

T, X = map(int, input().split())
print(T / X)
a=int(input().split())
check=0
if a[0]+a[1]==15:
    check=1
elif a[0]*a[1]=15:
    check=2

if check==1:
    print("+")
elif check==2:
    print("*")
else:
    print("x")


### FIXED CODE ###

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

check=0
if a[0]+a[1]==15:
    check=1
elif a[0]*a[1]==15:
    check=2

if check==1:
    print("+")
elif check==2:
    print("*")
else:
    print("x")
import itertools
N, M, Q = input().split()
N = int(N)
M = int(M)
Q = int(Q)
num = [0]*Q
for i in range(Q):
  num[i] = [list(map(int,input().split()))]
num = list(range(1, M+1))
A = []
for v in itertools.combinations(num, N):
  A.append(list(v))
score = 0
for w in A:
  scoreX = 0
  for j in range(Q):
    b = num[j][1]
    a = num[j][0]
    if num[j][2] == w[b-1]-w[a-1]:
      scoreX += num[j][3]
  if scoreX > score:
    score = scoreX
print(str(score))

### FIXED CODE ###

import itertools
N, M, Q = input().split()
N = int(N)
M = int(M)
Q = int(Q)
Num = [0 for i in range(Q)]
for i in range(Q):
  Num[i] = list(map(int,input().split()))
num = list(range(1, M+1))
A = []
for v in itertools.combinations_with_replacement(num, N):
  A.append(list(v))
score = 0
for w in A:
  scoreX = 0
  for j in range(Q):
    b = Num[j][1]
    a = Num[j][0]
    if Num[j][2] == w[b-1]-w[a-1]:
      scoreX += Num[j][3]
  if scoreX > score:
    score = scoreX
print(str(score))
import numpy as np
from collections import deque
H, W = map(int, input().split())
grid = [list(input()) for _ in range(H)]

d = np.full((H, W), 2001)


def bfs(i, j):
    q = deque()
    q.append((i, j))
    d[i][j] = 0

    while len(q):
        x, y = q.popleft()
        for dx, dy in [(1, 0), (-1, 0), (0, 1), (0, -1)]:
            nx = x + dx
            ny = y + dy

            if (0 <= nx < H) and (0 <= ny < W) and d[nx][ny] > d[x][y] + 1:
                q.append((nx, ny))
                if grid[nx][ny] == '#':
                    d[nx][ny] = 0
                else:
                    d[nx][ny] = d[x][y] + 1


for i in range(H):
    for j in range(W):
        if grid[i][j] == '#':
            bfs(i, j)
            break
    else:
        continue
    break

print(np.amax(d))


### FIXED CODE ###

from collections import deque
H, W = map(int, input().split())
grid = [list(input()) for _ in range(H)]

# d = [[2001] * W for _ in range(H)]


def bfs(q):
    res_q = deque()
    while len(q):
        x, y = q.popleft()
        for dx, dy in [(1, 0), (-1, 0), (0, 1), (0, -1)]:
            nx = x + dx
            ny = y + dy

            if (0 <= nx < H) and (0 <= ny < W) and grid[nx][ny] != '#':
                res_q.append((nx, ny))
                grid[nx][ny] = '#'
    return res_q


q = deque()
for i in range(H):
    for j in range(W):
        if grid[i][j] == '#':
            q.append((i, j))

res = 0
while len(q):
    res += 1
    q = bfs(q)

print(res - 1)
# coding: utf-8
import heepq

n, m = map(int, input().split())
s = list(map(lamda x: int(x)*(-1), input().split()))
heapq.heapify(s)

for i in range(m):
  maxi = heapq.heappop(s)
  heapq.heappush(s, maxi // 2)

print(-sum(s))

### FIXED CODE ###

# coding: utf-8
import heapq

n, m = map(int, input().split())
s = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(s)

for i in range(m):
  maxi = heapq.heappop(s)
  heapq.heappush(s, -(-maxi // 2))

print(-sum(s))
import sys
from itertools import combinations, permutations
input = sys.stdin.readline
N, K = [int(x) for x in input().strip().split()]
d = {}

def pascals_triangle(a, b):
    l = [1]
    for i in range(2, a+2):
        l_ = l[:]
        l = [l_[0]] * i
        for j in range(1, i - 1):
            l[j] = l_[j-1] + l_[j]
    return l[b]
            
for i in range(1, K + 1):
    ans = 0
    if not (K-1, i-1) in d:
        d[(K-1, i-1)] = pascals_triangle(K-1, i-1)    
    blue_ball = d[(K-1, i-1)]
    if not (N-K+1, i) in d:
        d[(N-K+1, i)] = pascals_triangle(N-K+1, i)
    red_ball = d[(N-K+1, i)]
    ans += (blue_ball * red_ball) % (10 ** 9 + 7)
    print(ans)

### FIXED CODE ###

import sys
from itertools import combinations, permutations
input = sys.stdin.readline
N, K = [int(x) for x in input().strip().split()]
d = {}

pascals_triangle = [1] * 2001
pascals_triangle[0] = [1]
for i in range(1, 2001):
    pascals_triangle[i] = [pascals_triangle[i-1][0]] * (i+1)
    for j in range(1, i):
        pascals_triangle[i][j] = pascals_triangle[i-1][j-1] + pascals_triangle[i-1][j]

for i in range(1, K + 1):
    if i > N - K + 1:
        print(0)
        continue
    ans = 0
    blue_ball = pascals_triangle[K-1][i-1]
    red_ball = pascals_triangle[N-K+1][i]
    ans += (blue_ball * red_ball) % (10 ** 9 + 7)
    print(ans)
import sys
from collections import deque
input = sys.stdin.readline
n,m = map(int,input().split())
ab = [list(map(int,input().split())) for i in range(n-1+m)]
tree_go = [[] for i in range(n+1)]
tree_come = [[] for i in range(n+1)]
excess = [0 for i in range(n+1)]
for a,b in ab:
  tree_go[a].append(b)
  tree_come[b].append(a)
for i in range(1,n+1):
  if tree_come[i] == []:
    root = i
  if len(tree_come[i]) >= 2:
    excess[i] = len(tree_come[i])-1
que = deque([(root,0)])
parent = [0 for i in range(n+1)]
visited = [0 for i in range(n+1)]
while que:
  x,px = que.popleft()
  parent[x] = px
  if excess[x] >= 1:
    excess[x] -= 1
    continue
  for y in tree_go[x]:
    que.append((y,x))
print(*parent[1:],sep="\n")


### FIXED CODE ###

n,a,b = map(int,input().split())
print(min(a,b),max(0,a+b-n))
import sys
input = sys.stdin.readline
a, b, c, d = (int(i) for i in input().split())

### FIXED CODE ###

import sys
input = sys.stdin.readline
a, b, c = (int(i) for i in input().split())
print(min(a+b,b+c,c+a))
N = int((input()))
S = input().split()
s=[]
b=[]
#print(S)
for i in range (N):
  s.append(int(S[i]))
#print(s)
for i in range(N):
  if s[i]==i+1:
    pass
  else:
    b.append(i)
#print(b)
if len(b)<3:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

A,B = map(int,input().split())
if (A+B)%2==0:
  print(int((A+B)/2))
else:
  print("IMPOSSIBLE")
R = int(input)
h = 2*R*3.14

print(h)

### FIXED CODE ###

R = int(input())
h = 2*R*3.14

print(h)
# -*- coding: utf-8 -*-

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

max = 0
ans = "Yes"
for i in range(N):
    if max - H[i] > 1:
        ans = "No"
        break
    max = max(max, H[i])

print(ans)



### FIXED CODE ###

# -*- coding: utf-8 -*-

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

print(max(C-(A-B), 0))
#ABC117B
n = int(input())
l = [int(input()) for i in range(n)]
print("Yes" if max(l) >= (sum(l)-max(l)) else "No")

### FIXED CODE ###

#ABC117B
n = int(input())
l = list(map(int,input().split()))
print("Yes" if max(l) < (sum(l)-max(l)) else "No")
a,b=map(int,input().split())

num = int('a'+'b')
import math
sq = math.sqrt(num)
if isinstance(sq, int):
  print('Yes')
else:
  print('No')

### FIXED CODE ###

num = int(input().replace(" ",""))
print("Yes" if (num**0.5)%1==0 else "No" )
D,N=map(int,input().split())
if N==100:
  (N+1*(100**D)
else:
  print(N*(100**D)


### FIXED CODE ###

D,N=map(int,input().split())
if N==100:
  print((N+1)*(100**D))
else:
  print(N*(100**D))
a = []
while True:
    n = input()
    if (n == 0):
        break
    a.append(n)

### FIXED CODE ###

i=1
while(1):
    n=input()
    if(int(n)==0):
        break
    else:
        print('Case '+str(i)+': '+n)
        i+=1
k, s = map(int, input().rstrip("\n").split())
print(sum([x + y + z == s for x in range(k + 1) for y in range(k + 1) for z in range(k + 1)]))


### FIXED CODE ###

print(input().replace(",", " "))
s=list(input())
t=list(input())
dp=[[0]*(30) for j in range(30)]
ans=[]
memo=-1
for i in range(len(s)):
    for j in range(len(t)):
        if s[i]==t[j]:
             dp[i+1][j+1] = dp[i][j]+1
             if memo < i:
                 ans.append(t[j])
                 memo = i

        else:
            dp[i+1][j+1] =max(dp[i][j+1],dp[i+1][j])

#print(dp[len(s)][len(t)])
answer=[]
i,j=len(s),len(t)
d=dp[i-1][j-1]
while i!=0 or j!=0:
    if dp[i-1][j-1]!=dp[i][j]:
        answer.append(s[i-1])
        i-=1
        j-=1
    elif dp[i-1][j]==dp[i][j]:
        i-=1
    else:
        j-=1
print("".join(reversed(answer)))

### FIXED CODE ###

s=list(input())
t=list(input())
dp=[[0]*(3030) for j in range(3030)]
ans=[]
memo=-1
for i in range(len(s)):
    for j in range(len(t)):
        if s[i]==t[j]:
             dp[i+1][j+1] = dp[i][j]+1
             if memo < i:
                 ans.append(t[j])
                 memo = i

        else:
            dp[i+1][j+1] =max(dp[i][j+1],dp[i+1][j])

#print(dp[len(s)][len(t)])
answer=[]
i,j=len(s),len(t)
d=dp[i-1][j-1]
while i>=0 and j>=0:

    if dp[i-1][j]==dp[i][j]:
        i-=1
    elif dp[i][j-1]==dp[i][j]:
        j-=1
    else:
        answer.append(s[i - 1])
        i -= 1
        j -= 1
print("".join(reversed(answer)))
#!/usr/bin/env python3
import bisect
import heapq
import itertools
import math
import numpy as np
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from math import gcd
from operator import add, itemgetter, mul, xor
def cmb(n,r,mod):
  bunshi=1
  bunbo=1
  for i in range(r):
    bunbo = bunbo*(i+1)%mod
    bunshi = bunshi*(n-i)%mod
  return (bunshi*pow(bunbo,mod-2,mod))%mod
mod = 10**9+7
def I(): return int(input())
def LI(): return list(map(int,input().split()))
def MI(): return map(int,input().split())
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]



#いまいるところ,
#listとnが与えられたときn回テレポートしたところを出力する
def now_place(li,n):
    now = 1
    for i in range(n):
        now = li[now-1]
    return now

#p回のテレポートでたどってきた道筋のルートを返す

def root(li,p):
    ans = []
    now = 1
    for j in range(p):
        ans.append(now_place(li,j+1))
    return ans



n,k = MI()
a = LI()
#訪れたところのメモがtown
town　= []
#訪れたかどうかを0と1で管理
visit=[0]*n
p = 1
while visit[p-1] == 0:
    town.append(p)
    visit[p-1] = 1
    p = a[p-1]
#香りだかい町がいつでてきたか→周期に入るまでのテレポート回数
#len(town[l:])は周期を表す
l = town.index(p)
if k <len(town):
    print(town[k])
else:
    print(town[l + (k-l)%(len(town[l:]))])

### FIXED CODE ###

s = input()
t=input()
if t[:-1] == s:
    print("Yes")
else:
    print("No")
N, M = map(int, input().split())
nodes = [[] for _ in range(N)]

for _ in range(M):
  x, y = map(int, input().split())
  nodes[x-1].append(y-1)

dp = [-1] * N

def judge(index):
  if dp[index] != -1:
    return dp[index]
  elif not nodes[index]:
    dp[index] = 0
    return 0
  else:
    dp[index] = max(1 + judge(i) for i in nodes[index])
    return dp[index]
    
for i in range(N):
  judge(i)
print(max(dp))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**5 + 1)

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

for _ in range(M):
  x, y = map(int, input().split())
  nodes[x-1].append(y-1)

dp = [-1] * N

def judge(index):
  if dp[index] != -1:
    return dp[index]
  else:
    edges = 0
    for i in nodes[index]:
      edges = max(edges, 1+judge(i))
    dp[index] = edges
    return edges

answer = 0  
for i in range(N):
  answer = max(answer, judge(i))
print(answer)
import heapq
r, c, k = map(int, input().split())
itm = [[0]*c for _ in range(r)]
for i in range(k):
  ri, ci, vi = map(int, input().split())
  itm[ri-1][ci-1] = vi
dp = [0]*c
for i in range(r):
  que = []
  heapq.heapify(que)
  nowv = itm[i][0]
  if nowv > 0:
    heapq.heappush(que, nowv)
    dp[0] += nowv
  for j in range(1, c):
    nowv = itm[i][j]
    if nowv > 0:
      heapq.heappush(que, nowv)
      if len(que)>3:
        prev = heapq.heappop(que)
      else:
        prev = 0
    sumv1 = dp[j] + nowv#上から
    sumv2 = dp[j-1] + nowv - prev#左から
    if sumv1 >= sumv2:
      dp[j] = sumv1
      que = []
      heapq.heapify(que)
      if nowv > 0:
        heapq.heappush(que, nowv)
    else:
      dp[j] = sumv2
print(dp[-1])

### FIXED CODE ###

#!/usr/bin python3
# -*- coding: utf-8 -*-

r, c, k = map(int, input().split())
itm = [[0]*(c) for _ in range(r)]
for i in range(k):
    ri, ci, vi = map(int, input().split())
    itm[ri-1][ci-1] = vi

dp0 = [[0]*4 for c_ in range(3005)]
dp1 = [[0]*4 for c_ in range(3005)]

for i in range(r):
    for j in range(c):
        nowv = itm[i][j]
        dp0[j][3] = max(dp0[j][3], dp0[j][2] + nowv)
        dp0[j][2] = max(dp0[j][2], dp0[j][1] + nowv)
        dp0[j][1] = max(dp0[j][1], dp0[j][0] + nowv)

        dp0[j+1][0] = max(dp0[j+1][0], dp0[j][0])
        dp0[j+1][1] = max(dp0[j+1][1], dp0[j][1])
        dp0[j+1][2] = max(dp0[j+1][2], dp0[j][2])
        dp0[j+1][3] = max(dp0[j+1][3], dp0[j][3])

        dp1[j][0] = max(dp1[j][0], max(dp0[j]))
    dp0 = dp1.copy()

print(max(dp1[c-1]))
n = int(input())
c = []
not_c = []
chosen = set()
ans = 0
for i in range(n):
	a, b = map(int, input().split())
	not_c.append([max(a, b), i])
	c.append([min(a, b), i])
	ans += min(a, b)
	if a < b:
		chosen.add("a")
	elif a > b:
		chosen.add("b")

if len(chosen) < 2:
	print(ans)
else:
	c = sorted(c, reverse=True)
	not_c = sorted(not_c)
	#print(c, not_c)
	#used_c = [False] * n
	#used_n = [False] * n

	if c[0][1] != not_c[0][1]:
		ans = ans - c[0][0] + not_c[0][0]
		c_cur = 1
		not_cur = 1
	else:
		ans = min(ans - c[1][0] + not_c[0][0], ans - c[0][0] + not_c[1][0])
		if ans - c[1][0] + not_c[0][0] <= ans - c[0][0] + not_c[1][0]:
			c_cur = 2
			not_cur = 1
		else:
			c_cur = 1
			not_c = 2
	while c[c_cur][0] > not_c[not_cur][0]:
		if c[c_cur][1] != not_c[not_cur][1]:
			ans = ans - c[c_cur][0] + not_c[not_cur][0]
			c_cur += 1
			not_cur += 1
		else:
			ans = min(ans - c[c_cur+1][0] + not_c[not_cur][0], ans - c[c_cur][0] + not_c[not_cur+1][0])
			if ans - c[c_cur+1][0] + not_c[not_cur][0] <= ans - c[c_cur][0] + not_c[not_cur+1][0]:
				c_cur += 2
				not_cur += 1
			else:
				c_cur += 1
				not_c += 2
	print(ans)


### FIXED CODE ###

n = int(input())
c = []
not_c = []
chosen = set()
ans = 0
for i in range(n):
	a, b = map(int, input().split())
	not_c.append([max(a, b), i])
	c.append([min(a, b), i])
	ans += min(a, b)
	if a < b:
		chosen.add("a")
	elif a > b:
		chosen.add("b")

if len(chosen) < 2:
	print(ans)
else:
	c = sorted(c, reverse=True)
	not_c = sorted(not_c)
	#print(c, not_c)
	#used_c = [False] * n
	#used_n = [False] * n

	if c[0][1] != not_c[0][1]:
		ans = ans - c[0][0] + not_c[0][0]
		c_cur = 1
		not_cur = 1
	else:
		ans = min(ans - c[1][0] + not_c[0][0], ans - c[0][0] + not_c[1][0])
		if ans - c[1][0] + not_c[0][0] <= ans - c[0][0] + not_c[1][0]:
			c_cur = 2
			not_cur = 1
		else:
			c_cur = 1
			not_cur = 2
	if c_cur < n and not_cur < n:
		while c[c_cur][0] > not_c[not_cur][0]:
			if c[c_cur][1] != not_c[not_cur][1]:
				ans = ans - c[c_cur][0] + not_c[not_cur][0]
				c_cur += 1
				not_cur += 1
			elif c_cur == n - 1 or not_cur == n - 1:
				break
			else:
				ans = min(ans - c[c_cur+1][0] + not_c[not_cur][0], ans - c[c_cur][0] + not_c[not_cur+1][0])
				if ans - c[c_cur+1][0] + not_c[not_cur][0] <= ans - c[c_cur][0] + not_c[not_cur+1][0]:
					c_cur += 2
					not_cur += 1
				else:
					c_cur += 1
					not_cur += 2
			if c_cur >= n or not_cur >= n:
				break
	print(ans)
N = int(input())
S = input()

l = len(S)
if l % 2 == 1:
  print("No")
else:
  if S[0:N/2] == S[N/2+1:N]:
    print("Yes")
  else:
    print("No")

### FIXED CODE ###

N = int(input())
S = input()

l = len(S)
if l % 2 == 1:
  print("No")
else:
  if S[0:int(N/2)] == S[int(N/2):int(N)]:
    print("Yes")
  else:
    print("No")