Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	n, err := strconv.Atoi(nextString())
	if err != nil {
		fmt.Printf("strconv.Atoi failed: %v\n", err)
	}
	return n
}

func main() {
	scanner.Split(bufio.ScanWords)
	points := make([]int, 6)
	for i := 0; i < 6; i++ {
		points[i] = nextInt()
	}
	// fmt.Println(points)
	sort.Slice(points[:4], func(i, j int) bool { return points[i] > points[j] })
	// fmt.Println(points)
	points2 := points[4:]
	sort.Slice(points2, func(i, j int) bool { return points2[i] > points2[j] })
	// fmt.Println(points)

	fmt.Println(points[0] + points[1] + points[2] + points2[0])
}

Python: a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
f=int(input())
x=[a,b,c,d]
s=sum(x)-min(x)
print(s+max(e,f))

Python: a = []
for i in range(6):
    n = int(input())
    a.append(n)
A = a[:4]
c = sorted(A, reverse=True)
x = c[0]
y = c[1]
z = c[2]
if a[4] > a[5]:
    w = a[4]
else:
    w = a[5]
print(x+y+z+w)

Python: x=[]
y=[]


for i in range (4):
    A=int(input())
    x.append(A)
x1=sorted(x,reverse=True)

for j in range (2):
    B=int(input())
    y.append(B)
y1=sorted(y,reverse=True)
   
   
print(x1[0]+x1[1]+x1[2]+y1[0])

Python: a = [int(input()) for i in range(6)]
print(sum(a[0:4])-min(a[0:4]) + max(a[4], a[5]))

Python: tensu1=[]
tensu2=[]
i=0
while i<4:
    s=int(input())
    tensu1.append(s)
    i+=1
tensu1.sort()
while 4<=i and i<6:
    s=int(input())
    tensu2.append(s)
    i+=1
tensu2.sort()
sum1=0
for i in range(1,4):
    sum1+=tensu1[i]
sum2=tensu2[1]
print(sum1+sum2)

Python: # coding: utf-8

science = [int(input()) for i in range(4)]
society = [int(input()) for i in range(2)]

score = 0
score += max(society)
score += sum(science) - min(science)
print(score)

Python: rika=[int(input()) for x in range(4)]
syakai=[int(input()) for x in range(2)]
print(sum(sorted(rika)[-3:])+sorted(syakai)[-1])

Python: A = []
B = []
S = 0
for i in range(4):
    a = int(input())
    A.append(a)
    A.sort(reverse=True)
for j in range(3):
    S = S+A[j]
for i in range(2):
    a = int(input())
    B.append(a)
    B.sort(reverse=True)
for j in range(1):
    S = S+B[j]
print(S)

Python: a=[int(input()) for i in range(6)]
print(sum(a[0:4])-min(a[0:4]) + max(a[4], a[5]))

Python: a,b,c,d,e,f=[int(input()) for i in range(6)]

list_1=[a,b,c,d]
list_2=[e,f]

list_1.remove(min(list_1))
list_2.remove(min(list_2))
print(sum(list_1)+sum(list_2))

Python: a = [int(input()) for i in range(6)]
m=sum(a[0:4])-min(a[0:4])
n=sum(a[4:6])-min(a[4:6])
print(m+n)

Python: x=[]
y=[]

for i in range(4):
    X = int(input())
    x.append(X)
    
for i in range (2):
    Y = int(input())
    y.append(Y)
    
list.sort(x)
    
list.sort(y)
    
print(x[1]+x[2]+x[3]+y[1])

Python: a=[]
b=[]
for i in range(4):
    n=int(input())
    a.append(n)
for i in range (2):
    n=int(input())
    b.append(n)
print(sum(a)-min(a)+max(b))

Python: a,b = [],[]

for i in range(4):
    a.append(int(input()))
    
for i in range(2):
    b.append(int(input()))
    
a.sort(reverse=True)
b.sort(reverse=True)

print(a[0]+a[1]+a[2]+b[0])

Python: A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
F = int(input())

X=[A, B, C, D]
Y=[E, F]

k = sorted(X)
del(k[0])
l = sorted(Y)
del(l[0])
    
n = sum(k)
m = sum(l)

print(n+m)

Python: a=[int(input())for i in range(6)]
r=a[:4]
print(sum(r)-min(r)+max(a[4:]))

Python: sc=sorted([int(input())for i in range(4)])
li=sorted([int(input())for i in range(2)])
print(sc[1]+sc[2]+sc[3]+li[1])

Python: min1,min2=100,100
sum1,sum2=0,0
for i in range(4):
    a=int(input())
    sum1+=a
    if a<min1:
        min1=a
sum1=sum1-min1
for j in range(2):
    b=int(input())
    sum2+=b
    if b<min2:
        min2=b
sum2=sum2-min2
print(sum1+sum2)

Python: import sys
import math
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
f=int(input())
num=[a,b,c,d]
s1=max(a,b,c,d)
s2=sorted(num)[-2]
s3=sorted(num)[-3]
i1=max(e,f)
s_sum=s1+s2+s3
total_max=s_sum+i1
print(total_max)

Python: a = [int(input()) for i in range(6)]
print(sum(a[0:4])-min(a[0:4]) + max(a[4], a[5]))

Python: a=[]
c=[]
for i in range(4):
    b=int(input())
    a.append(b)
A=sum(a)-min(a)
for i in range(2):
    d=int(input())
    c.append(d)
C=sum(c)-min(c)
print(A+C)

Python: # coding: utf-8
# 44

A = [int(input()) for i in range(4)]
B = [int(input()) for i in range(2)]

A.sort()
A.pop(0)

B.sort()
B.pop(0)

print(sum(A)+sum(B))

Python: a = list()
b = list()

for i in range(4):
    a.append(int(input()))

a.sort()


for i in range(2):
    b.append(int(input()))

b.sort()

print(sum(a[1:]+b[1:]))

Python: x = sorted([ int(input()) for i in range(4) ], reverse=True)
y = sorted([ int(input()) for i in range(2) ], reverse=True)
print(sum(x[:3])+sum(y[:1]))

Python: list=[int(input()) for j in range(6)]

x=[list[0],list[1],list[2],list[3]]
y=sorted(x)
sum=0
for i in range(1,4):
    sum+=int(y[i])
    
if list[4]>list[5]:
    sum+=int(list[4])
else:
    sum+=int(list[5])
print(sum)

Python: a = [int(input()) for i in range(6)]
print(sum(a[0:4])-min(a[0:4]) + max(a[4], a[5]))

Python: #(44)科目選択
a=[]
for i in range(4):
    n=int(input())
    a.append(n)
a.sort(reverse=True)
b=[]
for j in range(2):
    m=int(input())
    b.append(m)
b.sort(reverse=True)
sum=0
for k in range(3):
    sum+=a[k]
print(sum+b[0])

Python: L = []
for i in range(4):
    a = int(input())
    L.append(a)
    N = sorted(L) #小さい順に並べる
A = (N[len(N) - 1]) + (N[len(N) - 2]) + (N[len(N) - 3]) #リストNの後ろから1番目＋2番目＋3番目

l = []
for i in range(2):
    b = int(input())
    l.append(b)
    M = sorted(l)
B = (M[len(M) - 1])

print( A + B )

Python: l=[]
m=[]
for i in range(4):
    n=int(input())
    l.append(n)
    l.sort()
for k in range(4,6):
    a=int(input())
    m.append(a)
    m.sort()
l[0]=m[1]    
print(sum(l))

Python: rika=[]
for i in range(4):
    tensu=int(input())
    rika.append(tensu)
    
syakai=[]
for i in range(2):
    tensu=int(input())
    syakai.append(tensu)
    
rika.sort()
syakai.sort()

goukei=sum(rika[1:])+syakai[1]
print(goukei)

Python: list1=[]
list2=[]
sum=0
for i in range(4):
    n1=int(input())
    list1.append(n1)
for j in range(2):
    n2=int(input())
    list2.append(n2)
list1.sort(reverse=True)
for x in range(3):
    sum+=list1[x]
list2.sort(reverse=True)
sum+=list2[0]
print(sum)

Python: a=[input() for i in range(6)]
for i in range(6):
    a[i]=int(a[i])
if a[0]>=a[1] and a[0]>=a[2] and a[0]>=a[3]:
    x=a[0]
    a.pop(0)
elif a[1]>=a[2] and a[1]>=a[3] and a[1]>=a[0]:
    x=a[1]
    a.pop(1)
elif a[2]>=a[3] and a[2]>=a[0] and a[2]>=a[1]:
    x=a[2]
    a.pop(2)
else:
    x=a[3]
    a.pop(3)

if a[0]>=a[1] and a[0]>=a[2]:
    y=a[0]
    a.pop(0)
elif a[1]>=a[2] and a[1]>=a[0]:
    y=a[1]
    a.pop(1)
else:
    y=a[2]
    a.pop(2)

if a[0]>=a[1]:
    z=a[0]
    a.pop(0)
else:
    z=a[1]
    a.pop(1)

if a[1]>=a[2]:
    w=a[1]
else:
    w=a[2]
print(x+y+z+w)

Python: a=[]
b=[]

for i in range(4):
    a.append(int(input()))
for i in range(2):
    b.append(int(input()))

print(sum(a)-min(a)+max(b))

Python: x=[]
y=[]
for i in range(4):
    s=int(input())
    x.append(int(s))
a=min(x)
for i in range(2):
    s=int(input())
    y.append(int(s))
b=max(y)
total=sum(x)
print(total-a+b)

Python: A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
F = int(input())

list1 = []
list1.append(A)
list1.append(B)
list1.append(C)
list1.append(D)

list2 = []
list2.append(E)
list2.append(F)

for i in range(4):
    for j in range(3,0,-1):
        if list1[j-1]<list1[j]:
            list1[j-1],list1[j] = list1[j],list1[j-1]

if list2[0]<list2[1]:
    list2[0],list2[1] = list2[1],list2[0]

sumlist = []
sumlist.append(list1[0])
sumlist.append(list1[1])
sumlist.append(list1[2])
sumlist.append(list2[0])

print(sum(sumlist))