2565_1_Quiz_1_2

Max Score = 100


6531313221
# 1638779, 2022-09-24 09:15:01, P-xx[--][PxPx] (17%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    str = str(a+b+c)
    return str[0]


def f4(a, b, c):
    str = str(a+b+c)
    return str[-1]


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1638866, 2022-09-24 09:17:02, PP--[--][P-P-] (33%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = str(abs(a+b+c))
    return s[0]


def f4(a, b, c):
    s = str(a+b+c)
    return s[-1]


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1639261, 2022-09-24 09:25:53, PP-P[--][P-P-] (50%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = str(abs(a+b+c))
    return s[0]


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1639365, 2022-09-24 09:28:37, PP-P[--][P-P-] (50%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = str(abs(a+b+c))
    return s[0]


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    elif s1 != 1 or s2 != 1:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1639384, 2022-09-24 09:29:05, PP-P[PP][PPPP] (83%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = str(abs(a+b+c))
    return s[0]


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    elif s1 not in [0, 1] or s2 not in [0, 1]:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1639396, 2022-09-24 09:29:22, PP-P[PP][PPPP] (83%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = str(abs(a+b+c))
    return s[0]


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    elif s1 not in [0, 1] or s2 not in [0, 1]:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1639424, 2022-09-24 09:30:05, PP-P[PP][PPPP] (83%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = str(abs(a+b+c))
    return s[0]


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1639448, 2022-09-24 09:30:38, PPxP[PP][PxPx] (67%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = str(abs(a+b+c))
    return s[0]+10


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1639531, 2022-09-24 09:32:33, PPPP[PP][PPPP] (100%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = abs(a+b+c)
    while True:
        if s//10 == 0:
            break
        s = s//10
    return s


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1640120, 2022-09-24 09:48:57, PP-P[PP][PPPP] (83%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = abs(a+b+c)
    if False:
        while True:
            if s//10 == 0:
                break
            s = s//10
        return s
    else:
        return str(s)[0]


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1640133, 2022-09-24 09:49:15, PPPP[PP][PPPP] (100%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = abs(a+b+c)
    if s > 0:
        while True:
            if s//10 == 0:
                break
            s = s//10
        return s
    else:
        return str(s)[0]


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1640274, 2022-09-24 09:52:50, PPPP[PP][PPPP] (100%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = abs(a+b+c)
    if s > 500:
        while True:
            if s//10 == 0:
                break
            s = s//10
        return s
    else:
        return str(s)[0]


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1640279, 2022-09-24 09:53:01, PPPP[PP][PPPP] (100%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = abs(a+b+c)
    if s > 250:
        while True:
            if s//10 == 0:
                break
            s = s//10
        return s
    else:
        return str(s)[0]


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1640286, 2022-09-24 09:53:16, PP-P[PP][PPPP] (83%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = abs(a+b+c)
    if s < 250:
        while True:
            if s//10 == 0:
                break
            s = s//10
        return s
    else:
        return str(s)[0]


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1640296, 2022-09-24 09:53:32, PP-P[PP][PPPP] (83%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = abs(a+b+c)
    if s < 750:
        while True:
            if s//10 == 0:
                break
            s = s//10
        return s
    else:
        return str(s)[0]


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1640305, 2022-09-24 09:53:45, PP-P[PP][PPPP] (83%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = abs(a+b+c)
    if s < 1500:
        while True:
            if s//10 == 0:
                break
            s = s//10
        return s
    else:
        return str(s)[0]


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1640311, 2022-09-24 09:53:58, PP-P[PP][PPPP] (83%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = abs(a+b+c)
    if s < 2500:
        while True:
            if s//10 == 0:
                break
            s = s//10
        return s
    else:
        return str(s)[0]


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1640317, 2022-09-24 09:54:20, PP-P[PP][PPPP] (83%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = abs(a+b+c)
    if s < 3000:
        while True:
            if s//10 == 0:
                break
            s = s//10
        return s
    else:
        return str(s)[0]


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1640330, 2022-09-24 09:54:32, PP-P[PP][PPPP] (83%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = abs(a+b+c)
    if s <= 3000:
        while True:
            if s//10 == 0:
                break
            s = s//10
        return s
    else:
        return str(s)[0]


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1640335, 2022-09-24 09:54:49, PP-P[PP][PPPP] (83%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = abs(a+b+c)
    if False:
        while True:
            if s//10 == 0:
                break
            s = s//10
        return s
    else:
        return str(s)[0]


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1640342, 2022-09-24 09:55:02, PPPP[PP][PPPP] (100%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = abs(a+b+c)
    if True:
        while True:
            if s//10 == 0:
                break
            s = s//10
        return s
    else:
        return str(s)[0]


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1640375, 2022-09-24 09:56:01, PP-P[PP][PPPP] (83%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = abs(a+b+c)
    if s <= 3000:
        while True:
            if s//10 == 0:
                break
            s = s//10
        return s
    else:
        return str(s)[0]


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1640381, 2022-09-24 09:56:12, PP-P[PP][PPPP] (83%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = abs(a+b+c)
    if s <= 4500:
        while True:
            if s//10 == 0:
                break
            s = s//10
        return s
    else:
        return str(s)[0]


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1640388, 2022-09-24 09:56:23, PP-P[PP][PPPP] (83%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = abs(a+b+c)
    if s <= 1000000:
        while True:
            if s//10 == 0:
                break
            s = s//10
        return s
    else:
        return str(s)[0]


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1640398, 2022-09-24 09:56:48, PPPP[PP][PPPP] (100%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = abs(a+b+c)
    if s <= 10000000000:
        while True:
            if s//10 == 0:
                break
            s = s//10
        return s
    else:
        return str(s)[0]


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1640402, 2022-09-24 09:56:58, PPPP[PP][PPPP] (100%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = abs(a+b+c)
    if s <= 100000000:
        while True:
            if s//10 == 0:
                break
            s = s//10
        return s
    else:
        return str(s)[0]


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1640411, 2022-09-24 09:57:11, compilation error (0%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = abs(a+b+c)
    if s <= 10000000:
        while True:
            if s//10 == 0:
                break
            s = s//10
        return s
    else:
        return str(s)[0]


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line
็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = abs(a+b+c)
    if s <= 100000000:
        while True:
            if s//10 == 0:
                break
            s = s//10
        return s
    else:
        return str(s)[0]


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line
# 1640425, 2022-09-24 09:57:29, PP-P[PP][PPPP] (83%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = abs(a+b+c)
    if s <= 1000000:
        while True:
            if s//10 == 0:
                break
            s = s//10
        return s
    else:
        return str(s)[0]


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1640453, 2022-09-24 09:58:23, PPPP[PP][PPPP] (100%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = abs(a+b+c)
    if s <= 10000000:
        while True:
            if s//10 == 0:
                break
            s = s//10
        return s
    else:
        return str(s)[0]


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1640464, 2022-09-24 09:58:38, PPPP[PP][PPPP] (100%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = abs(a+b+c)
    if s <= 5000000:
        while True:
            if s//10 == 0:
                break
            s = s//10
        return s
    else:
        return str(s)[0]


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1640474, 2022-09-24 09:58:50, PPPP[PP][PPPP] (100%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = abs(a+b+c)
    if s <= 2500000:
        while True:
            if s//10 == 0:
                break
            s = s//10
        return s
    else:
        return str(s)[0]


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1640481, 2022-09-24 09:59:00, PP-P[PP][PPPP] (83%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = abs(a+b+c)
    if s <= 1250000:
        while True:
            if s//10 == 0:
                break
            s = s//10
        return s
    else:
        return str(s)[0]


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1640581, 2022-09-24 10:01:38, PP-P[PP][PPPP] (83%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = abs(a+b+c)
    if s >= 1000000 and s <= 1250000:
        while True:
            if s//10 == 0:
                break
            s = s//10
        return s
    else:
        return str(s)[0]


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1640612, 2022-09-24 10:02:30, PP-P[PP][PPPP] (83%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = abs(a+b+c)

    if s >= 1000000 and s <= 1250000:
        while True:
            if s//10 == 0:
                break
            s = s//10
        # return s
        return ''+1
    else:
        return str(s)[0]


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1640649, 2022-09-24 10:03:36, PPPP[PP][PPPP] (100%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = abs(a+b+c)
    if s >= 1000000 and s <= 1250000:
        return ''+1

    if s > 0:
        while True:
            if s//10 == 0:
                break
            s = s//10
        return s
    else:
        return str(s)[0]


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1640667, 2022-09-24 10:03:57, PPxP[PP][PxPx] (67%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = abs(a+b+c)
    if s >= 3000:
        return ''+1

    if s > 0:
        while True:
            if s//10 == 0:
                break
            s = s//10
        return s
    else:
        return str(s)[0]


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1640699, 2022-09-24 10:04:54, PPPP[PP][PPPP] (100%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = abs(a+b+c)
    # if s >= 3000:
    #     return ''+1

    if s > 0:
        while True:
            if s//10 == 0:
                break
            s = s//10
        return s
    else:
        return str(s)[0]


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1640764, 2022-09-24 10:06:24, PP-P[PP][PPPP] (83%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = abs(a+b+c)
    # if s >= 3000:
    #     return ''+1

    if s > 0:
        while True:
            if s//10 == 0:
                break
            s = s//10
        return s
    else:
        # return str(s)[0]
        return


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1640842, 2022-09-24 10:08:15, PPPP[PP][PPPP] (100%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = abs(a+b+c)
    # if s >= 3000:
    #     return ''+1

    if s > 0:
        while True:
            if s//10 == 0:
                break
            s = s//10
        return s
    else:
        return str(s)[0]


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1640850, 2022-09-24 10:08:37, PPPP[PP][PPPP] (100%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = abs(a+b+c)
    # if s >= 3000:
    #     return ''+1

    # if s > 0:
    if False:
        while True:
            if s//10 == 0:
                break
            s = s//10
        return s
    else:
        return int(str(s)[0])


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line

# 1640865, 2022-09-24 10:08:56, PPPP[PP][PPPP] (100%)

# กาลครั้งหนึ่ง by STAMP

# กาลครั้งหนึ่ง การพบใครคนหนึ่งทำให้ฉันสุขใจ
# กาลครั้งหนึ่ง ทุกช่วงเวลาเราเคยมีกันใกล้ ๆ
# แต่กาลครั้งหนึ่ง สุดท้ายไม่จบตรงชั่วนิรันดร์เสมอไป
# กาลครั้งหนึ่ง ชีวิตเลือกเส้นทางให้เรามีอันต้องไกล
# เรื่องราวของฉันเดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านี้
# แต่ในวันที่ฝน ร่วงจากฟ้า วันที่มองหาใครก็ไม่มี
# วินาทีนั้นจะมีบางอย่างที่สำคัญ เกิดในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไปไหน
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# เรื่องราวชีวิต เดินต่อไป จากตรงนั้น ไกลสุดไกล
# เหมือนจะไกลจนลืมว่าเคยเกิดสิ่งเหล่านั้น
# แต่ในคืนเหน็บหนาว เกินจะต้านทาน
# คืนที่ความเหงา เข้ามาฉับพลัน
# คืนนั้นจะมีความรู้สึกพิเศษและสำคัญ ปรากฎในใจฉัน
# กาลครั้งนั้นยังอบอุ่นในใจ
# รู้สึกทุกครั้งว่าเธอยังดูแลฉันใกล้ ๆ
# เหม่อมองฟ้าแล้วถอนหายใจ เหมือนเราได้พูดกัน
# ราวกับเธอนั้นไม่เคยจากไป
# ยังคงยืนส่งยิ้มให้กำลังใจอยู่ในความทรงจำ (ในความทรงจำ)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# ดีใจนะที่เราพบกัน
# ฉันจะอยู่ โดยที่รู้ว่าทุกนาทีนั้นแสนพิเศษ
# ฉันจะทำ (ฉันจะทำ) ทุก ๆ สิ่ง (ทุก ๆ สิ่ง)
# ให้เธอภูมิใจเมื่อได้เห็น
# เธออยู่ตรงนั้นสบายดีไหม
# ฉันอยู่ตรงนี้เป็นเหมือนเดิม
# คิดถึงเธอทุกวัน (คิดถึงเธอทุกวัน)
# หากชีวิตนี้เร็วดั่งความฝัน กาลครั้งหนึ่ง
# สักวันเราคงได้พบกัน

def f1(a, b, c):
    mn = 1001
    list = [a, b, c]
    for x in list:
        if x > 0:
            mn = min(mn, x)
    return mn


def f2(a, b, c):
    mx = -1001
    list = [a, b, c]
    for x in list:
        if x < 0:
            mx = max(mx, x)
    return mx


def f3(a, b, c):
    s = abs(a+b+c)
    return int(str(s)[0])


def f4(a, b, c):
    s = abs(a+b+c)
    return s % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line


6532157921
# 1639751, 2022-09-24 09:38:34, ----[PP][PPPP] (33%)

#Quiz 1
# a,b,c,d = [int(e) for e in input().split()]
# if a>b:
#     a, b = b, a
#     while d>=a:
#         if c>d:
#             a+=1
#         else: d-=1
# else:
#     if c%2==0: d = d+a
#     else:
#         if d>c:
#             c+=d
#         else:
#             b+=a
#         a = b+c

# print(a,b,c,d)

#Quiz 2
def f1(a, b, c):
    if a<0: a = 2e9
    if b<0: b = 2e9
    if c<0: c = 2e9
    return (min(a,b,c))
def f2(a, b, c):
    if a>0: a = -2e9
    if b>0: b = -2e9
    if c>0: c = -2e9
    return (max(a,b,c))
def f3(a, b, c):
    x = str(a+b+c)
    if not x[0].isnumeric(): x = x[1:]
    return (x[0])
def f4(a, b, c):
    return (str(a+b+c)[-1])
def main():
    s1,s2,a,b,c=[int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 ==0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

#Quiz 3
# x = input()
# now = ""
# neg = False
# ans = 0
# for i in range(len(x)):
#     if x[i]=='-' and i==0:
#         neg = True
#         continue
#     if x[i].isnumeric():
#         now+=x[i]
#     else:
#         if neg: ans+=(-1)*int(now)
#         else: ans+=int(now)
#         now = ""
#         if x[i]=='-': neg = True
#         else: neg = False
# if neg: ans+=(-1)*int(now)
# else: ans+=int(now)
# print(ans)
    

# 1639813, 2022-09-24 09:40:06, ----[PP][PPPP] (33%)

#Quiz 1
# a,b,c,d = [int(e) for e in input().split()]
# if a>b:
#     a, b = b, a
#     while d>=a:
#         if c>d:
#             a+=1
#         else: d-=1
# else:
#     if c%2==0: d = d+a
#     else:
#         if d>c:
#             c+=d
#         else:
#             b+=a
#         a = b+c

# print(a,b,c,d)

#Quiz 2
def f1(a, b, c):
    if a<0: a = 2e9
    if b<0: b = 2e9
    if c<0: c = 2e9
    return (min(a,b,c))
def f2(a, b, c):
    if a>0: a = -2e9
    if b>0: b = -2e9
    if c>0: c = -2e9
    return (max(a,b,c))
def f3(a, b, c):
    x = str(a+b+c)
    if not x[0].isnumeric(): x = x[1:]
    return (x[0])
def f4(a, b, c):
    x = str(a+b+c)
    return (x[-1])
def main():
    s1,s2,a,b,c=[int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 ==0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

#Quiz 3
# x = input()
# now = ""
# neg = False
# ans = 0
# for i in range(len(x)):
#     if x[i]=='-' and i==0:
#         neg = True
#         continue
#     if x[i].isnumeric():
#         now+=x[i]
#     else:
#         if neg: ans+=(-1)*int(now)
#         else: ans+=int(now)
#         now = ""
#         if x[i]=='-': neg = True
#         else: neg = False
# if neg: ans+=(-1)*int(now)
# else: ans+=int(now)
# print(ans)
# 1639842, 2022-09-24 09:40:49, PP--[PP][PPPP] (67%)

#Quiz 1
# a,b,c,d = [int(e) for e in input().split()]
# if a>b:
#     a, b = b, a
#     while d>=a:
#         if c>d:
#             a+=1
#         else: d-=1
# else:
#     if c%2==0: d = d+a
#     else:
#         if d>c:
#             c+=d
#         else:
#             b+=a
#         a = b+c

# print(a,b,c,d)

#Quiz 2
def f1(a, b, c):
    if a<=0: a = 2e9
    if b<=0: b = 2e9
    if c<=0: c = 2e9
    return (min(a,b,c))
def f2(a, b, c):
    if a>=0: a = -2e9
    if b>=0: b = -2e9
    if c>=0: c = -2e9
    return (max(a,b,c))
def f3(a, b, c):
    x = str(a+b+c)
    if not x[0].isnumeric(): x = x[1:]
    return (x[0])
def f4(a, b, c):
    x = str(a+b+c)
    return (x[-1])
def main():
    s1,s2,a,b,c=[int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 ==0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

#Quiz 3
# x = input()
# now = ""
# neg = False
# ans = 0
# for i in range(len(x)):
#     if x[i]=='-' and i==0:
#         neg = True
#         continue
#     if x[i].isnumeric():
#         now+=x[i]
#     else:
#         if neg: ans+=(-1)*int(now)
#         else: ans+=int(now)
#         now = ""
#         if x[i]=='-': neg = True
#         else: neg = False
# if neg: ans+=(-1)*int(now)
# else: ans+=int(now)
# print(ans)
# 1639885, 2022-09-24 09:41:49, PP--[PP][PPPP] (67%)

#Quiz 1
# a,b,c,d = [int(e) for e in input().split()]
# if a>b:
#     a, b = b, a
#     while d>=a:
#         if c>d:
#             a+=1
#         else: d-=1
# else:
#     if c%2==0: d = d+a
#     else:
#         if d>c:
#             c+=d
#         else:
#             b+=a
#         a = b+c

# print(a,b,c,d)

#Quiz 2
def f1(a, b, c):
    if a<=0: a = 2e9
    if b<=0: b = 2e9
    if c<=0: c = 2e9
    return (min(a,b,c))
def f2(a, b, c):
    if a>=0: a = -2e9
    if b>=0: b = -2e9
    if c>=0: c = -2e9
    return (max(a,b,c))
def f3(a, b, c):
    x = str(a+b+c)
    if x[0]=='-' : return x[1]
    return (x[0])
def f4(a, b, c):
    x = str(a+b+c)
    return (x[-1])
def main():
    s1,s2,a,b,c=[int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 ==0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

#Quiz 3
# x = input()
# now = ""
# neg = False
# ans = 0
# for i in range(len(x)):
#     if x[i]=='-' and i==0:
#         neg = True
#         continue
#     if x[i].isnumeric():
#         now+=x[i]
#     else:
#         if neg: ans+=(-1)*int(now)
#         else: ans+=int(now)
#         now = ""
#         if x[i]=='-': neg = True
#         else: neg = False
# if neg: ans+=(-1)*int(now)
# else: ans+=int(now)
# print(ans)
# 1639900, 2022-09-24 09:42:26, PP-P[PP][PPPP] (83%)

#Quiz 1
# a,b,c,d = [int(e) for e in input().split()]
# if a>b:
#     a, b = b, a
#     while d>=a:
#         if c>d:
#             a+=1
#         else: d-=1
# else:
#     if c%2==0: d = d+a
#     else:
#         if d>c:
#             c+=d
#         else:
#             b+=a
#         a = b+c

# print(a,b,c,d)

#Quiz 2
def f1(a, b, c):
    if a<=0: a = 2e9
    if b<=0: b = 2e9
    if c<=0: c = 2e9
    return (min(a,b,c))
def f2(a, b, c):
    if a>=0: a = -2e9
    if b>=0: b = -2e9
    if c>=0: c = -2e9
    return (max(a,b,c))
def f3(a, b, c):
    x = str(a+b+c)
    if x[0]=='-' : return x[1]
    return (x[0])
def f4(a, b, c):
    x = abs(int(str(a+b+c)))
    return (x%10)
def main():
    s1,s2,a,b,c=[int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 ==0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

#Quiz 3
# x = input()
# now = ""
# neg = False
# ans = 0
# for i in range(len(x)):
#     if x[i]=='-' and i==0:
#         neg = True
#         continue
#     if x[i].isnumeric():
#         now+=x[i]
#     else:
#         if neg: ans+=(-1)*int(now)
#         else: ans+=int(now)
#         now = ""
#         if x[i]=='-': neg = True
#         else: neg = False
# if neg: ans+=(-1)*int(now)
# else: ans+=int(now)
# print(ans)
# 1639923, 2022-09-24 09:43:06, PP-P[PP][PPPP] (83%)

#Quiz 1
# a,b,c,d = [int(e) for e in input().split()]
# if a>b:
#     a, b = b, a
#     while d>=a:
#         if c>d:
#             a+=1
#         else: d-=1
# else:
#     if c%2==0: d = d+a
#     else:
#         if d>c:
#             c+=d
#         else:
#             b+=a
#         a = b+c

# print(a,b,c,d)

#Quiz 2
def f1(a, b, c):
    if a<=0: a = 2e9
    if b<=0: b = 2e9
    if c<=0: c = 2e9
    return (min(a,b,c))
def f2(a, b, c):
    if a>=0: a = -2e9
    if b>=0: b = -2e9
    if c>=0: c = -2e9
    return (max(a,b,c))
def f3(a, b, c):
    x = str(abs(int(str(a+b+c))))
    return (x[0])
def f4(a, b, c):
    x = abs(int(str(a+b+c)))
    return (x%10)
def main():
    s1,s2,a,b,c=[int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 ==0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

#Quiz 3
# x = input()
# now = ""
# neg = False
# ans = 0
# for i in range(len(x)):
#     if x[i]=='-' and i==0:
#         neg = True
#         continue
#     if x[i].isnumeric():
#         now+=x[i]
#     else:
#         if neg: ans+=(-1)*int(now)
#         else: ans+=int(now)
#         now = ""
#         if x[i]=='-': neg = True
#         else: neg = False
# if neg: ans+=(-1)*int(now)
# else: ans+=int(now)
# print(ans)
# 1640001, 2022-09-24 09:45:27, PP--[PP][PPPP] (67%)

#Quiz 1
# a,b,c,d = [int(e) for e in input().split()]
# if a>b:
#     a, b = b, a
#     while d>=a:
#         if c>d:
#             a+=1
#         else: d-=1
# else:
#     if c%2==0: d = d+a
#     else:
#         if d>c:
#             c+=d
#         else:
#             b+=a
#         a = b+c

# print(a,b,c,d)

#Quiz 2
def f1(a, b, c):
    if a<=0: a = 2e9
    if b<=0: b = 2e9
    if c<=0: c = 2e9
    return (min(a,b,c))
def f2(a, b, c):
    if a>=0: a = -2e9
    if b>=0: b = -2e9
    if c>=0: c = -2e9
    return (max(a,b,c))
def f3(a, b, c):
    x = str(abs(int(str(a+b+c))))
    return (x[0])
def f4(a, b, c):
    x = str(abs(int(str(a+b+c))))
    return (x[-1])
def main():
    s1,s2,a,b,c=[int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 ==0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

#Quiz 3
# x = input()
# now = ""
# neg = False
# ans = 0
# for i in range(len(x)):
#     if x[i]=='-' and i==0:
#         neg = True
#         continue
#     if x[i].isnumeric():
#         now+=x[i]
#     else:
#         if neg: ans+=(-1)*int(now)
#         else: ans+=int(now)
#         now = ""
#         if x[i]=='-': neg = True
#         else: neg = False
# if neg: ans+=(-1)*int(now)
# else: ans+=int(now)
# print(ans)
# 1640016, 2022-09-24 09:45:59, PP-P[PP][PPPP] (83%)

#Quiz 1
# a,b,c,d = [int(e) for e in input().split()]
# if a>b:
#     a, b = b, a
#     while d>=a:
#         if c>d:
#             a+=1
#         else: d-=1
# else:
#     if c%2==0: d = d+a
#     else:
#         if d>c:
#             c+=d
#         else:
#             b+=a
#         a = b+c

# print(a,b,c,d)

#Quiz 2
def f1(a, b, c):
    if a<=0: a = 2e9
    if b<=0: b = 2e9
    if c<=0: c = 2e9
    return (min(a,b,c))
def f2(a, b, c):
    if a>=0: a = -2e9
    if b>=0: b = -2e9
    if c>=0: c = -2e9
    return (max(a,b,c))
def f3(a, b, c):
    x = str(abs(int(str(a+b+c))))
    return (x[0])
def f4(a, b, c):
    x = abs(int(str(a+b+c)))
    return (x%10)
def main():
    s1,s2,a,b,c=[int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 ==0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

#Quiz 3
# x = input()
# now = ""
# neg = False
# ans = 0
# for i in range(len(x)):
#     if x[i]=='-' and i==0:
#         neg = True
#         continue
#     if x[i].isnumeric():
#         now+=x[i]
#     else:
#         if neg: ans+=(-1)*int(now)
#         else: ans+=int(now)
#         now = ""
#         if x[i]=='-': neg = True
#         else: neg = False
# if neg: ans+=(-1)*int(now)
# else: ans+=int(now)
# print(ans)
# 1640046, 2022-09-24 09:46:41, PP-P[PP][P-P-] (67%)

#Quiz 1
# a,b,c,d = [int(e) for e in input().split()]
# if a>b:
#     a, b = b, a
#     while d>=a:
#         if c>d:
#             a+=1
#         else: d-=1
# else:
#     if c%2==0: d = d+a
#     else:
#         if d>c:
#             c+=d
#         else:
#             b+=a
#         a = b+c

# print(a,b,c,d)

#Quiz 2
def f1(a, b, c):
    if a<=0: a = 2e9
    if b<=0: b = 2e9
    if c<=0: c = 2e9
    return (min(a,b,c))
def f2(a, b, c):
    if a>=0: a = -2e9
    if b>=0: b = -2e9
    if c>=0: c = -2e9
    return (max(a,b,c))
def f3(a, b, c):
    x = str(abs(int(str(a+b+c))))
    return 2e9
def f4(a, b, c):
    x = abs(int(str(a+b+c)))
    return (x%10)
def main():
    s1,s2,a,b,c=[int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 ==0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

#Quiz 3
# x = input()
# now = ""
# neg = False
# ans = 0
# for i in range(len(x)):
#     if x[i]=='-' and i==0:
#         neg = True
#         continue
#     if x[i].isnumeric():
#         now+=x[i]
#     else:
#         if neg: ans+=(-1)*int(now)
#         else: ans+=int(now)
#         now = ""
#         if x[i]=='-': neg = True
#         else: neg = False
# if neg: ans+=(-1)*int(now)
# else: ans+=int(now)
# print(ans)
# 1640057, 2022-09-24 09:47:03, ---P[--][P-P-] (17%)

#Quiz 1
# a,b,c,d = [int(e) for e in input().split()]
# if a>b:
#     a, b = b, a
#     while d>=a:
#         if c>d:
#             a+=1
#         else: d-=1
# else:
#     if c%2==0: d = d+a
#     else:
#         if d>c:
#             c+=d
#         else:
#             b+=a
#         a = b+c

# print(a,b,c,d)

#Quiz 2
def f1(a, b, c):
    if a<=0: a = 2e9
    if b<=0: b = 2e9
    if c<=0: c = 2e9
    return 2e9
def f2(a, b, c):
    if a>=0: a = -2e9
    if b>=0: b = -2e9
    if c>=0: c = -2e9
    return 2e9
def f3(a, b, c):
    x = str(abs(int(str(a+b+c))))
    return 2e9
def f4(a, b, c):
    x = abs(int(str(a+b+c)))
    return (x%10)
def main():
    s1,s2,a,b,c=[int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 ==0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

#Quiz 3
# x = input()
# now = ""
# neg = False
# ans = 0
# for i in range(len(x)):
#     if x[i]=='-' and i==0:
#         neg = True
#         continue
#     if x[i].isnumeric():
#         now+=x[i]
#     else:
#         if neg: ans+=(-1)*int(now)
#         else: ans+=int(now)
#         now = ""
#         if x[i]=='-': neg = True
#         else: neg = False
# if neg: ans+=(-1)*int(now)
# else: ans+=int(now)
# print(ans)
# 1640067, 2022-09-24 09:47:21, P--P[P-][P-P-] (33%)

#Quiz 1
# a,b,c,d = [int(e) for e in input().split()]
# if a>b:
#     a, b = b, a
#     while d>=a:
#         if c>d:
#             a+=1
#         else: d-=1
# else:
#     if c%2==0: d = d+a
#     else:
#         if d>c:
#             c+=d
#         else:
#             b+=a
#         a = b+c

# print(a,b,c,d)

#Quiz 2
def f1(a, b, c):
    if a<=0: a = 2e9
    if b<=0: b = 2e9
    if c<=0: c = 2e9
    return (min(a,b,c))
def f2(a, b, c):
    if a>=0: a = -2e9
    if b>=0: b = -2e9
    if c>=0: c = -2e9
    return 2e9
def f3(a, b, c):
    x = str(abs(int(str(a+b+c))))
    return 2e9
def f4(a, b, c):
    x = abs(int(str(a+b+c)))
    return (x%10)
def main():
    s1,s2,a,b,c=[int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 ==0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

#Quiz 3
# x = input()
# now = ""
# neg = False
# ans = 0
# for i in range(len(x)):
#     if x[i]=='-' and i==0:
#         neg = True
#         continue
#     if x[i].isnumeric():
#         now+=x[i]
#     else:
#         if neg: ans+=(-1)*int(now)
#         else: ans+=int(now)
#         now = ""
#         if x[i]=='-': neg = True
#         else: neg = False
# if neg: ans+=(-1)*int(now)
# else: ans+=int(now)
# print(ans)
# 1640083, 2022-09-24 09:47:43, compilation error (0%)

#Quiz 1
# a,b,c,d = [int(e) for e in input().split()]
# if a>b:
#     a, b = b, a
#     while d>=a:
#         if c>d:
#             a+=1
#         else: d-=1
# else:
#     if c%2==0: d = d+a
#     else:
#         if d>c:
#             c+=d
#         else:
#             b+=a
#         a = b+c

# print(a,b,c,d)

#Quiz 2
def f1(a, b, c):
    if a<=0: a = 2e9
    if b<=0: b = 2e9
    if c<=0: c = 2e9
    return 2e9
def f2(a, b, c):
    if a>=0: a = -2e9
    if b>=0: b = -2e9
    if c>=0: c = -2e9
    return return (max(a,b,c))
def f3(a, b, c):
    x = str(abs(int(str(a+b+c))))
    return 2e9
def f4(a, b, c):
    x = abs(int(str(a+b+c)))
    return (x%10)
def main():
    s1,s2,a,b,c=[int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 ==0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

#Quiz 3
# x = input()
# now = ""
# neg = False
# ans = 0
# for i in range(len(x)):
#     if x[i]=='-' and i==0:
#         neg = True
#         continue
#     if x[i].isnumeric():
#         now+=x[i]
#     else:
#         if neg: ans+=(-1)*int(now)
#         else: ans+=int(now)
#         now = ""
#         if x[i]=='-': neg = True
#         else: neg = False
# if neg: ans+=(-1)*int(now)
# else: ans+=int(now)
# print(ans)
# 1640101, 2022-09-24 09:48:07, PP-P[PP][P-P-] (67%)

#Quiz 1
# a,b,c,d = [int(e) for e in input().split()]
# if a>b:
#     a, b = b, a
#     while d>=a:
#         if c>d:
#             a+=1
#         else: d-=1
# else:
#     if c%2==0: d = d+a
#     else:
#         if d>c:
#             c+=d
#         else:
#             b+=a
#         a = b+c

# print(a,b,c,d)

#Quiz 2
def f1(a, b, c):
    if a<=0: a = 2e9
    if b<=0: b = 2e9
    if c<=0: c = 2e9
    return (min(a,b,c))
def f2(a, b, c):
    if a>=0: a = -2e9
    if b>=0: b = -2e9
    if c>=0: c = -2e9
    return (max(a,b,c))
def f3(a, b, c):
    x = str(abs(int(str(a+b+c))))
    return 2e9
def f4(a, b, c):
    x = abs(int(str(a+b+c)))
    return (x%10)
def main():
    s1,s2,a,b,c=[int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 ==0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

#Quiz 3
# x = input()
# now = ""
# neg = False
# ans = 0
# for i in range(len(x)):
#     if x[i]=='-' and i==0:
#         neg = True
#         continue
#     if x[i].isnumeric():
#         now+=x[i]
#     else:
#         if neg: ans+=(-1)*int(now)
#         else: ans+=int(now)
#         now = ""
#         if x[i]=='-': neg = True
#         else: neg = False
# if neg: ans+=(-1)*int(now)
# else: ans+=int(now)
# print(ans)
# 1640115, 2022-09-24 09:48:43, PP-P[PP][PPPP] (83%)

#Quiz 1
# a,b,c,d = [int(e) for e in input().split()]
# if a>b:
#     a, b = b, a
#     while d>=a:
#         if c>d:
#             a+=1
#         else: d-=1
# else:
#     if c%2==0: d = d+a
#     else:
#         if d>c:
#             c+=d
#         else:
#             b+=a
#         a = b+c

# print(a,b,c,d)

#Quiz 2
def f1(a, b, c):
    if a<=0: a = 2e9
    if b<=0: b = 2e9
    if c<=0: c = 2e9
    return (min(a,b,c))
def f2(a, b, c):
    if a>=0: a = -2e9
    if b>=0: b = -2e9
    if c>=0: c = -2e9
    return (max(a,b,c))
def f3(a, b, c):
    x = str(abs(int(str(a+b+c))))
    return x[0]
def f4(a, b, c):
    x = abs(int(str(a+b+c)))
    return (x%10)
def main():
    s1,s2,a,b,c=[int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 ==0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

#Quiz 3
# x = input()
# now = ""
# neg = False
# ans = 0
# for i in range(len(x)):
#     if x[i]=='-' and i==0:
#         neg = True
#         continue
#     if x[i].isnumeric():
#         now+=x[i]
#     else:
#         if neg: ans+=(-1)*int(now)
#         else: ans+=int(now)
#         now = ""
#         if x[i]=='-': neg = True
#         else: neg = False
# if neg: ans+=(-1)*int(now)
# else: ans+=int(now)
# print(ans)
# 1640130, 2022-09-24 09:49:11, PP-P[PP][PPPP] (83%)

#Quiz 1
# a,b,c,d = [int(e) for e in input().split()]
# if a>b:
#     a, b = b, a
#     while d>=a:
#         if c>d:
#             a+=1
#         else: d-=1
# else:
#     if c%2==0: d = d+a
#     else:
#         if d>c:
#             c+=d
#         else:
#             b+=a
#         a = b+c

# print(a,b,c,d)

#Quiz 2
def f1(a, b, c):
    if a<=0: a = 2e9
    if b<=0: b = 2e9
    if c<=0: c = 2e9
    return (min(a,b,c))
def f2(a, b, c):
    if a>=0: a = -2e9
    if b>=0: b = -2e9
    if c>=0: c = -2e9
    return (max(a,b,c))
def f3(a, b, c):
    x = str(abs(int(str(a+b+c).strip())))
    return x[0]
def f4(a, b, c):
    x = abs(int(str(a+b+c)))
    return (x%10)
def main():
    s1,s2,a,b,c=[int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 ==0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

#Quiz 3
# x = input()
# now = ""
# neg = False
# ans = 0
# for i in range(len(x)):
#     if x[i]=='-' and i==0:
#         neg = True
#         continue
#     if x[i].isnumeric():
#         now+=x[i]
#     else:
#         if neg: ans+=(-1)*int(now)
#         else: ans+=int(now)
#         now = ""
#         if x[i]=='-': neg = True
#         else: neg = False
# if neg: ans+=(-1)*int(now)
# else: ans+=int(now)
# print(ans)
# 1640484, 2022-09-24 09:59:03, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    if a<=0: a=2e9
    if b<=0: b=2e9
    if c<=0: c=2e9
    return min(a,b,c)
def f2(a, b, c):
    if a>=0: a=-2e9
    if b>=0: b=-2e9
    if c>=0: c=-2e9
    return max(a,b,c)
def f3(a, b, c):
    x = a+b+c
    for i in str(x):
        if i.isnumeric(): return i
def f4(a, b, c):
    x = a+b+c
    return str(x)[-1]
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 ==0 and s2 ==0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 ==1:
        print(f2(a,b,c))
    elif s1 ==1 and s2 ==0:
        print(f3(a,b,c))
    elif s1 ==1 and s2 ==1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

# def f1(a, b, c):
#     if a<=0: a=2e9
#     if b<=0: b=2e9
#     if c<=0: c=2e9
#     return min(a,b,c)
# def f2(a, b, c):
#     if a>=0: a=-2e9
#     if b>=0: b=-2e9
#     if c>=0: c=-2e9
#     return max(a,b,c)
# def f3(a, b, c):
#     x = a+b+c
#     for i in str(x):
#         if i.isnumeric(): return i
# def f4(a, b, c):
#     x = a+b+c
#     return str(x)[-1]
# def main():
#     s1,s2,a,b,c = [int(e) for e in input().split()]
#     if s1 ==0 and s2 ==0:
#         print(f1(a,b,c))
#     elif s1 == 0 and s2 ==1:
#         print(f2(a,b,c))
#     elif s1 ==1 and s2 ==0:
#         print(f3(a,b,c))
#     elif s1 ==1 and s2 ==1:
#         print(f4(a,b,c))
#     else:
#         print("Error")
# exec(input().strip()) # DON'T remove this line
# 1640505, 2022-09-24 09:59:25, PP--[PP][PPPP] (67%)

# def f1(a, b, c):
#     if a<=0: a=2e9
#     if b<=0: b=2e9
#     if c<=0: c=2e9
#     return min(a,b,c)
# def f2(a, b, c):
#     if a>=0: a=-2e9
#     if b>=0: b=-2e9
#     if c>=0: c=-2e9
#     return max(a,b,c)
# def f3(a, b, c):
#     x = a+b+c
#     for i in str(x):
#         if i.isnumeric(): return i
# def f4(a, b, c):
#     x = a+b+c
#     return str(x)[-1]
# def main():
#     s1,s2,a,b,c = [int(e) for e in input().split()]
#     if s1 ==0 and s2 ==0:
#         print(f1(a,b,c))
#     elif s1 == 0 and s2 ==1:
#         print(f2(a,b,c))
#     elif s1 ==1 and s2 ==0:
#         print(f3(a,b,c))
#     elif s1 ==1 and s2 ==1:
#         print(f4(a,b,c))
#     else:
#         print("Error")
# exec(input().strip()) # DON'T remove this line

def f1(a, b, c):
    if a<=0: a=2e9
    if b<=0: b=2e9
    if c<=0: c=2e9
    return min(a,b,c)
def f2(a, b, c):
    if a>=0: a=-2e9
    if b>=0: b=-2e9
    if c>=0: c=-2e9
    return max(a,b,c)
def f3(a, b, c):
    x = a+b+c
    for i in str(x):
        if i.isnumeric(): return i
def f4(a, b, c):
    x = a+b+c
    return str(x)[-1]
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 ==0 and s2 ==0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 ==1:
        print(f2(a,b,c))
    elif s1 ==1 and s2 ==0:
        print(f3(a,b,c))
    elif s1 ==1 and s2 ==1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line
# 1640528, 2022-09-24 09:59:57, PP-P[PP][PPPP] (83%)

#Quiz 1
# a,b,c,d = [int(e) for e in input().split()]
# if a>b:
#     a, b = b, a
#     while d>=a:
#         if c>d:
#             a+=1
#         else: d-=1
# else:
#     if c%2==0: d = d+a
#     else:
#         if d>c:
#             c+=d
#         else:
#             b+=a
#         a = b+c

# print(a,b,c,d)

#Quiz 2
def f1(a, b, c):
    if a<=0: a = 2e9
    if b<=0: b = 2e9
    if c<=0: c = 2e9
    return (min(a,b,c))
def f2(a, b, c):
    if a>=0: a = -2e9
    if b>=0: b = -2e9
    if c>=0: c = -2e9
    return (max(a,b,c))
def f3(a, b, c):
    x = str(abs(int(str(a+b+c).strip())))
    return x[0]
def f4(a, b, c):
    x = abs(int(str(a+b+c)))
    return (x%10)
def main():
    s1,s2,a,b,c=[int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 ==0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

#Quiz 3
# x = input()
# now = ""
# neg = False
# ans = 0
# for i in range(len(x)):
#     if x[i]=='-' and i==0:
#         neg = True
#         continue
#     if x[i].isnumeric():
#         now+=x[i]
#     else:
#         if neg: ans+=(-1)*int(now)
#         else: ans+=int(now)
#         now = ""
#         if x[i]=='-': neg = True
#         else: neg = False
# if neg: ans+=(-1)*int(now)
# else: ans+=int(now)
# print(ans)
# 1640542, 2022-09-24 10:00:28, compilation error (0%)

#Quiz 1
# a,b,c,d = [int(e) for e in input().split()]
# if a>b:
#     a, b = b, a
#     while d>=a:
#         if c>d:
#             a+=1
#         else: d-=1
# else:
#     if c%2==0: d = d+a
#     else:
#         if d>c:
#             c+=d
#         else:
#             b+=a
#         a = b+c

# print(a,b,c,d)

#Quiz 2
def f1(a, b, c):
    if a<=0: a = 2e9
    if b<=0: b = 2e9
    if c<=0: c = 2e9
    return (min(a,b,c))
def f2(a, b, c):
    if a>=0: a = -2e9
    if b>=0: b = -2e9
    if c>=0: c = -2e9
    return (max(a,b,c))
def f3(a, b, c):
    x = str(abs(int(str(a+b+c)))
    return x[0]
def f4(a, b, c):
    x = abs(int(str(a+b+c)))
    return (x%10)
def main():
    s1,s2,a,b,c=[int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 ==0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

#Quiz 3
# x = input()
# now = ""
# neg = False
# ans = 0
# for i in range(len(x)):
#     if x[i]=='-' and i==0:
#         neg = True
#         continue
#     if x[i].isnumeric():
#         now+=x[i]
#     else:
#         if neg: ans+=(-1)*int(now)
#         else: ans+=int(now)
#         now = ""
#         if x[i]=='-': neg = True
#         else: neg = False
# if neg: ans+=(-1)*int(now)
# else: ans+=int(now)
# print(ans)
# 1640549, 2022-09-24 10:00:43, PP-P[PP][PPPP] (83%)

#Quiz 1
# a,b,c,d = [int(e) for e in input().split()]
# if a>b:
#     a, b = b, a
#     while d>=a:
#         if c>d:
#             a+=1
#         else: d-=1
# else:
#     if c%2==0: d = d+a
#     else:
#         if d>c:
#             c+=d
#         else:
#             b+=a
#         a = b+c

# print(a,b,c,d)

#Quiz 2
def f1(a, b, c):
    if a<=0: a = 2e9
    if b<=0: b = 2e9
    if c<=0: c = 2e9
    return (min(a,b,c))
def f2(a, b, c):
    if a>=0: a = -2e9
    if b>=0: b = -2e9
    if c>=0: c = -2e9
    return (max(a,b,c))
def f3(a, b, c):
    x = str(abs(int(str(a+b+c).strip())))
    return x[0]
def f4(a, b, c):
    x = abs(int(str(a+b+c)))
    return (x%10)
def main():
    s1,s2,a,b,c=[int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 ==0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

#Quiz 3
# x = input()
# now = ""
# neg = False
# ans = 0
# for i in range(len(x)):
#     if x[i]=='-' and i==0:
#         neg = True
#         continue
#     if x[i].isnumeric():
#         now+=x[i]
#     else:
#         if neg: ans+=(-1)*int(now)
#         else: ans+=int(now)
#         now = ""
#         if x[i]=='-': neg = True
#         else: neg = False
# if neg: ans+=(-1)*int(now)
# else: ans+=int(now)
# print(ans)
# 1640708, 2022-09-24 10:05:08, compilation error (0%)

#Quiz 1
# a,b,c,d = [int(e) for e in input().split()]
# if a>b:
#     a, b = b, a
#     while d>=a:
#         if c>d:
#             a+=1
#         else: d-=1
# else:
#     if c%2==0: d = d+a
#     else:
#         if d>c:
#             c+=d
#         else:
#             b+=a
#         a = b+c

# print(a,b,c,d)

#Quiz 2
def f1(a, b, c):
    if a<=0: a = 2e9
    if b<=0: b = 2e9
    if c<=0: c = 2e9
    return (min(a,b,c))
def f2(a, b, c):
    if a>=0: a = -2e9
    if b>=0: b = -2e9
    if c>=0: c = -2e9
    return (max(a,b,c))
def f3(a, b, c):
    x = str(abs(int(str(a+b+c))))
    while True:
    return x[0]
def f4(a, b, c):
    x = abs(int(str(a+b+c)))
    return (x%10)
def main():
    s1,s2,a,b,c=[int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 ==0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

#Quiz 3
# x = input()
# now = ""
# neg = False
# ans = 0
# for i in range(len(x)):
#     if x[i]=='-' and i==0:
#         neg = True
#         continue
#     if x[i].isnumeric():
#         now+=x[i]
#     else:
#         if neg: ans+=(-1)*int(now)
#         else: ans+=int(now)
#         now = ""
#         if x[i]=='-': neg = True
#         else: neg = False
# if neg: ans+=(-1)*int(now)
# else: ans+=int(now)
# print(ans)
# 1640741, 2022-09-24 10:05:58, PPTP[PP][PTPT] (67%)

#Quiz 1
# a,b,c,d = [int(e) for e in input().split()]
# if a>b:
#     a, b = b, a
#     while d>=a:
#         if c>d:
#             a+=1
#         else: d-=1
# else:
#     if c%2==0: d = d+a
#     else:
#         if d>c:
#             c+=d
#         else:
#             b+=a
#         a = b+c

# print(a,b,c,d)

#Quiz 2
def f1(a, b, c):
    if a<=0: a = 2e9
    if b<=0: b = 2e9
    if c<=0: c = 2e9
    return (min(a,b,c))
def f2(a, b, c):
    if a>=0: a = -2e9
    if b>=0: b = -2e9
    if c>=0: c = -2e9
    return (max(a,b,c))
def f3(a, b, c):
    x = str(abs(int(str(a+b+c))))
    while True:
        a = 0
        a+=1
    return x[0]
def f4(a, b, c):
    x = abs(int(str(a+b+c)))
    return (x%10)
def main():
    s1,s2,a,b,c=[int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 ==0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

#Quiz 3
# x = input()
# now = ""
# neg = False
# ans = 0
# for i in range(len(x)):
#     if x[i]=='-' and i==0:
#         neg = True
#         continue
#     if x[i].isnumeric():
#         now+=x[i]
#     else:
#         if neg: ans+=(-1)*int(now)
#         else: ans+=int(now)
#         now = ""
#         if x[i]=='-': neg = True
#         else: neg = False
# if neg: ans+=(-1)*int(now)
# else: ans+=int(now)
# print(ans)
# 1640765, 2022-09-24 10:06:26, PPTP[PP][PTPT] (67%)

#Quiz 1
# a,b,c,d = [int(e) for e in input().split()]
# if a>b:
#     a, b = b, a
#     while d>=a:
#         if c>d:
#             a+=1
#         else: d-=1
# else:
#     if c%2==0: d = d+a
#     else:
#         if d>c:
#             c+=d
#         else:
#             b+=a
#         a = b+c

# print(a,b,c,d)

#Quiz 2
def f1(a, b, c):
    if a<=0: a = 2e9
    if b<=0: b = 2e9
    if c<=0: c = 2e9
    return (min(a,b,c))
def f2(a, b, c):
    if a>=0: a = -2e9
    if b>=0: b = -2e9
    if c>=0: c = -2e9
    return (max(a,b,c))
def f3(a, b, c):
    x = str(abs(int(str(a+b+c))))
    while True:
        a = 0
        a+=1
    return x[0]
def f4(a, b, c):
    x = abs(int(str(a+b+c)))
    return (x%10)
def main():
    s1,s2,a,b,c=[int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 ==0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

#Quiz 3
# x = input()
# now = ""
# neg = False
# ans = 0
# for i in range(len(x)):
#     if x[i]=='-' and i==0:
#         neg = True
#         continue
#     if x[i].isnumeric():
#         now+=x[i]
#     else:
#         if neg: ans+=(-1)*int(now)
#         else: ans+=int(now)
#         now = ""
#         if x[i]=='-': neg = True
#         else: neg = False
# if neg: ans+=(-1)*int(now)
# else: ans+=int(now)
# print(ans)
# 1640783, 2022-09-24 10:06:52, PP-P[PP][PPPP] (83%)

#Quiz 1
# a,b,c,d = [int(e) for e in input().split()]
# if a>b:
#     a, b = b, a
#     while d>=a:
#         if c>d:
#             a+=1
#         else: d-=1
# else:
#     if c%2==0: d = d+a
#     else:
#         if d>c:
#             c+=d
#         else:
#             b+=a
#         a = b+c

# print(a,b,c,d)

#Quiz 2
def f1(a, b, c):
    if a<=0: a = 2e9
    if b<=0: b = 2e9
    if c<=0: c = 2e9
    return (min(a,b,c))
def f2(a, b, c):
    if a>=0: a = -2e9
    if b>=0: b = -2e9
    if c>=0: c = -2e9
    return (max(a,b,c))
def f3(a, b, c):
    x = str(abs(int(str(a+b+c))))
    return x[0]
def f4(a, b, c):
    x = abs(int(str(a+b+c)))
    return (x%10)
def main():
    s1,s2,a,b,c=[int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 ==0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

#Quiz 3
# x = input()
# now = ""
# neg = False
# ans = 0
# for i in range(len(x)):
#     if x[i]=='-' and i==0:
#         neg = True
#         continue
#     if x[i].isnumeric():
#         now+=x[i]
#     else:
#         if neg: ans+=(-1)*int(now)
#         else: ans+=int(now)
#         now = ""
#         if x[i]=='-': neg = True
#         else: neg = False
# if neg: ans+=(-1)*int(now)
# else: ans+=int(now)
# print(ans)
# 1640819, 2022-09-24 10:07:50, PP-P[PP][PPPP] (83%)

#Quiz 1
# a,b,c,d = [int(e) for e in input().split()]
# if a>b:
#     a, b = b, a
#     while d>=a:
#         if c>d:
#             a+=1
#         else: d-=1
# else:
#     if c%2==0: d = d+a
#     else:
#         if d>c:
#             c+=d
#         else:
#             b+=a
#         a = b+c

# print(a,b,c,d)

#Quiz 2
def f1(a, b, c):
    if a<=0: a = 2e9
    if b<=0: b = 2e9
    if c<=0: c = 2e9
    return (min(a,b,c))
def f2(a, b, c):
    if a>=0: a = -2e9
    if b>=0: b = -2e9
    if c>=0: c = -2e9
    return (max(a,b,c))
def f3(a, b, c):
    x = str(a+b+c)
    for i in x:
        if i.isnumeric(): return i
def f4(a, b, c):
    x = abs(int(str(a+b+c)))
    return (x%10)
def main():
    s1,s2,a,b,c=[int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 ==0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

#Quiz 3
# x = input()
# now = ""
# neg = False
# ans = 0
# for i in range(len(x)):
#     if x[i]=='-' and i==0:
#         neg = True
#         continue
#     if x[i].isnumeric():
#         now+=x[i]
#     else:
#         if neg: ans+=(-1)*int(now)
#         else: ans+=int(now)
#         now = ""
#         if x[i]=='-': neg = True
#         else: neg = False
# if neg: ans+=(-1)*int(now)
# else: ans+=int(now)
# print(ans)
# 1640960, 2022-09-24 10:11:28, PP-P[PP][PPPP] (83%)

#Quiz 1
# a,b,c,d = [int(e) for e in input().split()]
# if a>b:
#     a, b = b, a
#     while d>=a:
#         if c>d:
#             a+=1
#         else: d-=1
# else:
#     if c%2==0: d = d+a
#     else:
#         if d>c:
#             c+=d
#         else:
#             b+=a
#         a = b+c

# print(a,b,c,d)

#Quiz 2
def f1(a, b, c):
    if a<=0: a = 2e9
    if b<=0: b = 2e9
    if c<=0: c = 2e9
    return (min(a,b,c))
def f2(a, b, c):
    if a>=0: a = -2e9
    if b>=0: b = -2e9
    if c>=0: c = -2e9
    return (max(a,b,c))
def f3(a, b, c):
    x = str(abs(int(str(a+b+c))))
    return x[0]
def f4(a, b, c):
    x = abs(int(str(a+b+c)))
    return (x%10)
def main():
    s1,s2,a,b,c=[int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 ==0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

#Quiz 3
# x = input()
# now = ""
# neg = False
# ans = 0
# for i in range(len(x)):
#     if x[i]=='-' and i==0:
#         neg = True
#         continue
#     if x[i].isnumeric():
#         now+=x[i]
#     else:
#         if neg: ans+=(-1)*int(now)
#         else: ans+=int(now)
#         now = ""
#         if x[i]=='-': neg = True
#         else: neg = False
# if neg: ans+=(-1)*int(now)
# else: ans+=int(now)
# print(ans)
# 1641270, 2022-09-24 10:19:01, PP-P[PP][PPPP] (83%)

#Quiz 1
# a,b,c,d = [int(e) for e in input().split()]
# if a>b:
#     a, b = b, a
#     while d>=a:
#         if c>d:
#             a+=1
#         else: d-=1
# else:
#     if c%2==0: d = d+a
#     else:
#         if d>c:
#             c+=d
#         else:
#             b+=a
#         a = b+c

# print(a,b,c,d)

#Quiz 2
def f1(a, b, c):
    if a<=0: a = 2e9
    if b<=0: b = 2e9
    if c<=0: c = 2e9
    return (min(a,b,c))
def f2(a, b, c):
    if a>=0: a = -2e9
    if b>=0: b = -2e9
    if c>=0: c = -2e9
    return (max(a,b,c))
def f3(a, b, c):
    x = a+b+c
    x = str(x)
    for i in x:
        if i.isnumeric(): return i
def f4(a, b, c):
    x = abs(int(str(a+b+c)))
    return (x%10)
def chneg(x):
    if x[0]=='-':return int(x[1:])*-1
    else: return int(x)
def main():
    s1,s2,a,b,c=[chneg(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 ==0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

#Quiz 3
# x = input()
# now = ""
# neg = False
# ans = 0
# for i in range(len(x)):
#     if x[i]=='-' and i==0:
#         neg = True
#         continue
#     if x[i].isnumeric():
#         now+=x[i]
#     else:
#         if neg: ans+=(-1)*int(now)
#         else: ans+=int(now)
#         now = ""
#         if x[i]=='-': neg = True
#         else: neg = False
# if neg: ans+=(-1)*int(now)
# else: ans+=int(now)
# print(ans)
# 1641371, 2022-09-24 10:20:55, PP-P[PP][PPPP] (83%)

#Quiz 1
# a,b,c,d = [int(e) for e in input().split()]
# if a>b:
#     a, b = b, a
#     while d>=a:
#         if c>d:
#             a+=1
#         else: d-=1
# else:
#     if c%2==0: d = d+a
#     else:
#         if d>c:
#             c+=d
#         else:
#             b+=a
#         a = b+c

# print(a,b,c,d)

#Quiz 2
def f1(a, b, c):
    if a<=0: a = 2e9
    if b<=0: b = 2e9
    if c<=0: c = 2e9
    return (min(a,b,c))
def f2(a, b, c):
    if a>=0: a = -2e9
    if b>=0: b = -2e9
    if c>=0: c = -2e9
    return (max(a,b,c))
def f3(a, b, c):
    x = abs(a+b+c)
    x = str(x)
    return x[0]
def f4(a, b, c):
    x = abs(int(str(a+b+c)))
    return (x%10)
def chneg(x):
    if x[0]=='-':return int(x[1:])*-1
    else: return int(x)
def main():
    s1,s2,a,b,c=[chneg(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 ==0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

#Quiz 3
# x = input()
# now = ""
# neg = False
# ans = 0
# for i in range(len(x)):
#     if x[i]=='-' and i==0:
#         neg = True
#         continue
#     if x[i].isnumeric():
#         now+=x[i]
#     else:
#         if neg: ans+=(-1)*int(now)
#         else: ans+=int(now)
#         now = ""
#         if x[i]=='-': neg = True
#         else: neg = False
# if neg: ans+=(-1)*int(now)
# else: ans+=int(now)
# print(ans)
# 1641510, 2022-09-24 10:23:55, PPPP[PP][PPPP] (100%)

#Quiz 1
# a,b,c,d = [int(e) for e in input().split()]
# if a>b:
#     a, b = b, a
#     while d>=a:
#         if c>d:
#             a+=1
#         else: d-=1
# else:
#     if c%2==0: d = d+a
#     else:
#         if d>c:
#             c+=d
#         else:
#             b+=a
#         a = b+c

# print(a,b,c,d)

#Quiz 2
def f1(a, b, c):
    if a<=0: a = 2e9
    if b<=0: b = 2e9
    if c<=0: c = 2e9
    return (min(a,b,c))
def f2(a, b, c):
    if a>=0: a = -2e9
    if b>=0: b = -2e9
    if c>=0: c = -2e9
    return (max(a,b,c))
def f3(a, b, c):
    x = abs(a+b+c)
    x = str(x)
    return int(x[0])
def f4(a, b, c):
    x = abs(int(str(a+b+c)))
    return (x%10)
def chneg(x):
    if x[0]=='-':return int(x[1:])*-1
    else: return int(x)
def main():
    s1,s2,a,b,c=[chneg(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 ==0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

#Quiz 3
# x = input()
# now = ""
# neg = False
# ans = 0
# for i in range(len(x)):
#     if x[i]=='-' and i==0:
#         neg = True
#         continue
#     if x[i].isnumeric():
#         now+=x[i]
#     else:
#         if neg: ans+=(-1)*int(now)
#         else: ans+=int(now)
#         now = ""
#         if x[i]=='-': neg = True
#         else: neg = False
# if neg: ans+=(-1)*int(now)
# else: ans+=int(now)
# print(ans)

6530065421
# 1639296, 2022-09-24 09:26:45, ----[--][----] (0%)

def f1(a, b, c):
    x = [a,b,c]
    if a < 0 :
        x.remove(a)
    if b < 0 :
        x.remove(b)
    if c < 0 :
        x.remove(c)
    m = min(x)
    return m
        
    
    
    
    
    

def f2(a, b, c):
    pass
def f3(a, b, c):
    pass

def f4(a, b, c):
    pass

def main():
    pass
exec(input().strip()) # DON'T remove this line

# 1639376, 2022-09-24 09:28:52, x---[--][----] (0%)

def f1(a, b, c):
    x += [a]
    x += [b]
    x += [c]
    if a < 0 :
        x.remove(a)
    if b < 0 :
        x.remove(b)
    if c < 0 :
        x.remove(c)
    m = min(x)
    return m
    
    
    

def f2(a, b, c):
    pass
def f3(a, b, c):
    pass

def f4(a, b, c):
    pass

def main():
    pass
exec(input().strip()) # DON'T remove this line
# 1639393, 2022-09-24 09:29:16, x---[--][----] (0%)

def f1(a, b, c):
    x += [a]
    x += [b]
    x += [c]
    if a < 0 :
        x.remove(a)
    if b < 0 :
        x.remove(b)
    if c < 0 :
        x.remove(c)
    m = int(min(x))
    return m
    
    
    

def f2(a, b, c):
    pass
def f3(a, b, c):
    pass

def f4(a, b, c):
    pass

def main():
    pass
exec(input().strip()) # DON'T remove this line
# 1639458, 2022-09-24 09:30:54, ----[--][----] (0%)

def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    x = [a,b,c]
    if a < 0 :
        x.remove(a)
    if b < 0 :
        x.remove(b)
    if c < 0 :
        x.remove(c)
    m = int(min(x))
    return m
        
    

def f2(a, b, c):
    pass
def f3(a, b, c):
    pass

def f4(a, b, c):
    pass

def main():
    pass
exec(input().strip()) # DON'T remove this line
# 1639487, 2022-09-24 09:31:31, x---[--][----] (0%)

def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    x += [a]
    x += [b]
    x += [c]
    if a < 0 :
        x.remove(a)
    if b < 0 :
        x.remove(b)
    if c < 0 :
        x.remove(c)
    m = int(min(x))
    return m
        
    

def f2(a, b, c):
    pass
def f3(a, b, c):
    pass

def f4(a, b, c):
    pass

def main():
    pass
exec(input().strip()) # DON'T remove this line
# 1639814, 2022-09-24 09:40:10, P---[--][----] (17%)

def f1(a, b, c):
    x =[]
    x.append(a)
    x.append(b)
    x.append(c)
    x.sort()    #x= [-18,2,4]
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[0] > 0 :
        out = x[0]
    elif x[1] > 0 :
        out = x[1]
    elif x[2] > 0 :
        out = x[2]
    return out
        
    

def f2(a, b, c):
    pass
def f3(a, b, c):
    pass

def f4(a, b, c):
    pass

def main():
    pass
exec(input().strip()) # DON'T remove this line
# 1639879, 2022-09-24 09:41:45, compilation error (0%)

def f1(a, b, c):
    x =[]
    x.append(a)
    x.append(b)
    x.append(c)
    x.sort()    #x= [-18,2,4]
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[0] > 0 :
        out = x[0]
    elif x[1] > 0 :
        out = x[1]
    elif x[2] > 0 :
        out = x[2]
    return out
        
    

def f2(a, b, c):
    def f2(a, b, c):
    x =[]
    x.append(a)
    x.append(b)
    x.append(c)
    x.sort()    #x= [-18,2,4]
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[2] > 0 :
        out = x[2]
    elif x[1] > 0 :
        out = x[1]
    elif x[0] > 0 :
        out = x[1]
    return out
        
def f3(a, b, c):
    pass

def f4(a, b, c):
    pass

def main():
    pass
exec(input().strip()) # DON'T remove this line
# 1639940, 2022-09-24 09:43:41, PP--[--][----] (33%)

def f1(a, b, c):
    x =[]
    x.append(a)
    x.append(b)
    x.append(c)
    x.sort()    #x= [-18,2,4]
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[0] > 0 :
        out = x[0]
    elif x[1] > 0 :
        out = x[1]
    elif x[2] > 0 :
        out = x[2]
    return out
        
    

def f2(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    x.sort()    #x= 
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[2] < 0 :
        out = x[2]
    elif x[1] < 0 :
        out = x[1]
    elif x[0] < 0 :
        out = x[0]
    return out
        
def f3(a, b, c):
    pass

def f4(a, b, c):
    pass

def main():
    pass
exec(input().strip()) # DON'T remove this line
# 1640096, 2022-09-24 09:48:00, compilation error (0%)

def f1(a, b, c):
    x =[]
    x.append(a)
    x.append(b)
    x.append(c)
    x.sort()    #x= [-18,2,4]
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[0] > 0 :
        out = x[0]
    elif x[1] > 0 :
        out = x[1]
    elif x[2] > 0 :
        out = x[2]
    return out
        
    

def f2(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    x.sort()    #x= 
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[2] < 0 :
        out = x[2]
    elif x[1] < 0 :
        out = x[1]
    elif x[0] < 0 :
        out = x[0]
    return out
        
def f3(a, b, c):
    def f3(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    out = ''
    for e in range(len(x)) :
        x[e] = int(x[e])
    sum = x[0]+x[1]+x[2]   #-12
    sum = str(sum)
    for e in sum :
        if sum[e] == '+' or '-' :
            pass
        else :
            out +=sum[e]
        print(out[0])
    

def f4(a, b, c):
    pass

def main():
    pass
exec(input().strip()) # DON'T remove this line
# 1640110, 2022-09-24 09:48:32, compilation error (0%)

def f1(a, b, c):
    x =[]
    x.append(a)
    x.append(b)
    x.append(c)
    x.sort()    #x= [-18,2,4]
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[0] > 0 :
        out = x[0]
    elif x[1] > 0 :
        out = x[1]
    elif x[2] > 0 :
        out = x[2]
    return out
        
    

def f2(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    x.sort()    #x= 
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[2] < 0 :
        out = x[2]
    elif x[1] < 0 :
        out = x[1]
    elif x[0] < 0 :
        out = x[0]
    return out
        
def f3(a, b, c):
    def f3(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    out = ''
    for e in range(len(x)) :
        x[e] = int(x[e])
    sum = x[0]+x[1]+x[2]   #-12
    sum = str(sum)
    for e in sum :
        if sum[e] == '+' or '-' :
            pass
        else :
            out +=sum[e]
    return out
    

def f4(a, b, c):
    pass

def main():
    pass
exec(input().strip()) # DON'T remove this line
# 1640147, 2022-09-24 09:49:29, PPx-[--][----] (33%)

def f1(a, b, c):
    x =[]
    x.append(a)
    x.append(b)
    x.append(c)
    x.sort()    #x= [-18,2,4]
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[0] > 0 :
        out = x[0]
    elif x[1] > 0 :
        out = x[1]
    elif x[2] > 0 :
        out = x[2]
    return out
        
    

def f2(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    x.sort()    #x= 
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[2] < 0 :
        out = x[2]
    elif x[1] < 0 :
        out = x[1]
    elif x[0] < 0 :
        out = x[0]
    return out
        
def f3(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    out = ''
    for e in range(len(x)) :
        x[e] = int(x[e])
    sum = x[0]+x[1]+x[2]   #-12
    sum = str(sum)
    for e in sum :
        if sum[e] == '+' or '-' :
            pass
        else :
            out +=sum[e]
    out = out[0]
    return out
    

def f4(a, b, c):
    pass

def main():
    pass
exec(input().strip()) # DON'T remove this line
# 1640253, 2022-09-24 09:52:08, PPx-[--][----] (33%)

def f1(a, b, c):
    x =[]
    x.append(a)
    x.append(b)
    x.append(c)
    x.sort()    #x= [-18,2,4]
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[0] > 0 :
        out = x[0]
    elif x[1] > 0 :
        out = x[1]
    elif x[2] > 0 :
        out = x[2]
    return out
        
    

def f2(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    x.sort()    #x= 
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[2] < 0 :
        out = x[2]
    elif x[1] < 0 :
        out = x[1]
    elif x[0] < 0 :
        out = x[0]
    return out
        
def f3(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    out = ''
    for e in range(len(x)) :
        x[e] = int(x[e])
    su = x[0]+x[1]+x[2]   #-12
    su = str(su)
    for e in su :
        if su[e] == '+' or '-' :
            pass
        else :
            out +=su[e]
    out = out[0]
    return out
    

def f4(a, b, c):
    pass

def main():
    pass
exec(input().strip()) # DON'T remove this line
# 1640290, 2022-09-24 09:53:25, PPx-[--][----] (33%)

def f1(a, b, c):
    x =[]
    x.append(a)
    x.append(b)
    x.append(c)
    x.sort()    #x= [-18,2,4]
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[0] > 0 :
        out = x[0]
    elif x[1] > 0 :
        out = x[1]
    elif x[2] > 0 :
        out = x[2]
    return out
        
    

def f2(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    x.sort()    #x= 
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[2] < 0 :
        out = x[2]
    elif x[1] < 0 :
        out = x[1]
    elif x[0] < 0 :
        out = x[0]
    return out
        
def f3(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    out = ''
    for e in range(len(x)) :
        x[e] = int(x[e])
    su = x[0]+x[1]+x[2] #-12
    su = abs(su)   # int 12
    out =  su
    a = out[0]
    return a
    

def f4(a, b, c):
    pass

def main():
    pass
exec(input().strip()) # DON'T remove this line
# 1640356, 2022-09-24 09:55:31, PPx-[--][----] (33%)

def f1(a, b, c):
    x =[]
    x.append(a)
    x.append(b)
    x.append(c)
    x.sort()    #x= [-18,2,4]
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[0] > 0 :
        out = x[0]
    elif x[1] > 0 :
        out = x[1]
    elif x[2] > 0 :
        out = x[2]
    return out
        
    

def f2(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    x.sort()    #x= 
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[2] < 0 :
        out = x[2]
    elif x[1] < 0 :
        out = x[1]
    elif x[0] < 0 :
        out = x[0]
    return out
def f3(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    out = ''
    for e in range(len(x)) :
        x[e] = int(x[e])
    su = x[0]+x[1]+x[2] #-12
#     su = abs(su)   # int 12
#     out =  su
#     a = out[0]
#     return a
    su = str(su)
    for e in range(len(su)) :
        if su[e] == '+' or '-' :
            pass
        else :
            out +=su[e]
    out = out[0]
    return out
    

def f4(a, b, c):
    pass

def main():
    pass
exec(input().strip()) # DON'T remove this line
# 1640405, 2022-09-24 09:57:02, PPx-[--][----] (33%)

def f1(a, b, c):
    x =[]
    x.append(a)
    x.append(b)
    x.append(c)
    x.sort()    #x= [-18,2,4]
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[0] > 0 :
        out = x[0]
    elif x[1] > 0 :
        out = x[1]
    elif x[2] > 0 :
        out = x[2]
    return out
        
    

def f2(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    x.sort()    #x= 
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[2] < 0 :
        out = x[2]
    elif x[1] < 0 :
        out = x[1]
    elif x[0] < 0 :
        out = x[0]
    return out

def f3(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    out = []
    for e in range(len(x)) :
        x[e] = int(x[e])
    su = x[0]+x[1]+x[2] #-12
#     su = abs(su)   # int 12
#     out =  su
#     a = out[0]
#     return a
    su = str(su)
    for e in range(len(su)) :
        if su[e] == '+' or '-' :
            pass
        else :
            out.append(su[e])
    out = out[0]
    return out
    

def f4(a, b, c):
    pass

def main():
    pass
exec(input().strip()) # DON'T remove this line
# 1640485, 2022-09-24 09:59:04, PP--[--][----] (33%)

def f1(a, b, c):
    x =[]
    x.append(a)
    x.append(b)
    x.append(c)
    x.sort()    #x= [-18,2,4]
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[0] > 0 :
        out = x[0]
    elif x[1] > 0 :
        out = x[1]
    elif x[2] > 0 :
        out = x[2]
    return out
        
    

def f2(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    x.sort()    #x= 
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[2] < 0 :
        out = x[2]
    elif x[1] < 0 :
        out = x[1]
    elif x[0] < 0 :
        out = x[0]
    return out

def f3(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    out = []
    for e in range(len(x)) :
        x[e] = int(x[e])
    su = x[0]+x[1]+x[2]  #-12
    su = abs(su)           # int 12
    su = str(su)
    a = su[0]
    return a
    

def f4(a, b, c):
    pass

def main():
    pass
exec(input().strip()) # DON'T remove this line
# 1640511, 2022-09-24 09:59:33, PPP-[--][----] (50%)

def f1(a, b, c):
    x =[]
    x.append(a)
    x.append(b)
    x.append(c)
    x.sort()    #x= [-18,2,4]
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[0] > 0 :
        out = x[0]
    elif x[1] > 0 :
        out = x[1]
    elif x[2] > 0 :
        out = x[2]
    return out
        
    

def f2(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    x.sort()    #x= 
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[2] < 0 :
        out = x[2]
    elif x[1] < 0 :
        out = x[1]
    elif x[0] < 0 :
        out = x[0]
    return out

def f3(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    out = []
    for e in range(len(x)) :
        x[e] = int(x[e])
    su = x[0]+x[1]+x[2]  #-12
    su = abs(su)           # int 12
    su = str(su)
    a = su[0]
    a = int(a)
    return a
    

def f4(a, b, c):
    pass

def main():
    pass
exec(input().strip()) # DON'T remove this line
# 1640539, 2022-09-24 10:00:18, compilation error (0%)

def f1(a, b, c):
    x =[]
    x.append(a)
    x.append(b)
    x.append(c)
    x.sort()    #x= [-18,2,4]
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[0] > 0 :
        out = x[0]
    elif x[1] > 0 :
        out = x[1]
    elif x[2] > 0 :
        out = x[2]
    return out
        
    

def f2(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    x.sort()    #x= 
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[2] < 0 :
        out = x[2]
    elif x[1] < 0 :
        out = x[1]
    elif x[0] < 0 :
        out = x[0]
    return out

def f3(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    out = []
    for e in range(len(x)) :
        x[e] = int(x[e])
    su = x[0]+x[1]+x[2]  #-12
    su = abs(su)           # int 12
    su = str(su)
    a = su[0]
    a = int(a)
    return a
    


def f4(a, b, c):
      x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    out = []
    for e in range(len(x)) :
        x[e] = int(x[e])
    su = x[0]+x[1]+x[2]  #-12
    su = abs(su)           # int 12
    su = str(su)
    a = su[-1]
    a = int(a)
    return a

def main():
    pass
exec(input().strip()) # DON'T remove this line
# 1640545, 2022-09-24 10:00:36, PPPP[--][----] (67%)

def f1(a, b, c):
    x =[]
    x.append(a)
    x.append(b)
    x.append(c)
    x.sort()    #x= [-18,2,4]
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[0] > 0 :
        out = x[0]
    elif x[1] > 0 :
        out = x[1]
    elif x[2] > 0 :
        out = x[2]
    return out
        
    

def f2(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    x.sort()    #x= 
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[2] < 0 :
        out = x[2]
    elif x[1] < 0 :
        out = x[1]
    elif x[0] < 0 :
        out = x[0]
    return out

def f3(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    out = []
    for e in range(len(x)) :
        x[e] = int(x[e])
    su = x[0]+x[1]+x[2]  #-12
    su = abs(su)           # int 12
    su = str(su)
    a = su[0]
    a = int(a)
    return a
    


def f4(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    out = []
    for e in range(len(x)) :
        x[e] = int(x[e])
    su = x[0]+x[1]+x[2]  #-12
    su = abs(su)           # int 12
    su = str(su)
    a = su[-1]
    a = int(a)
    return a

def main():
    pass
exec(input().strip()) # DON'T remove this line
# 1640717, 2022-09-24 10:05:19, PPPP[--][----] (67%)

def f1(a, b, c):
    x =[]
    x.append(a)
    x.append(b)
    x.append(c)
    x.sort()    #x= [-18,2,4]
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[0] > 0 :
        out = x[0]
    elif x[1] > 0 :
        out = x[1]
    elif x[2] > 0 :
        out = x[2]
    return out
        
    

def f2(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    x.sort()    #x= 
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[2] < 0 :
        out = x[2]
    elif x[1] < 0 :
        out = x[1]
    elif x[0] < 0 :
        out = x[0]
    return out

def f3(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    out = []
    for e in range(len(x)) :
        x[e] = int(x[e])
    su = x[0]+x[1]+x[2]  #-12
    su = abs(su)           # int 12
    su = str(su)
    a = su[0]
    a = int(a)
    return a
    


def f4(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    out = []
    for e in range(len(x)) :
        x[e] = int(x[e])
    su = x[0]+x[1]+x[2]  #-12
    su = abs(su)           # int 12
    su = str(su)
    a = su[-1]
    a = int(a)
    return a

def main():
    
   s1,s2,a,b,c = [int(e) for e in input().split()]
   if s1 == 0 and s2 == 0 :
       return [a,b,c]
   elif s1 == 0 and s2 == 1 :
       return [a,b,c]
   elif s1 == 1 and s2 == 0 :
       return [a,b,c]
   elif s1 == 1 and s2 == 1 :
       return [a,b,c]
   else :
       x = "Error"
       return x
    
exec(input().strip()) # DON'T remove this line
# 1640794, 2022-09-24 10:07:13, PPPP[--][----] (67%)

def f1(a, b, c):
    x =[]
    x.append(a)
    x.append(b)
    x.append(c)
    x.sort()    #x= [-18,2,4]
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[0] > 0 :
        out = x[0]
    elif x[1] > 0 :
        out = x[1]
    elif x[2] > 0 :
        out = x[2]
    return out
        
    

def f2(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    x.sort()    #x= 
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[2] < 0 :
        out = x[2]
    elif x[1] < 0 :
        out = x[1]
    elif x[0] < 0 :
        out = x[0]
    return out

def f3(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    out = []
    for e in range(len(x)) :
        x[e] = int(x[e])
    su = x[0]+x[1]+x[2]  #-12
    su = abs(su)           # int 12
    su = str(su)
    a = su[0]
    a = int(a)
    return a
    


def f4(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    out = []
    for e in range(len(x)) :
        x[e] = int(x[e])
    su = x[0]+x[1]+x[2]  #-12
    su = abs(su)           # int 12
    su = str(su)
    a = su[-1]
    a = int(a)
    return a

def main():
   s1,s2,a,b,c = [int(e) for e in input().split()]
   if s1 == 0 and s2 == 0 :
       return f1
   elif s1 == 0 and s2 == 1 :
       return f2
   elif s1 == 1 and s2 == 0 :
       return f3
   elif s1 == 1 and s2 == 1 :
       return f4
   else :
       x = "Error"
       return x
    
    
exec(input().strip()) # DON'T remove this line
# 1640846, 2022-09-24 10:08:23, PPPP[--][----] (67%)

def f1(a, b, c):
    x =[]
    x.append(a)
    x.append(b)
    x.append(c)
    x.sort()    #x= [-18,2,4]
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[0] > 0 :
        out = x[0]
    elif x[1] > 0 :
        out = x[1]
    elif x[2] > 0 :
        out = x[2]
    return out
        
    

def f2(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    x.sort()    #x= 
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[2] < 0 :
        out = x[2]
    elif x[1] < 0 :
        out = x[1]
    elif x[0] < 0 :
        out = x[0]
    return out

def f3(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    out = []
    for e in range(len(x)) :
        x[e] = int(x[e])
    su = x[0]+x[1]+x[2]  #-12
    su = abs(su)           # int 12
    su = str(su)
    a = su[0]
    a = int(a)
    return a
    


def f4(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    out = []
    for e in range(len(x)) :
        x[e] = int(x[e])
    su = x[0]+x[1]+x[2]  #-12
    su = abs(su)           # int 12
    su = str(su)
    a = su[-1]
    a = int(a)
    return a

def main():
   s1,s2,a,b,c = [int(e) for e in input().split()]
   if s1 == 0 and s2 == 0 :
       x = f1(a,b,c)
       return x
   elif s1 == 0 and s2 == 1 :
       x = f2(a,b,c)
       return x
   elif s1 == 1 and s2 == 0 :
       x = f3(a,b,c)
       return x
   elif s1 == 1 and s2 == 1 :
       x = f4(a,b,c)
       return x
   else :
       x = "Error"
       return x
    
    
    
exec(input().strip()) # DON'T remove this line
# 1640946, 2022-09-24 10:11:01, PPPP[--][----] (67%)

def f1(a, b, c):
    x =[]
    x.append(a)
    x.append(b)
    x.append(c)
    x.sort()    #x= [-18,2,4]
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[0] > 0 :
        out = x[0]
    elif x[1] > 0 :
        out = x[1]
    elif x[2] > 0 :
        out = x[2]
    return out
        
    

def f2(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    x.sort()    #x= 
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[2] < 0 :
        out = x[2]
    elif x[1] < 0 :
        out = x[1]
    elif x[0] < 0 :
        out = x[0]
    return out

def f3(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    out = []
    for e in range(len(x)) :
        x[e] = int(x[e])
    su = x[0]+x[1]+x[2]  #-12
    su = abs(su)           # int 12
    su = str(su)
    a = su[0]
    a = int(a)
    return a
    


def f4(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    out = []
    for e in range(len(x)) :
        x[e] = int(x[e])
    su = x[0]+x[1]+x[2]  #-12
    su = abs(su)           # int 12
    su = str(su)
    a = su[-1]
    a = int(a)
    return a

def main():
   s1,s2,a,b,c = [int(e) for e in input().split()]
   if s1 == 0 and s2 == 0 :
    x =[]
    x.append(a)
    x.append(b)
    x.append(c)
    x.sort()    #x= [-18,2,4]
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[0] > 0 :
        out = x[0]
    elif x[1] > 0 :
        out = x[1]
    elif x[2] > 0 :
        out = x[2]
    return out
   
   elif s1 == 0 and s2 == 1 :
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    x.sort()    #x= 
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[2] < 0 :
        out = x[2]
    elif x[1] < 0 :
        out = x[1]
    elif x[0] < 0 :
        out = x[0]
    return out
       
  
   elif s1 == 1 and s2 == 0 :
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    out = []
    for e in range(len(x)) :
        x[e] = int(x[e])
    su = x[0]+x[1]+x[2]  #-12
    su = abs(su)           # int 12
    su = str(su)
    a = su[0]
    a = int(a)
    return a

       
  
   elif s1 == 1 and s2 == 1 :
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    out = []
    for e in range(len(x)) :
        x[e] = int(x[e])
    su = x[0]+x[1]+x[2]  #-12
    su = abs(su)           # int 12
    su = str(su)
    a = su[-1]
    a = int(a)
    return a
       
   else :
       x = "Error"
       return x
    
    
    
exec(input().strip()) # DON'T remove this line
# 1641012, 2022-09-24 10:12:54, PPPP[--][----] (67%)

def f1(a, b, c):
    x =[]
    x.append(a)
    x.append(b)
    x.append(c)
    x.sort()    #x= [-18,2,4]
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[0] > 0 :
        out = x[0]
    elif x[1] > 0 :
        out = x[1]
    elif x[2] > 0 :
        out = x[2]
    return out
        
    

def f2(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    x.sort()    #x= 
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[2] < 0 :
        out = x[2]
    elif x[1] < 0 :
        out = x[1]
    elif x[0] < 0 :
        out = x[0]
    return out

def f3(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    out = []
    for e in range(len(x)) :
        x[e] = int(x[e])
    su = x[0]+x[1]+x[2]  #-12
    su = abs(su)           # int 12
    su = str(su)
    a = su[0]
    a = int(a)
    return a
    


def f4(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    out = []
    for e in range(len(x)) :
        x[e] = int(x[e])
    su = x[0]+x[1]+x[2]  #-12
    su = abs(su)           # int 12
    su = str(su)
    a = su[-1]
    a = int(a)
    return a
def main():
   s1,s2,a,b,c = [int(e) for e in input().split()]
   if s1 == 0 and s2 == 0 :
       return f1(a,b,c)
   elif s1 == 0 and s2 == 1 :
       return f2(a,b,c)
    
   elif s1 == 1 and s2 == 0 :
       return f3(a,b,c)
   elif s1 == 1 and s2 == 1 :
       return f4(a,b,c)       
   else :
       x = "Error"
       return x
    
    
    
    
exec(input().strip()) # DON'T remove this line
# 1642026, 2022-09-24 10:33:13, PPPP[PP][-P-P] (83%)

def f1(a, b, c):
    x =[]
    x.append(a)
    x.append(b)
    x.append(c)
    x.sort()    #x= [-18,2,4]
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[0] > 0 :
        out = x[0]
    elif x[1] > 0 :
        out = x[1]
    elif x[2] > 0 :
        out = x[2]
    return out
        
    

def f2(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    x.sort()    #x= 
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[2] < 0 :
        out = x[2]
    elif x[1] < 0 :
        out = x[1]
    elif x[0] < 0 :
        out = x[0]
    return out

def f3(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    out = []
    for e in range(len(x)) :
        x[e] = int(x[e])
    su = x[0]+x[1]+x[2]  #-12
    su = abs(su)           # int 12
    su = str(su)
    a = su[0]
    a = int(a)
    return a
    


def f4(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    out = []
    for e in range(len(x)) :
        x[e] = int(x[e])
    su = x[0]+x[1]+x[2]  #-12
    su = abs(su)           # int 12
    su = str(su)
    a = su[-1]
    a = int(a)
    return a
def main():
   s1,s2,a,b,c = [int(e) for e in input().split()]
   if s1 == 0 and s2 == 0 :
       return print(f1(a,b,c))
   elif s1 == 0 and s2 == 1 :
       return print(f2(a,b,c))
    
   elif s1 == 1 and s2 == 0 :
       return print(f3(a,b,c))
   elif s1 == 1 and s2 == 1 :
       return print(f4(a,b,c))       
   else :
       x = "Error"
       return x
    
    
    
    
exec(input().strip()) # DON'T remove this line
# 1642052, 2022-09-24 10:33:36, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    x =[]
    x.append(a)
    x.append(b)
    x.append(c)
    x.sort()    #x= [-18,2,4]
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[0] > 0 :
        out = x[0]
    elif x[1] > 0 :
        out = x[1]
    elif x[2] > 0 :
        out = x[2]
    return out
        
    

def f2(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    x.sort()    #x= 
    for e in range(len(x)) :
        x[e] = int(x[e])
    if x[2] < 0 :
        out = x[2]
    elif x[1] < 0 :
        out = x[1]
    elif x[0] < 0 :
        out = x[0]
    return out

def f3(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    out = []
    for e in range(len(x)) :
        x[e] = int(x[e])
    su = x[0]+x[1]+x[2]  #-12
    su = abs(su)           # int 12
    su = str(su)
    a = su[0]
    a = int(a)
    return a
    


def f4(a, b, c):
    x =[]
    x.append(a)   # [-20,-18,-4]
    x.append(b)
    x.append(c)
    out = []
    for e in range(len(x)) :
        x[e] = int(x[e])
    su = x[0]+x[1]+x[2]  #-12
    su = abs(su)           # int 12
    su = str(su)
    a = su[-1]
    a = int(a)
    return a
def main():
   s1,s2,a,b,c = [int(e) for e in input().split()]
   if s1 == 0 and s2 == 0 :
       return print(f1(a,b,c))
   elif s1 == 0 and s2 == 1 :
       return print(f2(a,b,c))
    
   elif s1 == 1 and s2 == 0 :
       return print(f3(a,b,c))
   elif s1 == 1 and s2 == 1 :
       return print(f4(a,b,c))       
   else :
       x = "Error"
       return print(x)
    
    
    
    
exec(input().strip()) # DON'T remove this line

6532143021
# 1639431, 2022-09-24 09:30:16, ----[--][----] (0%)

s = input()

x = 0
a = 0
l = []
op = '+'
    
for i in range(len(s)):
    if '0' <= s[i] <= '9':
        a *= 10
        a += int(s[i])
    else:
        if op == '+':
            l.append(a)
        else:
            l.append(-a)
        op = s[i]
        a = 0

if op == '+':
    l.append(a)
else:
    l.append(-a)
    
# print(l)
for i in l:
    x += i
print(x)
        
    
# 1639869, 2022-09-24 09:41:31, ----[PP][PPPP] (33%)

def f1(a, b, c):
    if a < 0:
        if b < c and b > 0:
            return b
        return c
    if b < 0:
        if a < c and a > 0:
            return a
        return c
    if c < 0:
        if a < b and a > 0:
            return a
        return b
def f2(a, b, c):
    if a > 0:
        if b > c and b < 0:
            return b
        return c
    if b > 0:
        if a > c and a < 0:
            return a
        return c
    if c > 0:
        if a > b and a < 0:
            return a
        return b
def f3(a, b, c):
    s = str(a + b + c)
    if s[0] == '-':
        s = s[1:]
    return (s[0])
    
def f4(a, b, c):
    s = str(a + b + c)
    return s[-1]
    
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
        
exec(input().strip()) # DON'T remove this line 

# 1639979, 2022-09-24 09:44:30, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    if a < 0:
        if b < c and b > 0:
            return b
        return c
    if b < 0:
        if a < c and a > 0:
            return a
        return c
    if c < 0:
        if a < b and a > 0:
            return a
        return b
def f2(a, b, c):
    if a > 0:
        if b > c and b < 0:
            return b
        return c
    if b > 0:
        if a > c and a < 0:
            return a
        return c
    if c > 0:
        if a > b and a < 0:
            return a
        return b
def f3(a, b, c):
    s = str(a + b + c)
    if s[0] == '-':
        s = s[1:]
    return int(s[0])
    
def f4(a, b, c):
    s = str(a + b + c)
    return int(s[-1])
    
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
        
exec(input().strip()) # DON'T remove this line 

# 1640249, 2022-09-24 09:52:05, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    if a > 0 and b > 0:
        if a < b:
            return a
        return b
    if a > 0 and c > 0:
        if a < c:
            return a
        return c
    if b > 0 and c > 0:
        if b < c:
            return b
        return c
    
def f2(a, b, c):
    if a < 0 and b < 0:
        if a > b:
            return a
        return b
    if a < 0 and c < 0:
        if a > c:
            return a
        return c
    if b < 0 and c < 0:
        if b > c:
            return b
        return c
    
def f3(a, b, c):
    s = str(a + b + c)
    if s[0] == '-':
        s = s[1:]
    return int(s[0])
    
def f4(a, b, c):
    s = str(a + b + c)
    return int(s[-1])
    
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
        
exec(input().strip()) # DON'T remove this line 

# 1640312, 2022-09-24 09:54:00, compilation error (0%)

def f1(a, b, c):
    if a > 0 and b > 0:
        if a < b:
            return a
        return b
    if a > 0 and c > 0:
        if a < c:
            return a
        return c
    if b > 0 and c > 0:
        if b < c:
            return b
        return c
    
def f2(a, b, c):
    if a < 0 and b < 0:
        if a > b:
            return a
        return b
    if a < 0 and c < 0:
        if a > c:
            return a
        return c
    if b < 0 and c < 0:
        if b > c:
            return b
        return c
    
def f3(a, b, c):
    s = str(a + b + c)
    if s[0] == '-':
        s = s[1:]
    return int(s[0])
    
def f4(a, b, c):
    s = str(a + b + c)
    return int(s[-1])
    
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        # print('Error')
        
exec(input().strip()) # DON'T remove this line 

# 1640315, 2022-09-24 09:54:11, --PP[PP][-P-P] (50%)

def f1(a, b, c):
    if a > 0 and b > 0:
        if a < b:
            return a
        return b
    if a > 0 and c > 0:
        if a < c:
            return a
        return c
    if b > 0 and c > 0:
        if b < c:
            return b
        return c
    
def f2(a, b, c):
    if a < 0 and b < 0:
        if a > b:
            return a
        return b
    if a < 0 and c < 0:
        if a > c:
            return a
        return c
    if b < 0 and c < 0:
        if b > c:
            return b
        return c
    
def f3(a, b, c):
    s = str(a + b + c)
    if s[0] == '-':
        s = s[1:]
    return int(s[0])
    
def f4(a, b, c):
    s = str(a + b + c)
    return int(s[-1])
    
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    # else:
        # print('Error')
        
exec(input().strip()) # DON'T remove this line
# 1640319, 2022-09-24 09:54:21, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    if a > 0 and b > 0:
        if a < b:
            return a
        return b
    if a > 0 and c > 0:
        if a < c:
            return a
        return c
    if b > 0 and c > 0:
        if b < c:
            return b
        return c
    
def f2(a, b, c):
    if a < 0 and b < 0:
        if a > b:
            return a
        return b
    if a < 0 and c < 0:
        if a > c:
            return a
        return c
    if b < 0 and c < 0:
        if b > c:
            return b
        return c
    
def f3(a, b, c):
    s = str(a + b + c)
    if s[0] == '-':
        s = s[1:]
    return int(s[0])
    
def f4(a, b, c):
    s = str(a + b + c)
    return int(s[-1])
    
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
        
exec(input().strip()) # DON'T remove this line
# 1640320, 2022-09-24 09:54:24, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    if a > 0 and b > 0:
        if a < b:
            return a
        return b
    if a > 0 and c > 0:
        if a < c:
            return a
        return c
    if b > 0 and c > 0:
        if b < c:
            return b
        return c
    
def f2(a, b, c):
    if a < 0 and b < 0:
        if a > b:
            return a
        return b
    if a < 0 and c < 0:
        if a > c:
            return a
        return c
    if b < 0 and c < 0:
        if b > c:
            return b
        return c
    
def f3(a, b, c):
    s = str(a + b + c)
    if s[0] == '-':
        s = s[1:]
    return int(s[0])
    
def f4(a, b, c):
    s = str(a + b + c)
    return int(s[-1])
    
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
        
exec(input().strip()) # DON'T remove this line
# 1640332, 2022-09-24 09:54:39, --xx[PP][PxPx] (17%)

def f1(a, b, c):
    if a > 0 and b > 0:
        if a < b:
            return a
        return b
    if a > 0 and c > 0:
        if a < c:
            return a
        return c
    if b > 0 and c > 0:
        if b < c:
            return b
        return c
    
def f2(a, b, c):
    if a < 0 and b < 0:
        if a > b:
            return a
        return b
    if a < 0 and c < 0:
        if a > c:
            return a
        return c
    if b < 0 and c < 0:
        if b > c:
            return b
        return c
    
# def f3(a, b, c):
#     s = str(a + b + c)
#     if s[0] == '-':
#         s = s[1:]
#     return int(s[0])
    
# def f4(a, b, c):
#     s = str(a + b + c)
#     return int(s[-1])
    
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
        
exec(input().strip()) # DON'T remove this line
# 1640337, 2022-09-24 09:54:52, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    if a > 0 and b > 0:
        if a < b:
            return a
        return b
    if a > 0 and c > 0:
        if a < c:
            return a
        return c
    if b > 0 and c > 0:
        if b < c:
            return b
        return c
    
def f2(a, b, c):
    if a < 0 and b < 0:
        if a > b:
            return a
        return b
    if a < 0 and c < 0:
        if a > c:
            return a
        return c
    if b < 0 and c < 0:
        if b > c:
            return b
        return c
    
def f3(a, b, c):
    s = str(a + b + c)
    if s[0] == '-':
        s = s[1:]
    return int(s[0])
    
def f4(a, b, c):
    s = str(a + b + c)
    return int(s[-1])
    
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
        
exec(input().strip()) # DON'T remove this line
# 1640349, 2022-09-24 09:55:24, xxPP[xx][PPPP] (50%)

# def f1(a, b, c):
#     if a > 0 and b > 0:
#         if a < b:
#             return a
#         return b
#     if a > 0 and c > 0:
#         if a < c:
#             return a
#         return c
#     if b > 0 and c > 0:
#         if b < c:
#             return b
#         return c
    
# def f2(a, b, c):
#     if a < 0 and b < 0:
#         if a > b:
#             return a
#         return b
#     if a < 0 and c < 0:
#         if a > c:
#             return a
#         return c
#     if b < 0 and c < 0:
#         if b > c:
#             return b
#         return c
    
def f3(a, b, c):
    s = str(a + b + c)
    if s[0] == '-':
        s = s[1:]
    return int(s[0])
    
def f4(a, b, c):
    s = str(a + b + c)
    return int(s[-1])
    
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
        
exec(input().strip()) # DON'T remove this line
# 1640358, 2022-09-24 09:55:34, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    if a > 0 and b > 0:
        if a < b:
            return a
        return b
    if a > 0 and c > 0:
        if a < c:
            return a
        return c
    if b > 0 and c > 0:
        if b < c:
            return b
        return c
    
def f2(a, b, c):
    if a < 0 and b < 0:
        if a > b:
            return a
        return b
    if a < 0 and c < 0:
        if a > c:
            return a
        return c
    if b < 0 and c < 0:
        if b > c:
            return b
        return c
    
def f3(a, b, c):
    s = str(a + b + c)
    if s[0] == '-':
        s = s[1:]
    return int(s[0])
    
def f4(a, b, c):
    s = str(a + b + c)
    return int(s[-1])
    
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
        
exec(input().strip()) # DON'T remove this line
# 1640437, 2022-09-24 09:57:51, PPPP[PP][-P-P] (83%)

def f1(a, b, c):
    if a > 0 and b > 0:
        if a < b:
            return a
        return b
    if a > 0 and c > 0:
        if a < c:
            return a
        return c
    if b > 0 and c > 0:
        if b < c:
            return b
        return c
    
    if b <= 0 and c <= 0:
        return a
    if a <= 0 and b <= 0:
        return c
    if a <= 0 and c <= 0:
        return b
    
def f2(a, b, c):
    if a < 0 and b < 0:
        if a > b:
            return a
        return b
    if a < 0 and c < 0:
        if a > c:
            return a
        return c
    if b < 0 and c < 0:
        if b > c:
            return b
        return c
    
    if b >= 0 and c >= 0:
        return a
    if a >= 0 and b >= 0:
        return c
    if a >= 0 and c >= 0:
        return b
    
def f3(a, b, c):
    s = str(a + b + c)
    if s[0] == '-':
        s = s[1:]
    return int(s[0])
    
def f4(a, b, c):
    s = str(a + b + c)
    return int(s[-1])
    
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    # else:
        # print('Error')
        
exec(input().strip()) # DON'T remove this line 

# 1640456, 2022-09-24 09:58:29, PPPP[PP][-P-P] (83%)

def f1(a, b, c):
    if b <= 0 and c <= 0:
        return a
    if a <= 0 and b <= 0:
        return c
    if a <= 0 and c <= 0:
        return b
    
    if a > 0 and b > 0:
        if a < b:
            return a
        return b
    if a > 0 and c > 0:
        if a < c:
            return a
        return c
    if b > 0 and c > 0:
        if b < c:
            return b
        return c 
    
def f2(a, b, c):
    if b >= 0 and c >= 0:
        return a
    if a >= 0 and b >= 0:
        return c
    if a >= 0 and c >= 0:
        return b
    
    if a < 0 and b < 0:
        if a > b:
            return a
        return b
    if a < 0 and c < 0:
        if a > c:
            return a
        return c
    if b < 0 and c < 0:
        if b > c:
            return b
        return c
    
    
    
def f3(a, b, c):
    s = str(a + b + c)
    if s[0] == '-':
        s = s[1:]
    return int(s[0])
    
def f4(a, b, c):
    s = str(a + b + c)
    return int(s[-1])
    
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    # else:
        # print('Error')
        
exec(input().strip()) # DON'T remove this line 

# 1640715, 2022-09-24 10:05:18, --PP[PP][-P-P] (50%)

def f1(a, b, c):
    if b < 0 and c < 0:
        return a
    if a < 0 and b < 0:
        return c
    if a < 0 and c < 0:
        return b
    
    if a > 0 and b > 0:
        if a < b:
            return a
        return b
    if a > 0 and c > 0:
        if a < c:
            return a
        return c
    if b > 0 and c > 0:
        if b < c:
            return b
        return c 
    
def f2(a, b, c):
    if b > 0 and c > 0:
        return a
    if a > 0 and b > 0:
        return c
    if a > 0 and c > 0:
        return b
    
    if a < 0 and b < 0:
        if a > b:
            return a
        return b
    if a < 0 and c < 0:
        if a > c:
            return a
        return c
    if b < 0 and c < 0:
        if b > c:
            return b
        return c
    
    
    
def f3(a, b, c):
    s = str(a + b + c)
    if s[0] == '-':
        s = s[1:]
    return int(s[0])
    
def f4(a, b, c):
    s = str(a + b + c)
    return int(s[-1])
    
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    # else:
        # print('Error')
        
exec(input().strip()) # DON'T remove this line 

# 1640938, 2022-09-24 10:10:49, compilation error (0%)

def f1(a, b, c):
    if a > 0 and b <=0 and c <= 0:
        return a
    if b > 0 and a <=0 and c <= 0:
        return b
    if c > 0 and b <=0 and a <= 0:
        return c:
    
    if a > 0 and b > 0:
        if a < b:
            return a
        return b
    if a > 0 and c > 0:
        if a < c:
            return a
        return c
    if c > 0 and b > 0:
        if c < b:
            return c
        return b
    
def f2(a, b, c):
    if a < 0 and b >=0 and c >= 0:
        return a
    if b < 0 and a >=0 and c >= 0:
        return b
    if c < 0 and b >=0 and a >= 0:
        return c:
    
    if a < 0 and b < 0:
        if a > b:
            return a
        return b
    if a < 0 and c < 0:
        if a > c:
            return a
        return c
    if c < 0 and b < 0:
        if c > b:
            return c
        return b
    
    
    
def f3(a, b, c):
    s = str(a + b + c)
    if s[0] == '-':
        s = s[1:]
    return int(s[0])
    
def f4(a, b, c):
    s = str(a + b + c)
    return int(s[-1])
    
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    # else:
        # print('Error')
        
exec(input().strip()) # DON'T remove this line 

# 1640954, 2022-09-24 10:11:17, PPPP[PP][-P-P] (83%)

def f1(a, b, c):
    if a > 0 and b <=0 and c <= 0:
        return a
    if b > 0 and a <=0 and c <= 0:
        return b
    if c > 0 and b <=0 and a <= 0:
        return c
    
    if a > 0 and b > 0:
        if a < b:
            return a
        return b
    if a > 0 and c > 0:
        if a < c:
            return a
        return c
    if c > 0 and b > 0:
        if c < b:
            return c
        return b
    
def f2(a, b, c):
    if a < 0 and b >=0 and c >= 0:
        return a
    if b < 0 and a >=0 and c >= 0:
        return b
    if c < 0 and b >=0 and a >= 0:
        return c
    
    if a < 0 and b < 0:
        if a > b:
            return a
        return b
    if a < 0 and c < 0:
        if a > c:
            return a
        return c
    if c < 0 and b < 0:
        if c > b:
            return c
        return b
    
    
    
def f3(a, b, c):
    s = str(a + b + c)
    if s[0] == '-':
        s = s[1:]
    return int(s[0])
    
def f4(a, b, c):
    s = str(a + b + c)
    return int(s[-1])
    
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    # else:
        # print('Error')
        
exec(input().strip()) # DON'T remove this line 

# 1641057, 2022-09-24 10:13:59, PPPP[PP][-P-P] (83%)

def f1(a, b, c):
    if b <=0 and c <= 0:
        return a
    if a <=0 and c <= 0:
        return b
    if b <=0 and a <= 0:
        return c
    
    if a > 0 and b > 0:
        if a < b:
            return a
        return b
    if a > 0 and c > 0:
        if a < c:
            return a
        return c
    if c > 0 and b > 0:
        if c < b:
            return c
        return b

    if a > 0 and b > 0 and c > 0:
        return min(a,b,c)
    
def f2(a, b, c):
    if a < 0 and b >=0 and c >= 0:
        return a
    if b < 0 and a >=0 and c >= 0:
        return b
    if c < 0 and b >=0 and a >= 0:
        return c
    
    if a < 0 and b < 0:
        if a > b:
            return a
        return b
    if a < 0 and c < 0:
        if a > c:
            return a
        return c
    if c < 0 and b < 0:
        if c > b:
            return c
        return b
    
    
    
def f3(a, b, c):
    s = str(a + b + c)
    if s[0] == '-':
        s = s[1:]
    return int(s[0])
    
def f4(a, b, c):
    s = str(a + b + c)
    return int(s[-1])
    
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    # else:
        # print('Error')
        
exec(input().strip()) # DON'T remove this line 

# 1641118, 2022-09-24 10:15:47, -PPP[PP][-P-P] (67%)

def f1(a, b, c):
    # if b <=0 and c <= 0:
    #     return a
    # if a <=0 and c <= 0:
    #     return b
    # if b <=0 and a <= 0:
    #     return c
    
    if a > 0 and b > 0:
        if a < b:
            return a
        return b
    if a > 0 and c > 0:
        if a < c:
            return a
        return c
    if c > 0 and b > 0:
        if c < b:
            return c
        return b

    if a > 0 and b > 0 and c > 0:
        return min(a,b,c)
    
def f2(a, b, c):
    if a < 0 and b >=0 and c >= 0:
        return a
    if b < 0 and a >=0 and c >= 0:
        return b
    if c < 0 and b >=0 and a >= 0:
        return c
    
    if a < 0 and b < 0:
        if a > b:
            return a
        return b
    if a < 0 and c < 0:
        if a > c:
            return a
        return c
    if c < 0 and b < 0:
        if c > b:
            return c
        return b
    
    
    
def f3(a, b, c):
    s = str(a + b + c)
    if s[0] == '-':
        s = s[1:]
    return int(s[0])
    
def f4(a, b, c):
    s = str(a + b + c)
    return int(s[-1])
    
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    # else:
        # print('Error')
        
exec(input().strip()) # DON'T remove this line
# 1641135, 2022-09-24 10:16:09, --PP[PP][-P-P] (50%)

def f1(a, b, c):
    # if b <=0 and c <= 0:
    #     return a
    # if a <=0 and c <= 0:
    #     return b
    # if b <=0 and a <= 0:
    #     return c
    
    if a > 0 and b > 0:
        if a < b:
            return a
        return b
    if a > 0 and c > 0:
        if a < c:
            return a
        return c
    if c > 0 and b > 0:
        if c < b:
            return c
        return b

    # if a > 0 and b > 0 and c > 0:
    #     return min(a,b,c)
    
def f2(a, b, c):
    # if a < 0 and b >=0 and c >= 0:
    #     return a
    # if b < 0 and a >=0 and c >= 0:
    #     return b
    # if c < 0 and b >=0 and a >= 0:
    #     return c
    
    if a < 0 and b < 0:
        if a > b:
            return a
        return b
    if a < 0 and c < 0:
        if a > c:
            return a
        return c
    if c < 0 and b < 0:
        if c > b:
            return c
        return b
    
    
    
def f3(a, b, c):
    s = str(a + b + c)
    if s[0] == '-':
        s = s[1:]
    return int(s[0])
    
def f4(a, b, c):
    s = str(a + b + c)
    return int(s[-1])
    
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    # else:
        # print('Error')
        
exec(input().strip()) # DON'T remove this line
# 1641140, 2022-09-24 10:16:19, PPPP[PP][-P-P] (83%)

def f1(a, b, c):
    if b <=0 and c <= 0:
        return a
    if a <=0 and c <= 0:
        return b
    if b <=0 and a <= 0:
        return c
    
    if a > 0 and b > 0:
        if a < b:
            return a
        return b
    if a > 0 and c > 0:
        if a < c:
            return a
        return c
    if c > 0 and b > 0:
        if c < b:
            return c
        return b

    # if a > 0 and b > 0 and c > 0:
    #     return min(a,b,c)
    
def f2(a, b, c):
    if a < 0 and b >=0 and c >= 0:
        return a
    if b < 0 and a >=0 and c >= 0:
        return b
    if c < 0 and b >=0 and a >= 0:
        return c
    
    if a < 0 and b < 0:
        if a > b:
            return a
        return b
    if a < 0 and c < 0:
        if a > c:
            return a
        return c
    if c < 0 and b < 0:
        if c > b:
            return c
        return b
    
    
    
def f3(a, b, c):
    s = str(a + b + c)
    if s[0] == '-':
        s = s[1:]
    return int(s[0])
    
def f4(a, b, c):
    s = str(a + b + c)
    return int(s[-1])
    
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    # else:
        # print('Error')
        
exec(input().strip()) # DON'T remove this line
# 1641208, 2022-09-24 10:17:47, PPPP[PP][-P-P] (83%)

def f1(a, b, c):
    if b <= 0 and c <= 0:
        return a
    if a <= 0 and c <= 0:
        return b
    if b <= 0 and a <= 0:
        return c
    
    
    if a > 0 and b > 0:
        if a < b:
            return a
        return b
    if a > 0 and c > 0:
        if a < c:
            return a
        return c
    if b > 0 and c > 0:
        if b < c:
            return b
        return c

    
def f2(a, b, c):
    if a < 0 and b >=0 and c >= 0:
        return a
    if b < 0 and a >=0 and c >= 0:
        return b
    if c < 0 and b >=0 and a >= 0:
        return c
    
    if a < 0 and b < 0:
        if a > b:
            return a
        return b
    if a < 0 and c < 0:
        if a > c:
            return a
        return c
    if b < 0 and c < 0:
        if b > c:
            return b
        return c
    
    
    
def f3(a, b, c):
    s = str(a + b + c)
    if s[0] == '-':
        s = s[1:]
    return int(s[0])
    
def f4(a, b, c):
    s = str(a + b + c)
    return int(s[-1])
    
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    # else:
        # print('Error')
        
exec(input().strip()) # DON'T remove this line 

# 1641258, 2022-09-24 10:18:50, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    # if b <= 0 and c <= 0:
    #     return a
    # if a <= 0 and c <= 0:
    #     return b
    # if b <= 0 and a <= 0:
    #     return c
    
    
    if a > 0 and b > 0:
        if a < b:
            return a
        return b
    if a > 0 and c > 0:
        if a < c:
            return a
        return c
    if b > 0 and c > 0:
        if b < c:
            return b
        return c

    
def f2(a, b, c):
    # if a < 0 and b >=0 and c >= 0:
    #     return a
    # if b < 0 and a >=0 and c >= 0:
    #     return b
    # if c < 0 and b >=0 and a >= 0:
    #     return c
    
    if a < 0 and b < 0:
        if a > b:
            return a
        return b
    if a < 0 and c < 0:
        if a > c:
            return a
        return c
    if b < 0 and c < 0:
        if b > c:
            return b
        return c
    
    
    
def f3(a, b, c):
    s = str(a + b + c)
    if s[0] == '-':
        s = s[1:]
    return int(s[0])
    
def f4(a, b, c):
    s = str(a + b + c)
    return int(s[-1])
    
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
        
exec(input().strip()) # DON'T remove this line
# 1641273, 2022-09-24 10:19:02, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    if b <= 0 and c <= 0:
        return a
    if a <= 0 and c <= 0:
        return b
    if b <= 0 and a <= 0:
        return c
    
    
    if a > 0 and b > 0:
        if a < b:
            return a
        return b
    if a > 0 and c > 0:
        if a < c:
            return a
        return c
    if b > 0 and c > 0:
        if b < c:
            return b
        return c

    
def f2(a, b, c):
    if a < 0 and b >=0 and c >= 0:
        return a
    if b < 0 and a >=0 and c >= 0:
        return b
    if c < 0 and b >=0 and a >= 0:
        return c
    
    if a < 0 and b < 0:
        if a > b:
            return a
        return b
    if a < 0 and c < 0:
        if a > c:
            return a
        return c
    if b < 0 and c < 0:
        if b > c:
            return b
        return c
    
    
    
def f3(a, b, c):
    s = str(a + b + c)
    if s[0] == '-':
        s = s[1:]
    return int(s[0])
    
def f4(a, b, c):
    s = str(a + b + c)
    return int(s[-1])
    
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
        
exec(input().strip()) # DON'T remove this line

6532082421
# 1639047, 2022-09-24 09:21:01, PP-P[--][PPP-] (50%)

def f1(a, b, c):
    lst = [a, b, c]
    mn = 6e9
    for e in lst:
        if (mn > e and e > 0):
            mn = e
    return mn


def f2(a, b, c):
    return -f1(-a, -b, -c)


def f3(a, b, c):
    total = a+b+c
    while (total >= 10):
        total //= 10
    total = int(total)
    if (total < 0):
        return -total
    return total


def f4(a, b, c):
    total = a+b+c
    if (total < 0):
        total = -total
    return total % 10


def main():
    s1, s2, a, b, c = input().split()
    if (not s1.isalnum() or not s2.isalnum()):
        print('Error')
        return
    a = int(a)
    b = int(b)
    c = int(c)
    if (s1 == s2):
        if (s1 == 0):
            print(f1(a, b, c))
        else:
            print(f4(a, b, c))
    else:
        if (s1 == 0):
            print(f2(a, b, c))
        else:
            print(f3(a, b, c))


exec(input().strip())  # DON'T remove this line

# 1639234, 2022-09-24 09:25:23, PPPP[--][P-P-] (67%)

def f1(a, b, c):
    lst = [a, b, c]
    mn = 6e9
    for e in lst:
        if (mn > e and e > 0):
            mn = e
    return mn


def f2(a, b, c):
    return -f1(-a, -b, -c)


def f3(a, b, c):
    total = a+b+c
    if (total < 0):
        total = -total
    while (total >= 10):
        total //= 10
    total = int(total)
    if (total < 0):
        return -total
    return total


def f4(a, b, c):
    total = a+b+c
    if (total < 0):
        total = -total
    return total % 10


def main():
    s1, s2, a, b, c = input().split()
    if (not (s1 == 1 or s1 == 0) or not (s2 == 1 or s2 == 0)):
        print('Error')
        return
    a = int(a)
    b = int(b)
    c = int(c)
    if (s1 == s2):
        if (s1 == 0):
            print(f1(a, b, c))
        else:
            print(f4(a, b, c))
    else:
        if (s1 == 0):
            print(f2(a, b, c))
        else:
            print(f3(a, b, c))


exec(input().strip())  # DON'T remove this line

# 1639317, 2022-09-24 09:27:21, PPPP[--][P-P-] (67%)

def f1(a, b, c):
    lst = [a, b, c]
    mn = 6e9
    for e in lst:
        if (mn > e and e > 0):
            mn = e
    return mn


def f2(a, b, c):
    return -f1(-a, -b, -c)


def f3(a, b, c):
    total = a+b+c
    if (total < 0):
        total = -total
    while (total >= 10):
        total //= 10
    total = int(total)
    if (total < 0):
        return -total
    return total


def f4(a, b, c):
    total = a+b+c
    if (total < 0):
        total = -total
    return total % 10


def main():
    s1, s2, a, b, c = input().split()
    if (not (s1 == 1 or s1 == 0) or not (s2 == 1 or s2 == 0)):
        print('Error')
        return
    a = int(a)
    b = int(b)
    c = int(c)
    if (s1 == s2):
        if (s1 == 0):
            print(f1(a, b, c))
        else:
            print(f4(a, b, c))
    else:
        if (s1 == 0):
            print(f2(a, b, c))
        else:
            print(f3(a, b, c))


exec(input().strip())  # DON'T remove this line

# 1639399, 2022-09-24 09:29:26, PPPP[--][PPPP] (83%)

def f1(a, b, c):
    lst = [a, b, c]
    mn = 6e9
    for e in lst:
        if (mn > e and e > 0):
            mn = e
    return mn


def f2(a, b, c):
    return -f1(-a, -b, -c)


def f3(a, b, c):
    total = a+b+c
    if (total < 0):
        total = -total
    while (total >= 10):
        total //= 10
    total = int(total)
    if (total < 0):
        return -total
    return total


def f4(a, b, c):
    total = a+b+c
    if (total < 0):
        total = -total
    return total % 10


def main():
    s1, s2, a, b, c = input().split()
    if (not ((s1 == '1' or s1 == '0') and (s2 == '1' or s2 == '0'))):
        print('Error')
        return
    a = int(a)
    b = int(b)
    c = int(c)
    if (s1 == s2):
        if (s1 == 0):
            print(f1(a, b, c))
        else:
            print(f4(a, b, c))
    else:
        if (s1 == 0):
            print(f2(a, b, c))
        else:
            print(f3(a, b, c))


exec(input().strip())  # DON'T remove this line

# 1639455, 2022-09-24 09:30:50, xxPP[--][PPPP] (50%)

# def f1(a, b, c):
#     lst = [a, b, c]
#     mn = 6e9
#     for e in lst:
#         if (mn > e and e > 0):
#             mn = e
#     return mn


# def f2(a, b, c):
#     return -f1(-a, -b, -c)


def f3(a, b, c):
    total = a+b+c
    if (total < 0):
        total = -total
    while (total >= 10):
        total //= 10
    total = int(total)
    if (total < 0):
        return -total
    return total


def f4(a, b, c):
    total = a+b+c
    if (total < 0):
        total = -total
    return total % 10


def main():
    s1, s2, a, b, c = input().split()
    if (not ((s1 == '1' or s1 == '0') and (s2 == '1' or s2 == '0'))):
        print('Error')
        return
    a = int(a)
    b = int(b)
    c = int(c)
    if (s1 == s2):
        if (s1 == 0):
            print(f1(a, b, c))
        else:
            print(f4(a, b, c))
    else:
        if (s1 == 0):
            print(f2(a, b, c))
        else:
            print(f3(a, b, c))


exec(input().strip())  # DON'T remove this line

# 1639464, 2022-09-24 09:31:02, PPPP[--][PPPP] (83%)

def f1(a, b, c):
    lst = [a, b, c]
    mn = 6e9
    for e in lst:
        if (mn > e and e > 0):
            mn = e
    return mn


def f2(a, b, c):
    return -f1(-a, -b, -c)


def f3(a, b, c):
    total = a+b+c
    if (total < 0):
        total = -total
    while (total >= 10):
        total //= 10
    total = int(total)
    if (total < 0):
        return -total
    return total


def f4(a, b, c):
    total = a+b+c
    if (total < 0):
        total = -total
    return total % 10


def main():
    s1, s2, a, b, c = input().split()
    if (not ((s1 == '1' or s1 == '0') and (s2 == '1' or s2 == '0'))):
        print('Error')
        return
    a = int(a)
    b = int(b)
    c = int(c)
    if (s1 == s2):
        if (s1 == 0):
            print(f1(a, b, c))
        else:
            print(f4(a, b, c))
    else:
        if (s1 == 0):
            print(f2(a, b, c))
        else:
            print(f3(a, b, c))


exec(input().strip())  # DON'T remove this line

# 1639469, 2022-09-24 09:31:12, PPxP[-x][PxPx] (50%)

def f1(a, b, c):
    lst = [a, b, c]
    mn = 6e9
    for e in lst:
        if (mn > e and e > 0):
            mn = e
    return mn


def f2(a, b, c):
    return -f1(-a, -b, -c)


# def f3(a, b, c):
#     total = a+b+c
#     if (total < 0):
#         total = -total
#     while (total >= 10):
#         total //= 10
#     total = int(total)
#     if (total < 0):
#         return -total
#     return total


def f4(a, b, c):
    total = a+b+c
    if (total < 0):
        total = -total
    return total % 10


def main():
    s1, s2, a, b, c = input().split()
    if (not ((s1 == '1' or s1 == '0') and (s2 == '1' or s2 == '0'))):
        print('Error')
        return
    a = int(a)
    b = int(b)
    c = int(c)
    if (s1 == s2):
        if (s1 == 0):
            print(f1(a, b, c))
        else:
            print(f4(a, b, c))
    else:
        if (s1 == 0):
            print(f2(a, b, c))
        else:
            print(f3(a, b, c))


exec(input().strip())  # DON'T remove this line

# 1639631, 2022-09-24 09:35:02, PPPP[--][PPPP] (83%)

def f1(a, b, c):
    lst = [a, b, c]
    mn = 6e9
    for e in lst:
        if (mn > e and e > 0):
            mn = e
    return mn


def f2(a, b, c):
    return -f1(-a, -b, -c)


def f3(a, b, c):
    total = a+b+c
    if (total < 0):
        total = -total
    while (total >= 10):
        total //= 10
    total = int(total)
    return total


def f4(a, b, c):
    total = a+b+c
    if (total < 0):
        total = -total
    return total % 10


def main():
    s1, s2, a, b, c = input().split()
    if (not ((s1 == '1' or s1 == '0') and (s2 == '1' or s2 == '0'))):
        print('Error')
        return
    a = int(a)
    b = int(b)
    c = int(c)
    if (s1 == s2):
        if (s1 == 0):
            print(f1(a, b, c))
        else:
            print(f4(a, b, c))
    else:
        if (s1 == 0):
            print(f2(a, b, c))
        else:
            print(f3(a, b, c))


exec(input().strip())  # DON'T remove this line

# 1639635, 2022-09-24 09:35:14, PPPx[x-][PPPP] (67%)

def f1(a, b, c):
    lst = [a, b, c]
    mn = 6e9
    for e in lst:
        if (mn > e and e > 0):
            mn = e
    return mn


def f2(a, b, c):
    return -f1(-a, -b, -c)


def f3(a, b, c):
    total = a+b+c
    if (total < 0):
        total = -total
    while (total >= 10):
        total //= 10
    total = int(total)
    return total


# def f4(a, b, c):
#     total = a+b+c
#     if (total < 0):
#         total = -total
#     return total % 10


def main():
    s1, s2, a, b, c = input().split()
    if (not ((s1 == '1' or s1 == '0') and (s2 == '1' or s2 == '0'))):
        print('Error')
        return
    a = int(a)
    b = int(b)
    c = int(c)
    if (s1 == s2):
        if (s1 == 0):
            print(f1(a, b, c))
        else:
            print(f4(a, b, c))
    else:
        if (s1 == 0):
            print(f2(a, b, c))
        else:
            print(f3(a, b, c))


exec(input().strip())  # DON'T remove this line
# 1639639, 2022-09-24 09:35:26, PPPP[--][PPPP] (83%)

def f1(a, b, c):
    lst = [a, b, c]
    mn = 6e9
    for e in lst:
        if (mn > e and e > 0):
            mn = e
    return mn


def f2(a, b, c):
    return -f1(-a, -b, -c)


def f3(a, b, c):
    total = a+b+c
    if (total < 0):
        total = -total
    while (total >= 10):
        total //= 10
    total = int(total)
    return total


def f4(a, b, c):
    total = a+b+c
    if (total < 0):
        total = -total
    return total % 10


def main():
    s1, s2, a, b, c = input().split()
    if (not ((s1 == '1' or s1 == '0') and (s2 == '1' or s2 == '0'))):
        print('Error')
        return
    a = int(a)
    b = int(b)
    c = int(c)
    if (s1 == s2):
        if (s1 == 0):
            print(f1(a, b, c))
        else:
            print(f4(a, b, c))
    else:
        if (s1 == 0):
            print(f2(a, b, c))
        else:
            print(f3(a, b, c))


exec(input().strip())  # DON'T remove this line
# 1639764, 2022-09-24 09:38:49, PPPP[--][PPPP] (83%)

def f1(a, b, c):
    lst = [a, b, c]
    mn = 6e9
    for e in lst:
        if (mn > e and e > 0):
            mn = e
    return mn


def f2(a, b, c):
    return -f1(-a, -b, -c)


def f3(a, b, c):
    total = a+b+c
    if (total < 0):
        total = -total
    return int(str(total)[0])


def f4(a, b, c):
    total = a+b+c
    if (total < 0):
        total = -total
    return int(str(total)[len(str(total))-1])


def main():
    s1, s2, a, b, c = input().split()
    if (not ((s1 == '1' or s1 == '0') and (s2 == '1' or s2 == '0'))):
        print('Error')
        return
    a = int(a)
    b = int(b)
    c = int(c)
    if (s1 == s2):
        if (s1 == 0):
            print(f1(a, b, c))
        else:
            print(f4(a, b, c))
    else:
        if (s1 == 0):
            print(f2(a, b, c))
        else:
            print(f3(a, b, c))


exec(input().strip())  # DON'T remove this line

# 1639773, 2022-09-24 09:39:03, PP--[--][P-P-] (33%)

def f1(a, b, c):
    lst = [a, b, c]
    mn = 6e9
    for e in lst:
        if (mn > e and e > 0):
            mn = e
    return mn


def f2(a, b, c):
    return -f1(-a, -b, -c)


def f4(a, b, c):
    total = a+b+c
    if (total < 0):
        total = -total
    return int(str(total)[0])


def f3(a, b, c):
    total = a+b+c
    if (total < 0):
        total = -total
    return int(str(total)[len(str(total))-1])


def main():
    s1, s2, a, b, c = input().split()
    if (not ((s1 == '1' or s1 == '0') and (s2 == '1' or s2 == '0'))):
        print('Error')
        return
    a = int(a)
    b = int(b)
    c = int(c)
    if (s1 == s2):
        if (s1 == 0):
            print(f1(a, b, c))
        else:
            print(f4(a, b, c))
    else:
        if (s1 == 0):
            print(f2(a, b, c))
        else:
            print(f3(a, b, c))


exec(input().strip())  # DON'T remove this line

# 1639784, 2022-09-24 09:39:12, PPPP[--][PPPP] (83%)

def f1(a, b, c):
    lst = [a, b, c]
    mn = 6e9
    for e in lst:
        if (mn > e and e > 0):
            mn = e
    return mn


def f2(a, b, c):
    return -f1(-a, -b, -c)


def f3(a, b, c):
    total = a+b+c
    if (total < 0):
        total = -total
    return int(str(total)[0])


def f4(a, b, c):
    total = a+b+c
    if (total < 0):
        total = -total
    return int(str(total)[len(str(total))-1])


def main():
    s1, s2, a, b, c = input().split()
    if (not ((s1 == '1' or s1 == '0') and (s2 == '1' or s2 == '0'))):
        print('Error')
        return
    a = int(a)
    b = int(b)
    c = int(c)
    if (s1 == s2):
        if (s1 == 0):
            print(f1(a, b, c))
        else:
            print(f4(a, b, c))
    else:
        if (s1 == 0):
            print(f2(a, b, c))
        else:
            print(f3(a, b, c))


exec(input().strip())  # DON'T remove this line

# 1639820, 2022-09-24 09:40:25, xxPP[--][PPPP] (50%)

# def f1(a, b, c):
#     lst = [a, b, c]
#     mn = 6e9
#     for e in lst:
#         if (mn > e and e > 0):
#             mn = e
#     return mn


# def f2(a, b, c):
#     return -f1(-a, -b, -c)


def f3(a, b, c):
    total = a+b+c
    if (total < 0):
        total = -total
    return int(str(total)[0])


def f4(a, b, c):
    total = a+b+c
    if (total < 0):
        total = -total
    return int(str(total)[len(str(total))-1])


def main():
    s1, s2, a, b, c = input().split()
    if (not ((s1 == '1' or s1 == '0') and (s2 == '1' or s2 == '0'))):
        print('Error')
        return
    a = int(a)
    b = int(b)
    c = int(c)
    if (s1 == s2):
        if (s1 == 0):
            print(f1(a, b, c))
        else:
            print(f4(a, b, c))
    else:
        if (s1 == 0):
            print(f2(a, b, c))
        else:
            print(f3(a, b, c))


exec(input().strip())  # DON'T remove this line
# 1639824, 2022-09-24 09:40:32, PPPP[--][PPPP] (83%)

def f1(a, b, c):
    lst = [a, b, c]
    mn = 6e9
    for e in lst:
        if (mn > e and e > 0):
            mn = e
    return mn


def f2(a, b, c):
    return -f1(-a, -b, -c)


def f3(a, b, c):
    total = a+b+c
    if (total < 0):
        total = -total
    return int(str(total)[0])


def f4(a, b, c):
    total = a+b+c
    if (total < 0):
        total = -total
    return int(str(total)[len(str(total))-1])


def main():
    s1, s2, a, b, c = input().split()
    if (not ((s1 == '1' or s1 == '0') and (s2 == '1' or s2 == '0'))):
        print('Error')
        return
    a = int(a)
    b = int(b)
    c = int(c)
    if (s1 == s2):
        if (s1 == 0):
            print(f1(a, b, c))
        else:
            print(f4(a, b, c))
    else:
        if (s1 == 0):
            print(f2(a, b, c))
        else:
            print(f3(a, b, c))


exec(input().strip())  # DON'T remove this line
# 1639914, 2022-09-24 09:42:49, PPPP[--][PPPP] (83%)

def f1(a, b, c):
    lst = [a, b, c]
    mn = 6e9
    for e in lst:
        if (mn > e and e > 0):
            mn = e
    return mn


def f2(a, b, c):
    return -f1(-a, -b, -c)


def f3(a, b, c):
    total = 0
    total += a+b+c
    if (total < 0):
        total = -1*total
    return int(str(total)[0])


def f4(a, b, c):
    total = 0
    total += a+b+c
    if (total < 0):
        total = -1*total
    return int(str(total)[len(str(total))-1])


def main():
    s1, s2, a, b, c = input().split()
    if (not ((s1 == '1' or s1 == '0') and (s2 == '1' or s2 == '0'))):
        print('Error')
        return
    a = int(a)
    b = int(b)
    c = int(c)
    if (s1 == s2):
        if (s1 == 0):
            print(f1(a, b, c))
        else:
            print(f4(a, b, c))
    else:
        if (s1 == 0):
            print(f2(a, b, c))
        else:
            print(f3(a, b, c))


exec(input().strip())  # DON'T remove this line

# 1640241, 2022-09-24 09:51:54, xxPP[xx][xxxx] (33%)

# def f1(a, b, c):
#     lst = [a, b, c]
#     mn = 6e9
#     for e in lst:
#         if (mn > e and e > 0):
#             mn = e
#     return mn


# def f2(a, b, c):
#     return -f1(-a, -b, -c)


def f3(a, b, c):
    total = 0
    total += a+b+c
    if (total < 0):
        total = -1*total
    return int(str(total)[0])


def f4(a, b, c):
    total = 0
    total += a+b+c
    if (total < 0):
        total = -1*total
    return int(str(total)[len(str(total))-1])


# def main():
#     s1, s2, a, b, c = input().split()
#     if (not ((s1 == '1' or s1 == '0') and (s2 == '1' or s2 == '0'))):
#         print('Error')
#         return
#     a = int(a)
#     b = int(b)
#     c = int(c)
#     if (s1 == s2):
#         if (s1 == 0):
#             print(f1(a, b, c))
#         else:
#             print(f4(a, b, c))
#     else:
#         if (s1 == 0):
#             print(f2(a, b, c))
#         else:
#             print(f3(a, b, c))


exec(input().strip())  # DON'T remove this line
# 1640251, 2022-09-24 09:52:07, xxPP[--][PPPP] (50%)

# def f1(a, b, c):
#     lst = [a, b, c]
#     mn = 6e9
#     for e in lst:
#         if (mn > e and e > 0):
#             mn = e
#     return mn


# def f2(a, b, c):
#     return -f1(-a, -b, -c)


def f3(a, b, c):
    total = 0
    total += a+b+c
    if (total < 0):
        total = -1*total
    return int(str(total)[0])


def f4(a, b, c):
    total = 0
    total += a+b+c
    if (total < 0):
        total = -1*total
    return int(str(total)[len(str(total))-1])


def main():
    s1, s2, a, b, c = input().split()
    if (not ((s1 == '1' or s1 == '0') and (s2 == '1' or s2 == '0'))):
        print('Error')
        return
    a = int(a)
    b = int(b)
    c = int(c)
    if (s1 == s2):
        if (s1 == 0):
            print(f1(a, b, c))
        else:
            print(f4(a, b, c))
    else:
        if (s1 == 0):
            print(f2(a, b, c))
        else:
            print(f3(a, b, c))


exec(input().strip())  # DON'T remove this line
# 1640259, 2022-09-24 09:52:21, PPPP[--][P-P-] (67%)

def f1(a, b, c):
    lst = [a, b, c]
    mn = 6e9
    for e in lst:
        if (mn > e and e > 0):
            mn = e
    return mn


def f2(a, b, c):
    return -f1(-a, -b, -c)


def f3(a, b, c):
    total = 0
    total += a+b+c
    if (total < 0):
        total = -1*total
    return int(str(total)[0])


def f4(a, b, c):
    total = 0
    total += a+b+c
    if (total < 0):
        total = -1*total
    return int(str(total)[len(str(total))-1])


def main():
    s1, s2, a, b, c = input().split()
    # if (not ((s1 == '1' or s1 == '0') and (s2 == '1' or s2 == '0'))):
    print('Error')
    #     return
    # a = int(a)
    # b = int(b)
    # c = int(c)
    # if (s1 == s2):
    #     if (s1 == 0):
    #         print(f1(a, b, c))
    #     else:
    #         print(f4(a, b, c))
    # else:
    #     if (s1 == 0):
    #         print(f2(a, b, c))
    #     else:
    #         print(f3(a, b, c))


exec(input().strip())  # DON'T remove this line
# 1640293, 2022-09-24 09:53:26, PPPP[xx][xxxx] (67%)

def f1(a, b, c):
    lst = [a, b, c]
    mn = 6e9
    for e in lst:
        if (mn > e and e > 0):
            mn = e
    return mn


def f2(a, b, c):
    return -f1(-a, -b, -c)


def f3(a, b, c):
    total = 0
    total += a+b+c
    if (total < 0):
        total = -1*total
    return int(str(total)[0])


def f4(a, b, c):
    total = 0
    total += a+b+c
    if (total < 0):
        total = -1*total
    return int(str(total)[len(str(total))-1])


# def main():
#     s1, s2, a, b, c = input().split()
#     if (not ((s1 == '1' or s1 == '0') and (s2 == '1' or s2 == '0'))):
#         print('Error')
#         return
#     a = int(a)
#     b = int(b)
#     c = int(c)
#     if (s1 == s2):
#         if (s1 == 0):
#             print(f1(a, b, c))
#         else:
#             print(f4(a, b, c))
#     else:
#         if (s1 == 0):
#             print(f2(a, b, c))
#         else:
#             print(f3(a, b, c))


exec(input().strip())  # DON'T remove this line

# 1640307, 2022-09-24 09:53:49, PPPP[--][-P-P] (67%)

def f1(a, b, c):
    lst = [a, b, c]
    mn = 6e9
    for e in lst:
        if (mn > e and e > 0):
            mn = e
    return mn


def f2(a, b, c):
    return -f1(-a, -b, -c)


def f3(a, b, c):
    total = 0
    total += a+b+c
    if (total < 0):
        total = -1*total
    return int(str(total)[0])


def f4(a, b, c):
    total = 0
    total += a+b+c
    if (total < 0):
        total = -1*total
    return int(str(total)[len(str(total))-1])


def main():
    s1, s2, a, b, c = input().split()
    # if (not ((s1 == '1' or s1 == '0') and (s2 == '1' or s2 == '0'))):
    #     print('Error')
    #     return
    a = int(a)
    b = int(b)
    c = int(c)
    if (s1 == s2):
        if (s1 == 0):
            print(f1(a, b, c))
        else:
            print(f4(a, b, c))
    else:
        if (s1 == 0):
            print(f2(a, b, c))
        else:
            print(f3(a, b, c))


exec(input().strip())  # DON'T remove this line
# 1640355, 2022-09-24 09:55:31, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    lst = [a, b, c]
    mn = 6e9
    for e in lst:
        if (mn > e and e > 0):
            mn = e
    return mn


def f2(a, b, c):
    return -f1(-a, -b, -c)


def f3(a, b, c):
    total = 0
    total += a+b+c
    if (total < 0):
        total = -1*total
    return int(str(total)[0])


def f4(a, b, c):
    total = 0
    total += a+b+c
    if (total < 0):
        total = -1*total
    return int(str(total)[len(str(total))-1])


def main():
    s1, s2, a, b, c = input().split()
    if (not ((s1 == '1' or s1 == '0') and (s2 == '1' or s2 == '0'))):
        print('Error')
        return
    a = int(a)
    b = int(b)
    c = int(c)
    if (s1 == '0' and s2 == '0'):
        print(f1(a, b, c))
    elif (s1 == '0' and s2 == '1'):
        print(f2(a, b, c))
    elif (s1 == '1' and s2 == '0'):
        print(f3(a, b, c))
    elif (s1 == '1' and s2 == '1'):
        print(f4(a, b, c))


exec(input().strip())  # DON'T remove this line


6431507621
# 1638952, 2022-09-24 09:18:49, -xxx[xx][xxxx] (0%)

def f1(a,b,c):
    x = [a,b,c]
    x.sort()
    return(x[1])

exec(input().strip())
# 1639009, 2022-09-24 09:20:08, ----[--][----] (0%)

def f1(a,b,c):
    x = [a,b,c]
    x.sort()
    return(x[1])

# 1639126, 2022-09-24 09:22:43, -xxx[xx][xxxx] (0%)

def f1(a,b,c):
    x = [a,b,c]
    x.sort()
    return(int(x[1]))
exec(input().strip())
# 1639195, 2022-09-24 09:24:19, -xxx[xx][xxxx] (0%)

def f1(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    x = [a,b,c]
    x.sort()
    return(x[1])

exec(input().strip())
# 1639560, 2022-09-24 09:33:27, -xPx[xx][xxxx] (17%)

def f1(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    x = [a,b,c]
    x.sort()
    return(x[1])


def f3(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    n = a+b+c
    n = str(n)
    if n[0] == '-':
        n = n[1::]
    u = int(n[0])
    return(u)


exec(input().strip())
# 1639646, 2022-09-24 09:35:37, -xPx[xx][xxxx] (17%)

def f1(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    x = [a,b,c]
    x.sort()
    y = int(x[1])
    return(y)


def f3(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    n = a+b+c
    n = str(n)
    if n[0] == '-':
        n = n[1::]
    u = int(n[0])
    return(u)


exec(input().strip())
# 1639733, 2022-09-24 09:38:01, -xPP[xx][xxxx] (33%)

def f1(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    x = [a,b,c]
    x.sort()
    y = int(x[1])
    return(y)


def f3(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    n = a+b+c
    n = str(n)
    if n[0] == '-':
        n = n[1::]
    u = int(n[0])
    return(u)
def f4(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    n = a+b+c
    n = str(n)
    u = int(n[-1])
    return(u)


exec(input().strip())
# 1639977, 2022-09-24 09:44:30, -xPP[xx][xxxx] (33%)

def f1(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    x = [a,b,c]
    x.sort()
    for e in x:
        if e == 0:
            x.remove(0)
    return(int(x[1]))

def f3(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    n = a+b+c
    n = str(n)
    if n[0] == '-':
        n = n[1::]
    u = int(n[0])
    return(u)
def f4(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    n = a+b+c
    n = str(n)
    u = int(n[-1])
    return(u)


exec(input().strip())
# 1640227, 2022-09-24 09:51:30, xxPP[xx][xxxx] (33%)

def f1(a,b,c):
    d = []
    a = int(a)
    b = int(b)
    c = int(c)
    x = [a,b,c]
    for e in x:
        if c >= 0:
            d.append(c)
    return(min(d))
def f3(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    n = a+b+c
    n = str(n)
    if n[0] == '-':
        n = n[1::]
    u = int(n[0])
    return(u)
def f4(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    n = a+b+c
    n = str(n)
    u = int(n[-1])
    return(u)


exec(input().strip())
# 1640260, 2022-09-24 09:52:21, xxPP[xx][xxxx] (33%)

def f1(a,b,c):
    d = []
    a = int(a)
    b = int(b)
    c = int(c)
    x = [a,b,c]
    for e in x:
        if c >= 0:
            d.append(c)
    return(int(min(d)))
def f3(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    n = a+b+c
    n = str(n)
    if n[0] == '-':
        n = n[1::]
    u = int(n[0])
    return(u)
def f4(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    n = a+b+c
    n = str(n)
    u = int(n[-1])
    return(u)


exec(input().strip())
# 1640424, 2022-09-24 09:57:26, -xPP[xx][xxxx] (33%)

def f1(a,b,c):
    d = []
    a = int(a)
    b = int(b)
    c = int(c)
    x = [a,b,c]
    for e in x:
        if e >= 0:
            d.append(e)
    return(int(min(d)))
def f3(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    n = a+b+c
    n = str(n)
    if n[0] == '-':
        n = n[1::]
    u = int(n[0])
    return(u)
def f4(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    n = a+b+c
    n = str(n)
    u = int(n[-1])
    return(u)


exec(input().strip())
# 1640608, 2022-09-24 10:02:24, -xPP[xx][xxxx] (33%)

def f1(a,b,c):
    d = []
    a = int(a)
    b = int(b)
    c = int(c)
    x = [a,b,c]
    for e in x:
        if e >= 0:
            d.append(e)
    y = min(d)
    return(y)

def f3(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    n = a+b+c
    n = str(n)
    if n[0] == '-':
        n = n[1::]
    u = int(n[0])
    return(u)
def f4(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    n = a+b+c
    n = str(n)
    u = int(n[-1])
    return(u)


exec(input().strip())
# 1640755, 2022-09-24 10:06:15, -xPP[xx][xxxx] (33%)

def f1(a,b,c):
    d = []
    a = int(a)
    b = int(b)
    c = int(c)
    x = [a,b,c]
    for e in x:
        if e >= 0:
            d.append(e)
            y = min(d)
            return(y)

def f3(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    n = a+b+c
    n = str(n)
    if n[0] == '-':
        n = n[1::]
    u = int(n[0])
    return(u)
def f4(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    n = a+b+c
    n = str(n)
    u = int(n[-1])
    return(u)


exec(input().strip())
# 1640815, 2022-09-24 10:07:47, -PPP[xx][xxxx] (50%)

def f1(a,b,c):
    d = []
    a = int(a)
    b = int(b)
    c = int(c)
    x = [a,b,c]
    for e in x:
        if e >= 0:
            d.append(e)
            y = min(d)
            return(y)

def f3(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    n = a+b+c
    n = str(n)
    if n[0] == '-':
        n = n[1::]
    u = int(n[0])
    return(u)
    
def f2(a,b,c):
    d = []
    a = int(a)
    b = int(b)
    c = int(c)
    x = [a,b,c]
    for i in range(len(x)):
        if x[i] < 0:
            d.append(x[i])
            
    return(max(d))
            
    
def f4(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    n = a+b+c
    n = str(n)
    u = int(n[-1])
    return(u)


exec(input().strip())
# 1640849, 2022-09-24 10:08:36, -PPP[xx][xxxx] (50%)

def f1(a,b,c):
    d = []
    a = int(a)
    b = int(b)
    c = int(c)
    x = [a,b,c]
    for i in range(len(x)):
        if x[i] >= 0:
            d.append(x[i])
            
    return(min(d))
def f3(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    n = a+b+c
    n = str(n)
    if n[0] == '-':
        n = n[1::]
    u = int(n[0])
    return(u)
    
def f2(a,b,c):
    d = []
    a = int(a)
    b = int(b)
    c = int(c)
    x = [a,b,c]
    for i in range(len(x)):
        if x[i] < 0:
            d.append(x[i])
            
    return(max(d))
            
    
def f4(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    n = a+b+c
    n = str(n)
    u = int(n[-1])
    return(u)


exec(input().strip())
# 1640918, 2022-09-24 10:10:23, -PPP[xx][xxxx] (50%)

def f1(a,b,c):
    d = []
    a = int(a)
    b = int(b)
    c = int(c)
    x = [a,b,c]
    for i in range(len(x)):
        if x[i] >= 0:
            d.append(x[i])
            
    return(min(d))
def f2(a,b,c):
    d = []
    a = int(a)
    b = int(b)
    c = int(c)
    x = [a,b,c]
    for i in range(len(x)):
        if x[i] < 0:
            d.append(x[i])
            
    return(max(d))
def f3(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    n = a+b+c
    n = str(n)
    if n[0] == '-':
        n = n[1::]
    u = int(n[0])
    return(u)
    

            
    
def f4(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    n = a+b+c
    n = str(n)
    u = int(n[-1])
    return(u)


exec(input().strip())
# 1641329, 2022-09-24 10:20:01, -PPP[PP][PPPP] (83%)

def f1(a,b,c):
    d = []
    a = int(a)
    b = int(b)
    c = int(c)
    x = [a,b,c]
    for i in range(len(x)):
        if x[i] >= 0:
            d.append(x[i])
            
    return(min(d))
def f2(a,b,c):
    d = []
    a = int(a)
    b = int(b)
    c = int(c)
    x = [a,b,c]
    for i in range(len(x)):
        if x[i] < 0:
            d.append(x[i])
            
    return(max(d))
def f3(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    n = a+b+c
    n = str(n)
    if n[0] == '-':
        n = n[1::]
    u = int(n[0])
    return(u)
    

            
    
def f4(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    n = a+b+c
    n = str(n)
    u = int(n[-1])
    return(u)
def main():
    x = input().split()
    s1 = int(x[0])
    s2 = int(x[1])
    a = int(x[2])
    b = int(x[3])
    c = int(x[4])
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")


exec(input().strip())
# 1641416, 2022-09-24 10:21:51, compilation error (0%)


            
    return(min(d))
def f2(a,b,c):
    d = []
    a = int(a)
    b = int(b)
    c = int(c)
    x = [a,b,c]
    for i in range(len(x)):
        if x[i] < 0:
            d.append(x[i])
            
    return(max(d))
def f3(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    n = a+b+c
    n = str(n)
    if n[0] == '-':
        n = n[1::]
    u = int(n[0])
    return(u)
    

            
    
def f4(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    n = a+b+c
    n = str(n)
    u = int(n[-1])
    return(u)
def main():
    x = input().split()
    s1 = int(x[0])
    s2 = int(x[1])
    a = int(x[2])
    b = int(x[3])
    c = int(x[4])
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")


exec(input().strip())
# 1641450, 2022-09-24 10:22:33, -PPP[-P][PPPP] (67%)

def f1(a,b,c):
    d = []
    a = int(a)
    b = int(b)
    c = int(c)
    x = [a,b,c]
    for i in range(len(x)):
        if x[i] >= 0:
            d.append(x[i])
def f2(a,b,c):
    d = []
    a = int(a)
    b = int(b)
    c = int(c)
    x = [a,b,c]
    for i in range(len(x)):
        if x[i] < 0:
            d.append(x[i])
            
    return(max(d))
def f3(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    n = a+b+c
    n = str(n)
    if n[0] == '-':
        n = n[1::]
    u = int(n[0])
    return(u)
    

            
    
def f4(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    n = a+b+c
    n = str(n)
    u = int(n[-1])
    return(u)
def main():
    x = input().split()
    s1 = int(x[0])
    s2 = int(x[1])
    a = int(x[2])
    b = int(x[3])
    c = int(x[4])
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")


exec(input().strip())
# 1641481, 2022-09-24 10:23:21, -PPP[PP][PPPP] (83%)

def f1(a,b,c):
    d = []
    a = int(a)
    b = int(b)
    c = int(c)
    x = [a,b,c]
    for i in range(len(x)):
        if x[i] >= 0:
            d.append(x[i])
            
    return(min(d))
def f2(a,b,c):
    d = []
    a = int(a)
    b = int(b)
    c = int(c)
    x = [a,b,c]
    for i in range(len(x)):
        if x[i] < 0:
            d.append(x[i])
            
    return(max(d))
def f3(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    n = a+b+c
    n = str(n)
    if n[0] == '-':
        n = n[1::]
    u = int(n[0])
    return(u)
    

            
    
def f4(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    n = a+b+c
    n = str(n)
    u = int(n[-1])
    return(u)
def main():
    x = input().split()
    s1 = int(x[0])
    s2 = int(x[1])
    a = int(x[2])
    b = int(x[3])
    c = int(x[4])
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")


exec(input().strip())
# 1641500, 2022-09-24 10:23:39, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    d = []
    a = int(a)
    b = int(b)
    c = int(c)
    x = [a,b,c]
    for i in range(len(x)):
        if x[i] > 0:
            d.append(x[i])
            
    return(min(d))
def f2(a,b,c):
    d = []
    a = int(a)
    b = int(b)
    c = int(c)
    x = [a,b,c]
    for i in range(len(x)):
        if x[i] < 0:
            d.append(x[i])
            
    return(max(d))
def f3(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    n = a+b+c
    n = str(n)
    if n[0] == '-':
        n = n[1::]
    u = int(n[0])
    return(u)
    

            
    
def f4(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    n = a+b+c
    n = str(n)
    u = int(n[-1])
    return(u)
def main():
    x = input().split()
    s1 = int(x[0])
    s2 = int(x[1])
    a = int(x[2])
    b = int(x[3])
    c = int(x[4])
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")


exec(input().strip())

6531346021
# 1639271, 2022-09-24 09:26:02, ----[PP][PPPP] (33%)

def f1(a,b,c):
    l=[a,b,c]
    for i in l:
        if i<0:
            l.pop(l.index(i))
    return sorted(l,key=int)[0]
def f2(a,b,c):
    l=[a,b,c]
    for i in l:
        if i>0:
            l.pop(l.index(i))
    return sorted(l,key=int,reverse=True)[0]
def f3(a,b,c):
    sum=a+b+c
    return str(abs(sum))[0]

def f4(a,b,c):  
    sum=a+b+c
    return str(sum)[-1] 
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0 :
        print(f3(a,b,c))
    elif s1==1 and s2==1 :
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())
# 1639676, 2022-09-24 09:36:20, ----[PP][PPPP] (33%)

def f1(a,b,c):
    l=[a,b,c]
    l.sort(key=int)
    i=0
    while True:
      if l[i]<0:
        i+=1
      else:
        break
    return l[i]
def f2(a,b,c):
    l=[a,b,c]
    l.sort(key=int,reverse=True)
    i=0
    while True:
      if l[i]>0:
        i+=1
      else:
        break
    return l[i]
def f3(a,b,c):
    sum=a+b+c
    return str(abs(sum))[0]

def f4(a,b,c):  
    sum=a+b+c
    return str(sum)[-1] 
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0 :
        print(f3(a,b,c))
    elif s1==1 and s2==1 :
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())
# 1640802, 2022-09-24 10:07:27, ----[PP][PPPP] (33%)

def f1(a,b,c):
    l=[a,b,c]
    l.sort(key=int)
    i=0
    while True:
      if l[i]<0:
        i+=1
      else:
        break
    return int(l[i])
def f2(a,b,c):
    l=[a,b,c]
    l.sort(key=int,reverse=True)
    i=0
    while True:
      if l[i]>0:
        i+=1
      else:
        break
    return l[i]
def f3(a,b,c):
    sum=a+b+c
    return str(abs(sum))[0]

def f4(a,b,c):  
    sum=a+b+c
    return str(sum)[-1] 
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0 :
        print(f3(a,b,c))
    elif s1==1 and s2==1 :
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())
# 1640989, 2022-09-24 10:12:23, ----[PP][PPPP] (33%)

def f1(a,b,c):
    l=[a,b,c]
    l.sort(key=int)
    i=0
    while True:
      if l[i]<0:
        i+=1
      else:
        break
    return int(l[i])
def f2(a,b,c):
    l=[a,b,c]
    l.sort(key=int,reverse=True)
    i=0
    while True:
      if l[i]>0:
        i+=1
      else:
        break
    return int(l[i])
def f3(a,b,c):
    sum=a+b+c
    return str(abs(sum))[0]

def f4(a,b,c):  
    sum=a+b+c
    return str(sum)[-1] 
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0 :
        print(f3(a,b,c))
    elif s1==1 and s2==1 :
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())
# 1641151, 2022-09-24 10:16:32, ----[--][PPPP] (17%)

def f1(a,b,c):
    
    return int(a)
def f2(a,b,c):
   
    return int(a)
def f3(a,b,c):
    sum=a+b+c
    return str(abs(sum))[0]

def f4(a,b,c):  
    sum=a+b+c
    return str(sum)[-1] 
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0 :
        print(f3(a,b,c))
    elif s1==1 and s2==1 :
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())
# 1641185, 2022-09-24 10:17:17, compilation error (0%)

def f1(a,b,c):
    l=[a,b,c]
    l.sort(key=int)
    i=0
    while True:
      if l[i]<0:
        i+=1
      else:
        break
    return l[i]
def f2(a,b,c):
    l=[a,b,c]
    l.sort(key=int,reverse=True)
    i=0
    while True:
      if l[i]>0:
        i+=1
      else:
        break
    return l[i]
def f3(a,b,c):
    sum=a+b+c
    return str(abs(sum))[0]

def f4(a,b,c):  
    sum=a+b+c
    return str(sum)[-1] 
def main():
    
exec(input().strip())
# 1641197, 2022-09-24 10:17:28, ----[xx][xxxx] (0%)

def f1(a,b,c):
    l=[a,b,c]
    l.sort(key=int)
    i=0
    while True:
      if l[i]<0:
        i+=1
      else:
        break
    return l[i]
def f2(a,b,c):
    l=[a,b,c]
    l.sort(key=int,reverse=True)
    i=0
    while True:
      if l[i]>0:
        i+=1
      else:
        break
    return l[i]
def f3(a,b,c):
    sum=a+b+c
    return str(abs(sum))[0]

def f4(a,b,c):  
    sum=a+b+c
    return str(sum)[-1] 
def main():
    print(a)
exec(input().strip())
# 1641220, 2022-09-24 10:17:59, ----[PP][PPPP] (33%)

def f1(a,b,c):
    l=[a,b,c]
    l.sort(key=int)
    i=0
    while True:
      if l[i]<0:
        i+=1
      else:
        break
    return l[i]
def f2(a,b,c):
    l=[a,b,c]
    l.sort(key=int,reverse=True)
    i=0
    while True:
      if l[i]>0:
        i+=1
      else:
        break
    return l[i]
def f3(a,b,c):
    sum=a+b+c
    return str(abs(sum))[0]

def f4(a,b,c):  
    sum=a+b+c
    return str(sum)[-1] 
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0 :
        print(f3(a,b,c))
    elif s1==1 and s2==1 :
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())
# 1641369, 2022-09-24 10:20:52, x---[PP][PPPP] (33%)

def f1(a,b,c):
    #l=[a,b,c]
    if a>0:
      s=a
    if b>0 and b<a:
      s=b
    if c>0 and c<s:
      s=c
    return c
def f2(a,b,c):
    l=[a,b,c]
    l.sort(key=int,reverse=True)
    i=0
    while True:
      if l[i]>0:
        i+=1
      else:
        break
    return l[i]
def f3(a,b,c):
    sum=a+b+c
    return str(abs(sum))[0]

def f4(a,b,c):  
    sum=a+b+c
    return str(sum)[-1] 
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0 :
        print(f3(a,b,c))
    elif s1==1 and s2==1 :
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())
# 1641430, 2022-09-24 10:22:04, ----[PP][PPPP] (33%)

def f1(a,b,c):
    #l=[a,b,c]
    s=1000
    if a>0 and a<s:
      s=a
    if b>0 and b<s:
      s=b
    if c>0 and c<s:
      s=c
    return c
def f2(a,b,c):
    l=[a,b,c]
    l.sort(key=int,reverse=True)
    i=0
    while True:
      if l[i]>0:
        i+=1
      else:
        break
    return l[i]
def f3(a,b,c):
    sum=a+b+c
    return str(abs(sum))[0]

def f4(a,b,c):  
    sum=a+b+c
    return str(sum)[-1] 
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0 :
        print(f3(a,b,c))
    elif s1==1 and s2==1 :
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())
# 1641443, 2022-09-24 10:22:21, P---[PP][PPPP] (50%)

def f1(a,b,c):
    #l=[a,b,c]
    s=1000
    if a>0 and a<s:
      s=a
    if b>0 and b<s:
      s=b
    if c>0 and c<s:
      s=c
    return s
def f2(a,b,c):
    l=[a,b,c]
    l.sort(key=int,reverse=True)
    i=0
    while True:
      if l[i]>0:
        i+=1
      else:
        break
    return l[i]
def f3(a,b,c):
    sum=a+b+c
    return str(abs(sum))[0]

def f4(a,b,c):  
    sum=a+b+c
    return str(sum)[-1] 
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0 :
        print(f3(a,b,c))
    elif s1==1 and s2==1 :
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())
# 1641489, 2022-09-24 10:23:30, PP--[PP][PPPP] (67%)

def f1(a,b,c):
    #l=[a,b,c]
    s=1000
    if a>0 and a<s:
      s=a
    if b>0 and b<s:
      s=b
    if c>0 and c<s:
      s=c
    return s
def f2(a,b,c):
    s=-1000
    if a<0 and a>s:
      s=a
    if b<0 and b>s:
      s=b
    if c<0 and c>s:
      s=c
    return s
def f3(a,b,c):
    sum=a+b+c
    return str(abs(sum))[0]

def f4(a,b,c):  
    sum=a+b+c
    return str(sum)[-1] 
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0 :
        print(f3(a,b,c))
    elif s1==1 and s2==1 :
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())
# 1641546, 2022-09-24 10:24:30, PP--[PP][PPPP] (67%)

def f1(a,b,c):
    #l=[a,b,c]
    s=1000
    if a>0 and a<s:
      s=a
    if b>0 and b<s:
      s=b
    if c>0 and c<s:
      s=c
    return s
def f2(a,b,c):
    s=-1000
    if a<0 and a>s:
      s=a
    if b<0 and b>s:
      s=b
    if c<0 and c>s:
      s=c
    return s
def f3(a,b,c):
    sum=a+b+c
    return str(abs(sum))[0]

def f4(a,b,c):  
    sum=a+b+c
    return sum%10
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0 :
        print(f3(a,b,c))
    elif s1==1 and s2==1 :
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())
# 1641599, 2022-09-24 10:25:29, PP-P[PP][PPPP] (83%)

def f1(a,b,c):
    #l=[a,b,c]
    s=1000
    if a>0 and a<s:
      s=a
    if b>0 and b<s:
      s=b
    if c>0 and c<s:
      s=c
    return s
def f2(a,b,c):
    s=-1000
    if a<0 and a>s:
      s=a
    if b<0 and b>s:
      s=b
    if c<0 and c>s:
      s=c
    return s
def f3(a,b,c):
    sum=a+b+c
    return str(abs(sum))[0]

def f4(a,b,c):  
    sum=a+b+c
    return abs(sum)%10
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0 :
        print(f3(a,b,c))
    elif s1==1 and s2==1 :
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())
# 1641773, 2022-09-24 10:28:42, PPxP[PP][PxPx] (67%)

def f1(a,b,c):
    #l=[a,b,c]
    s=1000
    if a>0 and a<s:
      s=a
    if b>0 and b<s:
      s=b
    if c>0 and c<s:
      s=c
    return s
def f2(a,b,c):
    s=-1000
    if a<0 and a>s:
      s=a
    if b<0 and b>s:
      s=b
    if c<0 and c>s:
      s=c
    return s
def f3(a,b,c):
    sum=a+b+c
    s=str(sum)
    return sum[0]

def f4(a,b,c):  
    sum=a+b+c
    return abs(sum)%10
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0 :
        print(f3(a,b,c))
    elif s1==1 and s2==1 :
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())
# 1641790, 2022-09-24 10:29:01, PP-P[PP][PPP-] (67%)

def f1(a,b,c):
    #l=[a,b,c]
    s=1000
    if a>0 and a<s:
      s=a
    if b>0 and b<s:
      s=b
    if c>0 and c<s:
      s=c
    return s
def f2(a,b,c):
    s=-1000
    if a<0 and a>s:
      s=a
    if b<0 and b>s:
      s=b
    if c<0 and c>s:
      s=c
    return s
def f3(a,b,c):
    sum=a+b+c
    s=str(sum)
    return s[0]

def f4(a,b,c):  
    sum=a+b+c
    return abs(sum)%10
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0 :
        print(f3(a,b,c))
    elif s1==1 and s2==1 :
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())
# 1641820, 2022-09-24 10:29:32, PP-P[PP][PPPP] (83%)

def f1(a,b,c):
    #l=[a,b,c]
    s=1000
    if a>0 and a<s:
      s=a
    if b>0 and b<s:
      s=b
    if c>0 and c<s:
      s=c
    return s
def f2(a,b,c):
    s=-1000
    if a<0 and a>s:
      s=a
    if b<0 and b>s:
      s=b
    if c<0 and c>s:
      s=c
    return s
def f3(a,b,c):
    sum=a+b+c
    sum=abs(sum)
    s=str(sum)
    return s[0]

def f4(a,b,c):  
    sum=a+b+c
    return abs(sum)%10
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0 :
        print(f3(a,b,c))
    elif s1==1 and s2==1 :
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())
# 1641983, 2022-09-24 10:32:22, PP-P[PP][PPP-] (67%)

def f1(a,b,c):
    #l=[a,b,c]
    s=1000
    if a>0 and a<s:
      s=a
    if b>0 and b<s:
      s=b
    if c>0 and c<s:
      s=c
    return s
def f2(a,b,c):
    s=-1000
    if a<0 and a>s:
      s=a
    if b<0 and b>s:
      s=b
    if c<0 and c>s:
      s=c
    return s
def f3(a,b,c):
    sum=a+b+c
    i=0
    while True:
      if 10**i>sum:
          break
      i+=1
    return round(sum/10**(i-1))

def f4(a,b,c):  
    sum=a+b+c
    return abs(sum)%10
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0 :
        print(f3(a,b,c))
    elif s1==1 and s2==1 :
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())
# 1642083, 2022-09-24 10:34:11, PP-P[PP][PPP-] (67%)

def f1(a,b,c):
    #l=[a,b,c]
    s=1000
    if a>0 and a<s:
      s=a
    if b>0 and b<s:
      s=b
    if c>0 and c<s:
      s=c
    return s
def f2(a,b,c):
    s=-1000
    if a<0 and a>s:
      s=a
    if b<0 and b>s:
      s=b
    if c<0 and c>s:
      s=c
    return s
def f3(a,b,c):
    sum=a+b+c
    i=0
    while True:
      if 10**i>sum:
          break
      i+=1
    return sum//10**(i-1)

def f4(a,b,c):  
    sum=a+b+c
    return abs(sum)%10
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0 :
        print(f3(a,b,c))
    elif s1==1 and s2==1 :
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())
# 1642128, 2022-09-24 10:34:44, PP-P[PP][PPP-] (67%)

def f1(a,b,c):
    #l=[a,b,c]
    s=1000
    if a>0 and a<s:
      s=a
    if b>0 and b<s:
      s=b
    if c>0 and c<s:
      s=c
    return s
def f2(a,b,c):
    s=-1000
    if a<0 and a>s:
      s=a
    if b<0 and b>s:
      s=b
    if c<0 and c>s:
      s=c
    return s
def f3(a,b,c):
    sum=a+b+c
    i=0
    while True:
      if 10**i>sum:
          break
      i+=1
    return round(sum//10**(i-1))

def f4(a,b,c):  
    sum=a+b+c
    return abs(sum)%10
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0 :
        print(f3(a,b,c))
    elif s1==1 and s2==1 :
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())
# 1642142, 2022-09-24 10:34:59, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    #l=[a,b,c]
    s=1000
    if a>0 and a<s:
      s=a
    if b>0 and b<s:
      s=b
    if c>0 and c<s:
      s=c
    return s
def f2(a,b,c):
    s=-1000
    if a<0 and a>s:
      s=a
    if b<0 and b>s:
      s=b
    if c<0 and c>s:
      s=c
    return s
def f3(a,b,c):
    sum=a+b+c
    sum=abs(sum)
    i=0
    while True:
      if 10**i>sum:
          break
      i+=1
    return round(sum//10**(i-1))

def f4(a,b,c):  
    sum=a+b+c
    return abs(sum)%10
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0 :
        print(f3(a,b,c))
    elif s1==1 and s2==1 :
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())

6431007121
# 1639654, 2022-09-24 09:35:49, --xx[xx][xxxx] (0%)

def f1(a, b, c):

    x=[a,b,c]    
    for i in range(3):
        x[i]=int(x[i])
    for e in x:
        if e <0:
            x.remove(e)
    return min(x)
def f2(a, b, c):

    x=[a,b,c]
    d=[]
    for i in range(3):
        d.append(int(x[i]))
    for e in d:
        if e>0:
            d.remove(e)
    return max(d)
exec(input().strip())
# 1639682, 2022-09-24 09:36:33, --xx[xx][xxxx] (0%)

def f1(a, b, c):
    x=[a,b,c]    
    for i in range(3):
        x[i]=int(x[i])
    for e in x:
        if e <0:
            x.remove(e)
    return min(x)
def f2(a, b, c):

    x=[a,b,c]
    d=[]
    for i in range(3):
        d.append(int(x[i]))
    for e in d:
        if e>0:
            d.remove(e)
    return max(d)
exec(input().strip())
# 1639700, 2022-09-24 09:37:02, --xx[xx][xxxx] (0%)

def f1(a, b, c):
    x=[a,b,c]    
    for i in range(3):
        x[i]=int(x[i])
    for e in x:
        if e <0:
            x.remove(e)
    return min(x)
def f2(a, b, c):

    x=[a,b,c]
    d=[]
    for i in range(3):
        d.append(int(x[i]))
    for e in x:
        if e>0:
            d.remove(e)
    return max(d)
exec(input().strip())
# 1639739, 2022-09-24 09:38:14, --xx[xx][xxxx] (0%)

def f1(a, b, c):
    x=[a,b,c]    
    for i in range(3):
        x[i]=int(x[i])
    for e in x:
        if e <0:
            x.remove(e)
    return min(x)
def f2(a, b, c):

    x=[a,b,c]
    d=[]
    for i in range(3):
        d.append(int(x[i]))
    for e in x:
        if e>0:
            x.remove(e)
    return max(x)
exec(input().strip())
# 1639999, 2022-09-24 09:45:19, ---x[xx][xxxx] (0%)

def f1(a, b, c):
    x=[a,b,c]    
    for i in range(3):
        x[i]=int(x[i])
    for e in x:
        if e <0:
            x.remove(e)
    return min(x)
def f2(a, b, c):

    x=[a,b,c]
    d=[]
    for i in range(3):
        d.append(int(x[i]))
    for e in x:
        if e>0:
            x.remove(e)
    return max(x)
def f3(a, b, c):

    summ=a+b+c
    summ=str(summ)
    if summ[0]=='-':
        return summ[1]
exec(input().strip())
# 1640042, 2022-09-24 09:46:35, compilation error (0%)

def f1(a, b, c):
    x=[a,b,c]    
    for i in range(3):
        x[i]=int(x[i])
    for e in x:
        if e <0:
            x.remove(e)
    return min(x)
def f2(a, b, c):

    x=[a,b,c]
    d=[]
    for i in range(3):
        d.append(int(x[i]))
    for e in x:
        if e>0:
            x.remove(e)
    return max(x)
def f3(a, b, c):

    summ=a+b+c
    summ=str(summ)
    if summ[0]=='-':
        return summ[1]
def f4(a, b, c):
def main():
exec(input().strip())
# 1640050, 2022-09-24 09:46:50, ---x[xx][xxxx] (0%)

def f1(a, b, c):
    x=[a,b,c]    
    for i in range(3):
        x[i]=int(x[i])
    for e in x:
        if e <0:
            x.remove(e)
    return min(x)
def f2(a, b, c):

    x=[a,b,c]
    d=[]
    for i in range(3):
        d.append(int(x[i]))
    for e in x:
        if e>0:
            x.remove(e)
    return max(x)
def f3(a, b, c):

    summ=a+b+c
    summ=str(summ)
    if summ[0]=='-':
        return summ[1]

exec(input().strip())
# 1640203, 2022-09-24 09:50:56, x--x[xx][xxxx] (0%)

def f1(a, b, c):

    x=[a,b,c]
    for i in range(len(x)):
        if x[i]<0:
            x.remove(x[i])
    return min(x)
def f2(a, b, c):

    x=[a,b,c]
    d=[]
    for i in range(3):
        d.append(int(x[i]))
    for e in x:
        if e>0:
            x.remove(e)
    return max(x)
def f3(a, b, c):

    summ=a+b+c
    summ=str(summ)
    if summ[0]=='-':
        return summ[1]

exec(input().strip())
# 1640214, 2022-09-24 09:51:16, x--x[xx][xxxx] (0%)

def f1(a, b, c):
    x=[a,b,c]
    for i in range(len(x)):
        if x[i]<0:
            x.remove(x[i])
    return min(x)
def f2(a, b, c):

    x=[a,b,c]
    d=[]
    for i in range(3):
        d.append(int(x[i]))
    for e in x:
        if e>0:
            x.remove(e)
    return max(x)
def f3(a, b, c):

    summ=a+b+c
    summ=str(summ)
    if summ[0]=='-':
        return summ[1]

exec(input().strip())
# 1640360, 2022-09-24 09:55:35, ---x[xx][xxxx] (0%)

def f1(a, b, c):
    x=[a,b,c]
    if a<0:
        x.remove(a)
    elif b<0:
        x.remove(b)
    elif c<0:
        x.remove(c)
    return min(x)
def f2(a, b, c):

    x=[a,b,c]
    d=[]
    for i in range(3):
        d.append(int(x[i]))
    for e in x:
        if e>0:
            x.remove(e)
    return max(x)
def f3(a, b, c):

    summ=a+b+c
    summ=str(summ)
    if summ[0]=='-':
        return summ[1]

exec(input().strip())
# 1640566, 2022-09-24 10:01:08, ---x[xx][xxxx] (0%)

def f1(a, b, c):

    x=[]
    if a>0:
        x.append(a)
    elif b>0:
        x.append(b)
    elif c>0:
        x.append(c)
    x.sort()
    if len(x)==2 or len(x)==1:
        return min(x)
def f2(a, b, c):

    x=[a,b,c]
    d=[]
    for i in range(3):
        d.append(int(x[i]))
    for e in x:
        if e>0:
            x.remove(e)
    return max(x)
def f3(a, b, c):

    summ=a+b+c
    summ=str(summ)
    if summ[0]=='-':
        return summ[1]

exec(input().strip())
# 1640641, 2022-09-24 10:03:19, ----[xx][xxxx] (0%)

def f1(a, b, c):

    x=[]
    if a>0:
        x.append(a)
    elif b>0:
        x.append(b)
    elif c>0:
        x.append(c)
    x.sort()
    if len(x)==2 or len(x)==1:
        return min(x)
def f2(a, b, c):
    x=[a,b,c]
    d=[]
    for i in range(3):
        d.append(int(x[i]))
    for e in x:
        if e>0:
            x.remove(e)
    return max(x)
def f3(a, b, c):

    summ=a+b+c
    summ=str(summ)
    if summ[0]=='-':
        return summ[1]
def f4(a, b, c):
    summ=a+b+c
    summ=str(summ)
    return summ[-1]

exec(input().strip())
# 1641136, 2022-09-24 10:16:10, ----[xx][xxxx] (0%)

def f1(a, b, c):

    x=[]
    if a>0:
        x.append(a)
    elif b>0:
        x.append(b)
    elif c>0:
        x.append(c)
    x.sort()
    if len(x)==2 or len(x)==1:
        return int(min(x))
def f2(a, b, c):
    x=[a,b,c]
    d=[]
    for i in range(3):
        d.append(int(x[i]))
    for e in x:
        if e>0:
            x.remove(e)
    return max(x)
def f3(a, b, c):

    summ=a+b+c
    summ=str(summ)
    if summ[0]=='-':
        return summ[1]
def f4(a, b, c):
    summ=a+b+c
    summ=str(summ)
    return summ[-1]

exec(input().strip())
# 1641196, 2022-09-24 10:17:28, ----[xx][xxxx] (0%)

def f1(a, b, c):
    x=[]
    if a>0:
        x.append(a)
    elif b>0:
        x.append(b)
    elif c>0:
        x.append(c)
    x.sort()
    if len(x)==2 or len(x)==1:
        return int(min(x))
def f2(a, b, c):
    x=[a,b,c]
    d=[]
    for i in range(3):
        d.append(int(x[i]))
    for e in x:
        if e>0:
            x.remove(e)
    return max(x)
def f3(a, b, c):

    summ=a+b+c
    summ=str(summ)
    if summ[0]=='-':
        return summ[1]
def f4(a, b, c):
    summ=a+b+c
    summ=str(summ)
    return summ[-1]

exec(input().strip()) # DON'T remove this line
# 1641217, 2022-09-24 10:17:56, P---[xx][xxxx] (17%)

def f1(a, b, c):
    x=[]
    if a>0:
        x.append(a)
    if b>0:
        x.append(b)
    if c>0:
        x.append(c)
    x.sort()
    if len(x)==2 or len(x)==1:
        return int(min(x))
def f2(a, b, c):
    x=[a,b,c]
    d=[]
    for i in range(3):
        d.append(int(x[i]))
    for e in x:
        if e>0:
            x.remove(e)
    return max(x)
def f3(a, b, c):

    summ=a+b+c
    summ=str(summ)
    if summ[0]=='-':
        return summ[1]
def f4(a, b, c):
    summ=a+b+c
    summ=str(summ)
    return summ[-1]

exec(input().strip()) # DON'T remove this line
# 1641254, 2022-09-24 10:18:41, PP--[xx][xxxx] (33%)

def f1(a, b, c):
    x=[]
    if a>0:
        x.append(a)
    if b>0:
        x.append(b)
    if c>0:
        x.append(c)
    x.sort()
    if len(x)==2 or len(x)==1:
        return int(min(x))
def f2(a, b, c):

    x=[]
    if a<0:
        x.append(a)
    if b<0:
        x.append(b)
    if c<0:
        x.append(c)
    x.sort()
    if len(x)==2 or len(x)==1:
        return int(max(x))
def f3(a, b, c):

    summ=a+b+c
    summ=str(summ)
    if summ[0]=='-':
        return summ[1]
def f4(a, b, c):
    summ=a+b+c
    summ=str(summ)
    return summ[-1]

exec(input().strip()) # DON'T remove this line
# 1641315, 2022-09-24 10:19:46, PPPP[xx][xxxx] (67%)

def f1(a, b, c):
    x=[]
    if a>0:
        x.append(a)
    if b>0:
        x.append(b)
    if c>0:
        x.append(c)
    x.sort()
    if len(x)==2 or len(x)==1:
        return int(min(x))
def f2(a, b, c):

    x=[]
    if a<0:
        x.append(a)
    if b<0:
        x.append(b)
    if c<0:
        x.append(c)
    x.sort()
    if len(x)==2 or len(x)==1:
        return int(max(x))
def f3(a, b, c):

    summ=a+b+c
    summ=str(summ)
    if summ[0]=='-':
        return summ[1]
    return int(summ[0])
def f4(a, b, c):
    summ=a+b+c
    summ=str(summ)
    return int(summ[-1])

exec(input().strip()) # DON'T remove this line
# 1641738, 2022-09-24 10:28:01, PPPP[PP][-PPP] (83%)

def f1(a, b, c):
    x=[]
    if a>0:
        x.append(a)
    if b>0:
        x.append(b)
    if c>0:
        x.append(c)
    x.sort()
    if len(x)==2 or len(x)==1:
        return int(min(x))
def f2(a, b, c):

    x=[]
    if a<0:
        x.append(a)
    if b<0:
        x.append(b)
    if c<0:
        x.append(c)
    x.sort()
    if len(x)==2 or len(x)==1:
        return int(max(x))
def f3(a, b, c):

    summ=a+b+c
    summ=str(summ)
    if summ[0]=='-':
        return summ[1]
    return int(summ[0])
def f4(a, b, c):
    summ=a+b+c
    summ=str(summ)
    return int(summ[-1])
def main():

    x=input().split()
    s1=int(x[0])
    s2=int(x[1])
    a=int(x[2])
    b=int(x[3])
    c=int(x[4])
    if s1==0 and s2==0:
        return print(f1(a,b,c)
)
    if s1==0 and s2==1:
        return print(f2(a,b,c)
)
    if s1==1 and s2==0:
        return print(f3(a,b,c)
)
    if s1==1 and s2==1:
        return print(f4(a,b,c)
)
    if s1!=0 and s2!=1 and s1!='0'and s1!=1:
        return print('Error')
exec(input().strip()) # DON'T remove this line
# 1641828, 2022-09-24 10:29:41, PPPP[PP][-PPP] (83%)

def f1(a, b, c):
    x=[]
    if a>0:
        x.append(a)
    if b>0:
        x.append(b)
    if c>0:
        x.append(c)
    x.sort()
    if len(x)==2 or len(x)==1:
        return int(min(x))
def f2(a, b, c):

    x=[]
    if a<0:
        x.append(a)
    if b<0:
        x.append(b)
    if c<0:
        x.append(c)
    x.sort()
    if len(x)==2 or len(x)==1:
        return int(max(x))
def f3(a, b, c):

    summ=a+b+c
    summ=str(summ)
    if summ[0]=='-':
        return summ[1]
    return int(summ[0])
def f4(a, b, c):
    summ=a+b+c
    summ=str(summ)
    return int(summ[-1])
def main():

    x=input().split()
    s1=int(x[0])
    s2=int(x[1])
    a=int(x[2])
    b=int(x[3])
    c=int(x[4])
    if s1==0 and s2==0:
        return print(f1(a,b,c)
)
    if s1==0 and s2==1:
        return print(f2(a,b,c)
)
    if s1==1 and s2==0:
        return print(f3(a,b,c)
)
    if s1==1 and s2==1:
        return print(f4(a,b,c)
)
    if s1!=0 and s2!=1 and s1!=0 and s1!=1:
        return print('Error')
exec(input().strip()) # DON'T remove this line
# 1641930, 2022-09-24 10:31:12, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    x=[]
    if a>0:
        x.append(a)
    if b>0:
        x.append(b)
    if c>0:
        x.append(c)
    x.sort()
    if len(x)==2 or len(x)==1:
        return int(min(x))
def f2(a, b, c):

    x=[]
    if a<0:
        x.append(a)
    if b<0:
        x.append(b)
    if c<0:
        x.append(c)
    x.sort()
    if len(x)==2 or len(x)==1:
        return int(max(x))
def f3(a, b, c):

    summ=a+b+c
    summ=str(summ)
    if summ[0]=='-':
        return summ[1]
    return int(summ[0])
def f4(a, b, c):
    summ=a+b+c
    summ=str(summ)
    return int(summ[-1])
def main():

    x=input().split()
    s1=int(x[0])
    s2=int(x[1])
    a=int(x[2])
    b=int(x[3])
    c=int(x[4])
    if s1==0 and s2==0:
        return print(f1(a,b,c)
)
    if s1==0 and s2==1:
        return print(f2(a,b,c)
)
    if s1==1 and s2==0:
        return print(f3(a,b,c)
)
    if s1==1 and s2==1:
        return print(f4(a,b,c)
)
    if s1!=0 or s2!=1 and s1!=0 or s2!=1:
        return print('Error')
exec(input().strip()) # DON'T remove this line

6531514021
# 1639477, 2022-09-24 09:31:25, ----[--][P-P-] (0%)

# print(f1(1,2,3))
def f1(a,b,c) :
    x1 = [a,b,c]
    i = 0
    for i in range(len(x1)) :
        if x1[i] <= 0 :
            x1.remove(x1[i])
            i += 1
            break
    s1 = min(x1)
    return(s1)
def f2(a,b,c) :
    x2 = [a,b,c]
    i = 0
    for i in range(len(x2)) :
        if x2[i] >= 0 :
            x2.remove(x2[i])
            i += 1
            break
    s2 = max(x2)
    return(s2)
def f3(a,b,c) :
    x = a + b +c
    n = str(x)
    if x < 0 :
        return(n[1])
    else :
        return(n[0])
def f4(a,b,c) :
    x = a + b +c
    n = str(x)
    return(n[-1])
def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        return(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        return(f2(a,b,c))
    if s1 == 1 and s2 == 1 :
        return(f3(a,b,c))
    if s1 == 0 and s2 == 0 :
        return(f4(a,b,c))
    else :
        print('Error')
exec(input())

# 1639525, 2022-09-24 09:32:27, ----[--][P-P-] (0%)

# print(f1(1,2,3))
def f1(a,b,c) :
    x1 = [a,b,c]
    i = 0
    for i in range(len(x1)) :
        if x1[i] <= 0 :
            x1.remove(x1[i])
            i += 1
            break
    s1 = min(x1)
    return(s1)
def f2(a,b,c) :
    x2 = [a,b,c]
    i = 0
    for i in range(len(x2)) :
        if x2[i] >= 0 :
            x2.remove(x2[i])
            i += 1
            break
    s2 = max(x2)
    return(s2)
def f3(a,b,c) :
    x = a + b +c
    n = str(x)
    if x < 0 :
        return(n[1])
    else :
        return(n[0])
def f4(a,b,c) :
    x = a + b +c
    n = str(x)
    return(n[-1])
def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        return(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        return(f2(a,b,c))
    if s1 == 1 and s2 == 1 :
        return(f3(a,b,c))
    if s1 == 0 and s2 == 0 :
        return(f4(a,b,c))
    else :
        print('Error')
exec(input().strip())

# 1639548, 2022-09-24 09:33:05, ----[--][P-P-] (0%)

def f1(a,b,c) :
    x1 = [a,b,c]
    i = 0
    for i in range(len(x1)) :
        if x1[i] <= 0 :
            x1.remove(x1[i])
            i += 1
            break
    s1 = min(x1)
    return(s1)
def f2(a,b,c) :
    x2 = [a,b,c]
    i = 0
    for i in range(len(x2)) :
        if x2[i] >= 0 :
            x2.remove(x2[i])
            i += 1
            break
    s2 = max(x2)
    return(s2)
def f3(a,b,c) :
    x = a + b +c
    n = str(x)
    if x < 0 :
        return(n[1])
    else :
        return(n[0])
def f4(a,b,c) :
    x = a + b +c
    n = str(x)
    return(n[-1])
def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        return(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        return(f2(a,b,c))
    if s1 == 1 and s2 == 1 :
        return(f3(a,b,c))
    if s1 == 0 and s2 == 0 :
        return(f4(a,b,c))
    else :
        print('Error')
exec(input().strip())
# 1639636, 2022-09-24 09:35:16, --PP[--][P-P-] (33%)

# print(f1(1,2,3))
def f1(a,b,c) :
    x1 = [a,b,c]
    i = 0
    for i in range(len(x1)) :
        if x1[i] <= 0 :
            x1.remove(x1[i])
            i += 1
            break
    s1 = min(x1)
    return(s1)
def f2(a,b,c) :
    x2 = [a,b,c]
    i = 0
    for i in range(len(x2)) :
        if x2[i] >= 0 :
            x2.remove(x2[i])
            i += 1
            break
    s2 = max(x2)
    return(s2)
def f3(a,b,c) :
    x = a + b +c
    n = str(x)
    if x < 0 :
        return(int(n[1]))
    else :
        return(int(n[0]))
def f4(a,b,c) :
    x = a + b +c
    n = str(x)
    return(int(n[-1]))
def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        return(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        return(f2(a,b,c))
    if s1 == 1 and s2 == 1 :
        return(f3(a,b,c))
    if s1 == 0 and s2 == 0 :
        return(f4(a,b,c))
    else :
        print('Error')
exec(input().strip())

# 1639696, 2022-09-24 09:36:58, xxPP[x-][P-P-] (33%)

# print(f1(1,2,3))
def f1(a,b,c) :
    x1 = [a,b,c]
    i = 0
    for i in range(len(x1)) :
        if x1[i] <= 0 :
            x1.remove(x1[i])
            i += 1
    s1 = min(x1)
    print(type(s1))
    return(s1)
def f2(a,b,c) :
    x2 = [a,b,c]
    i = 0
    for i in range(len(x2)) :
        if x2[i] >= 0 :
            x2.remove(x2[i])
            i += 1
    s2 = max(x2)
    return(s2)
def f3(a,b,c) :
    x = a + b +c
    n = str(x)
    if x < 0 :
        return(int(n[1]))
    else :
        return(int(n[0]))
def f4(a,b,c) :
    x = a + b +c
    n = str(x)
    return(int(n[-1]))
def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        return(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        return(f2(a,b,c))
    if s1 == 1 and s2 == 1 :
        return(f3(a,b,c))
    if s1 == 0 and s2 == 0 :
        return(f4(a,b,c))
    else :
        print('Error')
exec(input().strip())

# 1639749, 2022-09-24 09:38:33, xxPP[x-][P-P-] (33%)

# print(f1(1,2,3))
def f1(a,b,c) :
    x1 = [a,b,c]
    for i in range(len(x1)) :
        if x1[i] <= 0 :
            x1.remove(x1[i])
    s1 = min(x1)
    return(s1)
def f2(a,b,c) :
    x2 = [a,b,c]
    for i in range(len(x2)) :
        if x2[i] >= 0 :
            x2.remove(x2[i])
    s2 = max(x2)
    return(s2)
def f3(a,b,c) :
    x = a + b +c
    n = str(x)
    if x < 0 :
        return(int(n[1]))
    else :
        return(int(n[0]))
def f4(a,b,c) :
    x = a + b +c
    n = str(x)
    return(int(n[-1]))
def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        return(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        return(f2(a,b,c))
    if s1 == 1 and s2 == 1 :
        return(f3(a,b,c))
    if s1 == 0 and s2 == 0 :
        return(f4(a,b,c))
    else :
        print('Error')
exec(input().strip())

# 1639763, 2022-09-24 09:38:47, xxPP[x-][P-P-] (33%)

def f1(a,b,c) :
    x1 = [a,b,c]
    for i in range(len(x1)) :
        if x1[i] <= 0 :
            x1.remove(x1[i])
    s1 = min(x1)
    return(s1)
def f2(a,b,c) :
    x2 = [a,b,c]
    for i in range(len(x2)) :
        if x2[i] >= 0 :
            x2.remove(x2[i])
    s2 = max(x2)
    return(s2)
def f3(a,b,c) :
    x = a + b +c
    n = str(x)
    if x < 0 :
        return(int(n[1]))
    else :
        return(int(n[0]))
def f4(a,b,c) :
    x = a + b +c
    n = str(x)
    return(int(n[-1]))
def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        return(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        return(f2(a,b,c))
    if s1 == 1 and s2 == 1 :
        return(f3(a,b,c))
    if s1 == 0 and s2 == 0 :
        return(f4(a,b,c))
    else :
        print('Error')
exec(input().strip())
# 1639888, 2022-09-24 09:41:53, PPPP[--][P-P-] (67%)

def f1(a,b,c) :
    x1 = [a,b,c]
    y1 = []
    for i in range(len(x1)) :
        if x1[i] > 0 :
            y1 += [x1[i]]
    s1 = min(y1)
    return(s1)
def f2(a,b,c) :
    x2 = [a,b,c]
    y2 = []
    for i in range(len(x2)) :
        if x2[i] < 0 :
            y2 += [x2[i]]
    s2 = max(y2)
    return(s2)
def f3(a,b,c) :
    x = a + b +c
    n = str(x)
    if x < 0 :
        return(int(n[1]))
    else :
        return(int(n[0]))
def f4(a,b,c) :
    x = a + b +c
    n = str(x)
    return(int(n[-1]))
def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        return(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        return(f2(a,b,c))
    if s1 == 1 and s2 == 1 :
        return(f3(a,b,c))
    if s1 == 0 and s2 == 0 :
        return(f4(a,b,c))
    else :
        print('Error')
exec(input().strip())

# 1639921, 2022-09-24 09:43:02, -PPP[--][P-P-] (50%)

# print(f1(1,2,3))
def f1(a,b,c) :
    x1 = [a,b,c]
    y1 = []
    for i in range(len(x1)) :
        if x1[i] > 0 :
            y1 += [x1[i]]
    s1 = 5
    return(s1)
def f2(a,b,c) :
    x2 = [a,b,c]
    y2 = []
    for i in range(len(x2)) :
        if x2[i] < 0 :
            y2 += [x2[i]]
    s2 = max(y2)
    return(s2)
def f3(a,b,c) :
    x = a + b +c
    n = str(x)
    if x < 0 :
        return(int(n[1]))
    else :
        return(int(n[0]))
def f4(a,b,c) :
    x = a + b +c
    n = str(x)
    return(int(n[-1]))
def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        return(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        return(f2(a,b,c))
    if s1 == 1 and s2 == 1 :
        return(f3(a,b,c))
    if s1 == 0 and s2 == 0 :
        return(f4(a,b,c))
    else :
        print('Error')
exec(input().strip())

# 1639931, 2022-09-24 09:43:24, P-PP[--][P-P-] (50%)

# print(f1(1,2,3))
def f1(a,b,c) :
    x1 = [a,b,c]
    y1 = []
    for i in range(len(x1)) :
        if x1[i] > 0 :
            y1 += [x1[i]]
    s1 = min(y1)
    return(s1)
def f2(a,b,c) :
    x2 = [a,b,c]
    y2 = []
    for i in range(len(x2)) :
        if x2[i] < 0 :
            y2 += [x2[i]]
    s2 = 5
    return(s2)
def f3(a,b,c) :
    x = a + b +c
    n = str(x)
    if x < 0 :
        return(int(n[1]))
    else :
        return(int(n[0]))
def f4(a,b,c) :
    x = a + b +c
    n = str(x)
    return(int(n[-1]))
def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        return(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        return(f2(a,b,c))
    if s1 == 1 and s2 == 1 :
        return(f3(a,b,c))
    if s1 == 0 and s2 == 0 :
        return(f4(a,b,c))
    else :
        print('Error')
exec(input().strip())

# 1639960, 2022-09-24 09:44:08, PPPP[--][P-P-] (67%)

# print(f1(1,2,3))
def f1(a,b,c) :
    x1 = [a,b,c]
    y1 = []
    for i in range(len(x1)) :
        if x1[i] > 0 :
            y1 += [x1[i]]
    s1 = min(y1)
    return(s1)
def f2(a,b,c) :
    x2 = [a,b,c]
    y2 = []
    for i in range(len(x2)) :
        if x2[i] < 0 :
            y2 += [x2[i]]
    s2 = max(y2)
    return(s2)
def f3(a,b,c) :
    x = a + b +c
    n = str(x)
    if x < 0 :
        return(int(n[1]))
    else :
        return(int(n[0]))
def f4(a,b,c) :
    x = a + b +c
    n = str(x)
    return(int(n[-1]))
def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        return(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        return(f2(a,b,c))
    if s1 == 1 and s2 == 1 :
        return(f3(a,b,c))
    if s1 == 0 and s2 == 0 :
        return(f4(a,b,c))
    else :
        print('Error')
exec(input().strip())

# 1641102, 2022-09-24 10:15:23, PPPP[--][PxPx] (67%)

# print(f1(1,2,3))
def f1(a,b,c) :
    x1 = [a,b,c]
    y1 = []
    for i in range(len(x1)) :
        if x1[i] > 0 :
            y1 += [x1[i]]
    s1 = min(y1)
    return(s1)

def f2(a,b,c) :
    x2 = [a,b,c]
    y2 = []
    for i in range(len(x2)) :
        if x2[i] < 0 :
            y2 += [x2[i]]
    s2 = max(y2)
    return(s2)

def f3(a,b,c) :
    x = a + b +c
    n = str(x)
    if x < 0 :
        return(int(n[1]))
    else :
        return(int(n[0]))
    
def f4(a,b,c) :
    x = a + b +c
    n = str(x)
    return(int(n[-1]))

def main() :
    A,B,a,b,c = [int(e) for e in input().split()]
    x = [a,b,c]
    y = []
    s = 0
    if A == 0 and B == 0 : 
        for i in range(len(x)) :
            if x[i] > 0 :
                y += [x[i]]
        s = min(y)
        print(s)
    if A == 0 and B == 1 :
        for i in range(len(x)) :
            if x[i] < 0 :
                y += [x[i]]
        s = max(y)
        print(s)
    if A == 1 and B == 0 :
        r = a + b +c
        n = str(r)
        if x < 0 :
            print(int(n[1]))
        else :
            print(int(n[0]))
    if A == 1 and B == 1 :
        r = a + b +c
        n = str(r)
        print(int(n[-1]))
    else :
        print('Error')
exec(input().strip())


# 1641117, 2022-09-24 10:15:46, PPPP[--][PxPx] (67%)

def f1(a,b,c) :
    x1 = [a,b,c]
    y1 = []
    for i in range(len(x1)) :
        if x1[i] > 0 :
            y1 += [x1[i]]
    s1 = min(y1)
    return(s1)

def f2(a,b,c) :
    x2 = [a,b,c]
    y2 = []
    for i in range(len(x2)) :
        if x2[i] < 0 :
            y2 += [x2[i]]
    s2 = max(y2)
    return(s2)

def f3(a,b,c) :
    x = a + b +c
    n = str(x)
    if x < 0 :
        return(int(n[1]))
    else :
        return(int(n[0]))
    
def f4(a,b,c) :
    x = a + b +c
    n = str(x)
    return(int(n[-1]))

def main() :
    A,B,a,b,c = [int(e) for e in input().split()]
    x = [a,b,c]
    y = []
    s = 0
    if A == 0 and B == 0 : 
        for i in range(len(x)) :
            if x[i] > 0 :
                y += [x[i]]
        s = min(y)
        print(s)
    if A == 0 and B == 1 :
        for i in range(len(x)) :
            if x[i] < 0 :
                y += [x[i]]
        s = max(y)
        print(s)
    if A == 1 and B == 0 :
        r = a + b +c
        n = str(r)
        if x < 0 :
            print(int(n[1]))
        else :
            print(int(n[0]))
    if A == 1 and B == 1 :
        r = a + b +c
        n = str(r)
        print(int(n[-1]))
    else :
        print('Error')
exec(input().strip())
# 1641172, 2022-09-24 10:17:01, PPPP[--][P-P-] (67%)

# 0 0 1 -1 2
# def main() :
#     A,B,a,b,c = [int(e) for e in input().split()]
#     x = [a,b,c]
#     y = []
#     s = 0
#     if A == 0 and B == 0 : 
#         for i in range(len(x)) :
#             if x[i] > 0 :
#                 y += [x[i]]
#         s = min(y)
#         print(s)
# exec(input().strip())

# print(f1(1,2,3))
def f1(a,b,c) :
    x1 = [a,b,c]
    y1 = []
    for i in range(len(x1)) :
        if x1[i] > 0 :
            y1 += [x1[i]]
    s1 = min(y1)
    return(s1)

def f2(a,b,c) :
    x2 = [a,b,c]
    y2 = []
    for i in range(len(x2)) :
        if x2[i] < 0 :
            y2 += [x2[i]]
    s2 = max(y2)
    return(s2)

def f3(a,b,c) :
    x = a + b +c
    n = str(x)
    if x < 0 :
        return(int(n[1]))
    else :
        return(int(n[0]))
    
def f4(a,b,c) :
    x = a + b +c
    n = str(x)
    return(int(n[-1]))

def main() :
    A,B,a,b,c = [int(e) for e in input().split()]
    x = [a,b,c]
    y = []
    s = 0
    if A == 0 and B == 0 : 
        print(f1(a,b,c))
    if A == 0 and B == 1 :
        print(f2(a,b,c))
    if A == 1 and B == 0 :
        print(f3(a,b,c))
    if A == 1 and B == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
exec(input().strip())


# 1641187, 2022-09-24 10:17:18, PPPP[--][P-P-] (67%)

def f1(a,b,c) :
    x1 = [a,b,c]
    y1 = []
    for i in range(len(x1)) :
        if x1[i] > 0 :
            y1 += [x1[i]]
    s1 = min(y1)
    return(s1)

def f2(a,b,c) :
    x2 = [a,b,c]
    y2 = []
    for i in range(len(x2)) :
        if x2[i] < 0 :
            y2 += [x2[i]]
    s2 = max(y2)
    return(s2)

def f3(a,b,c) :
    x = a + b +c
    n = str(x)
    if x < 0 :
        return(int(n[1]))
    else :
        return(int(n[0]))
    
def f4(a,b,c) :
    x = a + b +c
    n = str(x)
    return(int(n[-1]))

def main() :
    A,B,a,b,c = [int(e) for e in input().split()]
    x = [a,b,c]
    y = []
    s = 0
    if A == 0 and B == 0 : 
        print(f1(a,b,c))
    if A == 0 and B == 1 :
        print(f2(a,b,c))
    if A == 1 and B == 0 :
        print(f3(a,b,c))
    if A == 1 and B == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
exec(input().strip())
# 1641280, 2022-09-24 10:19:09, PPPP[--][P-P-] (67%)

def f1(a,b,c) :
    x1 = [a,b,c]
    y1 = []
    for i in range(len(x1)) :
        if x1[i] > 0 :
            y1 += [x1[i]]
    s1 = min(y1)
    return(s1)

def f2(a,b,c) :
    x2 = [a,b,c]
    y2 = []
    for i in range(len(x2)) :
        if x2[i] < 0 :
            y2 += [x2[i]]
    s2 = max(y2)
    return(s2)

def f3(a,b,c) :
    x = a + b +c
    n = str(x)
    if x < 0 :
        return(int(n[1]))
    else :
        return(int(n[0]))
    
def f4(a,b,c) :
    x = a + b +c
    n = str(x)
    return(int(n[-1]))

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 : 
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
exec(input().strip())

# 1641293, 2022-09-24 10:19:22, PPPP[xx][xxxx] (67%)

def f1(a,b,c) :
    x1 = [a,b,c]
    y1 = []
    for i in range(len(x1)) :
        if x1[i] > 0 :
            y1 += [x1[i]]
    s1 = min(y1)
    return(s1)

def f2(a,b,c) :
    x2 = [a,b,c]
    y2 = []
    for i in range(len(x2)) :
        if x2[i] < 0 :
            y2 += [x2[i]]
    s2 = max(y2)
    return(s2)

def f3(a,b,c) :
    x = a + b +c
    n = str(x)
    if x < 0 :
        return(int(n[1]))
    else :
        return(int(n[0]))
    
def f4(a,b,c) :
    x = a + b +c
    n = str(x)
    return(int(n[-1]))

exec(input().strip())
# 1641359, 2022-09-24 10:20:39, PPPP[PP][-P-P] (83%)

def f1(a,b,c) :
    x1 = [a,b,c]
    y1 = []
    for i in range(len(x1)) :
        if x1[i] > 0 :
            y1 += [x1[i]]
    s1 = min(y1)
    return(s1)

def f2(a,b,c) :
    x2 = [a,b,c]
    y2 = []
    for i in range(len(x2)) :
        if x2[i] < 0 :
            y2 += [x2[i]]
    s2 = max(y2)
    return(s2)

def f3(a,b,c) :
    x = a + b +c
    n = str(x)
    if x < 0 :
        return(int(n[1]))
    else :
        return(int(n[0]))
    
def f4(a,b,c) :
    x = a + b +c
    n = str(x)
    return(int(n[-1]))

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 : 
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
exec(input().strip())
# 1641412, 2022-09-24 10:21:48, PPPP[--][P-P-] (67%)

def f1(a,b,c) :
    x1 = [a,b,c]
    y1 = []
    for i in range(len(x1)) :
        if x1[i] > 0 :
            y1 += [x1[i]]
    s1 = min(y1)
    return(s1)

def f2(a,b,c) :
    x2 = [a,b,c]
    y2 = []
    for i in range(len(x2)) :
        if x2[i] < 0 :
            y2 += [x2[i]]
    s2 = max(y2)
    return(s2)

def f3(a,b,c) :
    x = a + b +c
    n = str(x)
    if x < 0 :
        return(int(n[1]))
    else :
        return(int(n[0]))
    
def f4(a,b,c) :
    x = a + b +c
    n = str(x)
    return(int(n[-1]))

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 : 
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
exec(input().strip())
# 1641577, 2022-09-24 10:24:55, PPPP[PP][PPPP] (100%)

def f1(a,b,c) :
    x1 = [a,b,c]
    y1 = []
    for i in range(len(x1)) :
        if x1[i] > 0 :
            y1 += [x1[i]]
    s1 = min(y1)
    return(s1)

def f2(a,b,c) :
    x2 = [a,b,c]
    y2 = []
    for i in range(len(x2)) :
        if x2[i] < 0 :
            y2 += [x2[i]]
    s2 = max(y2)
    return(s2)

def f3(a,b,c) :
    x = a + b +c
    n = str(x)
    if x < 0 :
        return(int(n[1]))
    else :
        return(int(n[0]))
    
def f4(a,b,c) :
    x = a + b +c
    n = str(x)
    return(int(n[-1]))

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 : 
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
exec(input().strip())


6530101321
# 1639737, 2022-09-24 09:38:11, ----[PP][PPPP] (33%)

def f1(a, b, c) :
    mn = a
    if b < mn and b > 0 :
        mn = b
    elif c < mn and c > 0 :
        mn = c
    return mn

def f2(a, b, c) :
    mx = a
    if b > mx and  b < 0 :
        mx = b
    elif c > mx and c < 0 :
        mx = c
    return mx

def f3(a, b, c) :
    total = str(abs(a + b + c))
    result = total[0]
    return result

def f4(a, b, c) :
    total = str(abs(a + b + c))
    result = total[-1]
    return result

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print("Error")

exec(input().strip()) # DON'T remove this line
# 1639878, 2022-09-24 09:41:44, ----[PP][PPPP] (33%)

def f1(a, b, c) :
    mn = a
    if b < mn and b > 0 :
        mn = b
    elif c < mn and c > 0 :
        mn = c
    return mn

def f2(a, b, c) :
    mx = a
    if b > mx and  b < 0 :
        mx = b
    elif c > mx and c < 0 :
        mx = c
    return mx

def f3(a, b, c) :
    total = str(abs(a + b + c))
    result = total[0]
    return result

def f4(a, b, c) :
    total = str(abs(a + b + c))
    result = total[-1]
    return result

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print("Error")

exec(input().strip())
# 1640228, 2022-09-24 09:51:32, ----[PP][PPPP] (33%)

def f1(a, b, c) :
    mn = a
    if b < mn and b > 0 :
        mn = b
    elif c < mn and c > 0 :
        mn = c
    return mn

def f2(a, b, c) :
    mx = a
    if b > mx and  b < 0 :
        mx = b
    elif c > mx and c < 0 :
        mx = c
    return mx

def f3(a, b, c) :
    total = str(abs(a + b + c))
    result = total[0]
    return result

def f4(a, b, c) :
    total = str(abs(a + b + c))
    result = total[-1]
    return result

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    elif s1 != "01" and s2 != "01" :
        print("Error")

exec(input().strip())
# 1640343, 2022-09-24 09:55:06, ----[PP][PPPP] (33%)

def f1(a, b, c) :
    mn = a
    if b < mn and b > 0 :
        mn = b
    elif c < mn and c > 0 :
        mn = c
    return mn

def f2(a, b, c) :
    mx = a
    if b > mx and  b < 0 :
        mx = b
    elif c > mx and c < 0 :
        mx = c
    return mx

def f3(a, b, c) :
    total = str(abs(a + b + c))
    result = total[0]
    return result

def f4(a, b, c) :
    total = str(abs(a + b + c))
    result = total[-1]
    return result

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    elif s1 != "01" and s2 != "01" :
        print("Error")

exec(input().strip())
# 1640367, 2022-09-24 09:55:54, ----[PP][PPPP] (33%)

def f1(a, b, c) :
    mn = a
    if b < mn and b > 0 :
        mn = b
    elif c < mn and c > 0 :
        mn = c
    return mn

def f2(a, b, c) :
    mx = a
    if b > mx and  b < 0 :
        mx = b
    elif c > mx and c < 0 :
        mx = c
    return mx

def f3(a, b, c) :
    total = str(abs(a + b + c))
    result = total[0]
    return result

def f4(a, b, c) :
    total = str(abs(a + b + c))
    result = total[-1]
    return result

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    elif s1 != "01" or s2 != "01" :
        print("Error")

exec(input().strip())
# 1640457, 2022-09-24 09:58:31, ----[--][P-P-] (0%)

def f1(a, b, c) :
    mn = a
    if b < mn and b > 0 :
        mn = b
    elif c < mn and c > 0 :
        mn = c
    return mn

def f2(a, b, c) :
    mx = a
    if b > mx and  b < 0 :
        mx = b
    elif c > mx and c < 0 :
        mx = c
    return mx

def f3(a, b, c) :
    total = str(abs(a + b + c))
    result = total[0]
    return result

def f4(a, b, c) :
    total = str(abs(a + b + c))
    result = total[-1]
    return result

def main() :
    s1,s2,a,b,c = [e for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    elif s1 != "01" or s2 != "01" :
        print("Error")

exec(input().strip())
# 1640469, 2022-09-24 09:58:44, ----[PP][PPPP] (33%)

def f1(a, b, c) :
    mn = a
    if b < mn and b > 0 :
        mn = b
    elif c < mn and c > 0 :
        mn = c
    return mn

def f2(a, b, c) :
    mx = a
    if b > mx and  b < 0 :
        mx = b
    elif c > mx and c < 0 :
        mx = c
    return mx

def f3(a, b, c) :
    total = str(abs(a + b + c))
    result = total[0]
    return result

def f4(a, b, c) :
    total = str(abs(a + b + c))
    result = total[-1]
    return result

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    elif s1 != "01" or s2 != "01" :
        print("Error")

exec(input().strip())
# 1640537, 2022-09-24 10:00:16, ----[PP][PPPP] (33%)

def f1(a, b, c) :
    mn = a
    if b < mn and b > 0 :
        mn = b
    elif c < mn and c > 0 :
        mn = c
    return mn

def f2(a, b, c) :
    mx = a
    if b > mx and  b < 0 :
        mx = b
    elif c > mx and c < 0 :
        mx = c
    return mx

def f3(a, b, c) :
    total = str(abs(a + b + c))
    result = total[0]
    return result

def f4(a, b, c) :
    total = str(abs(a + b + c))
    result = total[-1]
    return result

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    elif s1 != 0 or s1 != 1 or s2 != 0 or s2 != 1 :
        print("Error")

exec(input().strip())
# 1640665, 2022-09-24 10:03:56, ----[--][----] (0%)

def f1(a, b, c) :
    mn = a
    if b < mn and b > 0 :
        mn = b
    elif c < mn and c > 0 :
        mn = c
    return mn

def f2(a, b, c) :
    mx = a
    if b > mx and  b < 0 :
        mx = b
    elif c > mx and c < 0 :
        mx = c
    return mx

def f3(a, b, c) :
    total = str(abs(a + b + c))
    result = total[0]
    return result

def f4(a, b, c) :
    total = str(abs(a + b + c))
    result = total[-1]
    return result

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    else :
        print("Error")
    
    if s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    else :
        print("Error")
    
    if s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    else :
        print("Error")
    
    if s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print("Error")

exec(input().strip())
# 1640694, 2022-09-24 10:04:44, ----[PP][PPPP] (33%)

def f1(a, b, c) :
    mn = a
    if b < mn and b > 0 :
        mn = b
    elif c < mn and c > 0 :
        mn = c
    return mn

def f2(a, b, c) :
    mx = a
    if b > mx and  b < 0 :
        mx = b
    elif c > mx and c < 0 :
        mx = c
    return mx

def f3(a, b, c) :
    total = str(abs(a + b + c))
    result = total[0]
    return result

def f4(a, b, c) :
    total = str(abs(a + b + c))
    result = total[-1]
    return result

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print("Error")

exec(input().strip())
# 1640806, 2022-09-24 10:07:37, --PP[PP][PPPP] (67%)

def f1(a, b, c) :
    mn = a
    if b < mn and b > 0 :
        mn = b
    elif c < mn and c > 0 :
        mn = c
    return mn

def f2(a, b, c) :
    mx = a
    if b > mx and  b < 0 :
        mx = b
    elif c > mx and c < 0 :
        mx = c
    return mx

def f3(a, b, c) :
    total = str(abs(a + b + c))
    result = int(total[0])
    return result

def f4(a, b, c) :
    total = str(abs(a + b + c))
    result = int(total[-1])
    return result

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print("Error")

exec(input().strip())
# 1640825, 2022-09-24 10:08:02, --PP[PP][PPPP] (67%)

def f1(a, b, c) :
    mn = a
    if b < mn and b > 0 :
        mn = b
    elif c < mn and c > 0 :
        mn = c
    return int(mn)

def f2(a, b, c) :
    mx = a
    if b > mx and  b < 0 :
        mx = b
    elif c > mx and c < 0 :
        mx = c
    return int(mx)

def f3(a, b, c) :
    total = str(abs(a + b + c))
    result = int(total[0])
    return result

def f4(a, b, c) :
    total = str(abs(a + b + c))
    result = int(total[-1])
    return result

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print("Error")

exec(input().strip())
# 1640867, 2022-09-24 10:08:57, --PP[PP][PPPP] (67%)

def f1(a, b, c) :
    mn = int(a)
    if b < mn and b > 0 :
        mn = int(b)
    elif c < mn and c > 0 :
        mn = int(c)
    return mn

def f2(a, b, c) :
    mx = int(a)
    if b > mx and  b < 0 :
        mx = int(b)
    elif c > mx and c < 0 :
        mx = int(c)
    return mx

def f3(a, b, c) :
    total = str(abs(a + b + c))
    result = int(total[0])
    return result

def f4(a, b, c) :
    total = str(abs(a + b + c))
    result = int(total[-1])
    return result

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print("Error")

exec(input().strip())
# 1641161, 2022-09-24 10:16:46, P-PP[PP][PPPP] (83%)

def f1(a, b, c) :
    if a > 0 :
        mn = a
    elif b > 0 :
        mn = b
    elif c > 0 :
        mn = c

    if a < mn and a > 0 :
        mn = int(a)
    elif b < mn and b > 0 :
        mn = int(b)
    elif c < mn and c > 0 :
        mn = int(c)
    return mn

def f2(a, b, c) :
    mx = int(a)
    if b > mx and  b < 0 :
        mx = int(b)
    elif c > mx and c < 0 :
        mx = int(c)
    return mx

def f3(a, b, c) :
    total = str(abs(a + b + c))
    result = int(total[0])
    return result

def f4(a, b, c) :
    total = str(abs(a + b + c))
    result = int(total[-1])
    return result

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print("Error")

exec(input().strip())
# 1641247, 2022-09-24 10:18:30, P-PP[PP][PPPP] (83%)

def f1(a, b, c) :
    if a > 0 :
        mn = a
    elif b > 0 :
        mn = b
    elif c > 0 :
        mn = c

    if a < mn and a > 0 :
        mn = a
    elif b < mn and b > 0 :
        mn = b
    elif c < mn and c > 0 :
        mn = c
    return mn

def f2(a, b, c) :
    if a < 0 :
        mx = a
    elif b < 0 :
        mx = b
    elif c < 0 :
        mx = c
        
    if a > mx and b < 0 :
        mx = a
    if b > mx and  b < 0 :
        mx = b
    elif c > mx and c < 0 :
        mx = c
    return mx

def f3(a, b, c) :
    total = str(abs(a + b + c))
    result = int(total[0])
    return result

def f4(a, b, c) :
    total = str(abs(a + b + c))
    result = int(total[-1])
    return result

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print("Error")

exec(input().strip())
# 1641378, 2022-09-24 10:21:00, P-PP[PP][PPPP] (83%)

def f1(a, b, c) :
    if a > 0 :
        mn = a
    elif b > 0 :
        mn = b
    elif c > 0 :
        mn = c

    if a < mn and a > 0 :
        mn = a
    elif b < mn and b > 0 :
        mn = b
    elif c < mn and c > 0 :
        mn = c
    return mn

def f2(a, b, c) :
    if a < 0 :
        mx = a
    elif b < 0 :
        mx = b
    elif c < 0 :
        mx = c
        
    if a > mx and b < 0 :
        mx = a
    elif b > mx and  b < 0 :
        mx = b
    elif c > mx and c < 0 :
        mx = c
    return mx

def f3(a, b, c) :
    total = str(abs(a + b + c))
    result = int(total[0])
    return result

def f4(a, b, c) :
    total = str(abs(a + b + c))
    result = int(total[-1])
    return result

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print("Error")

exec(input().strip())
# 1641400, 2022-09-24 10:21:24, P-PP[PP][PPPP] (83%)

def f1(a, b, c) :
    if a > 0 :
        mn = a
    elif b > 0 :
        mn = b
    elif c > 0 :
        mn = c

    if a < mn and a > 0 :
        mn = a
    elif b < mn and b > 0 :
        mn = b
    elif c < mn and c > 0 :
        mn = c
    return mn

def f2(a, b, c) :
    if a < 0 :
        mx = a
    elif b < 0 :
        mx = b
    elif c < 0 :
        mx = c
        
    if a > mx and b < 0 :
        mx = a
    if b > mx and  b < 0 :
        mx = b
    elif c > mx and c < 0 :
        mx = c
    return mx

def f3(a, b, c) :
    total = str(abs(a + b + c))
    result = int(total[0])
    return result

def f4(a, b, c) :
    total = str(abs(a + b + c))
    result = int(total[-1])
    return result

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print("Error")

exec(input().strip())
# 1641519, 2022-09-24 10:24:03, P-PP[PP][PPPP] (83%)

def f1(a, b, c) :
    if a > 0 :
        mn = a
    elif b > 0 :
        mn = b
    elif c > 0 :
        mn = c

    if a < mn and a > 0 :
        mn = a
    elif b < mn and b > 0 :
        mn = b
    elif c < mn and c > 0 :
        mn = c
    return mn

def f2(a, b, c) :
    if a < 0 :
        mx = a
    elif b < 0 :
        mx = b
    elif c < 0 :
        mx = c
        
    if a > mx and b < 0 :
        mx = a
    elif b > mx and  b < 0 :
        mx = b
    elif c > mx and c < 0 :
        mx = c
    return mx

def f3(a, b, c) :
    total = str(abs(a + b + c))
    result = int(total[0])
    return result

def f4(a, b, c) :
    total = str(abs(a + b + c))
    result = int(total[-1])
    return result

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print("Error")

exec(input().strip())
# 1642084, 2022-09-24 10:34:11, PPPP[PP][PPPP] (100%)

def f1(a, b, c) :
    if a > 0 :
        mn = a
    elif b > 0 :
        mn = b
    elif c > 0 :
        mn = c

    if a < mn and a > 0 :
        mn = a
    elif b < mn and b > 0 :
        mn = b
    elif c < mn and c > 0 :
        mn = c
    return mn

def f2(a, b, c) :
    if a < 0 :
        mx = a
    elif b < 0 :
        mx = b
    elif c < 0 :
        mx = c
        
    if a > mx and a < 0 :
        mx = a
    elif b > mx and  b < 0 :
        mx = b
    elif c > mx and c < 0 :
        mx = c
    return mx

def f3(a, b, c) :
    total = str(abs(a + b + c))
    result = int(total[0])
    return result

def f4(a, b, c) :
    total = str(abs(a + b + c))
    result = int(total[-1])
    return result

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print("Error")

exec(input().strip())

6530164921
# 1639494, 2022-09-24 09:31:39, P--P[P-][PPPP] (50%)

def f1(a, b, c):
    if a>b:
        a,b=b,a
    if b>c:
        b,c=c,b
    if a>b:
        a,b=b,a
    if a>0:
        return a
    elif b>0:
        return b
    elif c>0:
        return c
        
def f2(a, b, c):
    if a>b:
        a,b=b,a
    if b>c:
        b,c=c,b
    if a>b:
        a,b=b,a
    if c>0:
        return c
    elif b>0:
        return b
    elif a>0:
        return a
    
def f3(a, b, c):
    result = a+b+c
    s = str(result)
    if result>0:
        return int(s[0])
    elif result<0:
        return int(s[1])

def f4(a, b, c):
    result = a+b+c
    s = str(result)
    return int(s[len(s)-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
        
exec(input().strip()) # DON'T remove this line


# 1639649, 2022-09-24 09:35:43, PP-P[PP][PPPP] (83%)

def f1(a, b, c):
    result = []
    result.append(a)
    result.append(b)
    result.append(c)
    result.sort()
    
    if result[0]>0:
        return result[0]
    elif result[1]>0:
        return result[1]
    elif result[2]>0:
        return result[2]
        
def f2(a, b, c):
    result = []
    result.append(a)
    result.append(b)
    result.append(c)
    result.sort()
    
    if result[2]<0:
        return result[2]
    elif result[1]<0:
        return result[1]
    elif result[0]<0:
        return result[0]
    
def f3(a, b, c):
    result = a+b+c
    s = str(result)
    if result>0:
        return int(s[0])
    elif result<0:
        return int(s[1])

def f4(a, b, c):
    result = a+b+c
    s = str(result)
    return int(s[len(s)-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
        
exec(input().strip()) # DON'T remove this line


# 1640651, 2022-09-24 10:03:39, PP-P[PP][-P-P] (67%)

def f1(a, b, c):
    result = []
    result.append(a)
    result.append(b)
    result.append(c)
    result.sort()
    
    if result[0]>0:
        return result[0]
    elif result[1]>0:
        return result[1]
    elif result[2]>0:
        return result[2]
        
def f2(a, b, c):
    result = []
    result.append(a)
    result.append(b)
    result.append(c)
    result.sort()
    
    if result[2]<0:
        return result[2]
    elif result[1]<0:
        return result[1]
    elif result[0]<0:
        return result[0]
    
def f3(a, b, c):
    result = a+b+c
    s = str(result)
    if result>0:
        return int(s[0])
    elif result<0:
        return int(s[1])

def f4(a, b, c):
    result = a+b+c
    s = str(result)
    return int(s[len(s)-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("error")
        
exec(input().strip())
# 1640657, 2022-09-24 10:03:48, PP-P[PP][PPPP] (83%)

def f1(a, b, c):
    result = []
    result.append(a)
    result.append(b)
    result.append(c)
    result.sort()
    
    if result[0]>0:
        return result[0]
    elif result[1]>0:
        return result[1]
    elif result[2]>0:
        return result[2]
        
def f2(a, b, c):
    result = []
    result.append(a)
    result.append(b)
    result.append(c)
    result.sort()
    
    if result[2]<0:
        return result[2]
    elif result[1]<0:
        return result[1]
    elif result[0]<0:
        return result[0]
    
def f3(a, b, c):
    result = a+b+c
    s = str(result)
    if result>0:
        return int(s[0])
    elif result<0:
        return int(s[1])

def f4(a, b, c):
    result = a+b+c
    s = str(result)
    return int(s[len(s)-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
        
exec(input().strip())
# 1640910, 2022-09-24 10:10:10, P--P[PP][PPPP] (67%)

def f1(a, b, c):
    if a>b:
        a,b = b,a
    if b>c:
        b,c = c,b
    if a>b:
        a,b = a,b
    
    if a>0:
        return a
    elif b>0:
        return b
    elif c>0:
        return c
        
def f2(a, b, c):
    if a>b:
        a,b = b,a
    if b>c:
        b,c = c,b
    if a>b:
        a,b = a,b
    
    if c<0:
        return c
    elif b<0:
        return b
    elif a<0:
        return a
    
def f3(a, b, c):
    result = a+b+c
    s = str(result)
    if result>0:
        return int(s[0])
    elif result<0:
        return int(s[1])

def f4(a, b, c):
    result = a+b+c
    s = str(result)
    return int(s[len(s)-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
        
exec(input().strip()) # DON'T remove this line

# 1640934, 2022-09-24 10:10:47, PP-P[PP][PPPP] (83%)

def f1(a, b, c):
    result = []
    result.append(a)
    result.append(b)
    result.append(c)
    result.sort()
    
    if result[0]>0:
        return result[0]
    elif result[1]>0:
        return result[1]
    elif result[2]>0:
        return result[2]
        
def f2(a, b, c):
    result = []
    result.append(a)
    result.append(b)
    result.append(c)
    result.sort()
    
    if result[2]<0:
        return result[2]
    elif result[1]<0:
        return result[1]
    elif result[0]<0:
        return result[0]
    
def f3(a, b, c):
    result = a+b+c
    s = str(result)
    if result>0:
        return int(s[0])
    elif result<0:
        return int(s[1])

def f4(a, b, c):
    result = a+b+c
    s = str(result)
    return int(s[len(s)-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
        
exec(input().strip()) # DON'T remove this line


# 1640958, 2022-09-24 10:11:24, P--P[PP][PPPP] (67%)

def f1(a, b, c):
    if a>b:
        a,b = b,a
    if b>c:
        b,c = c,b
    if a>b:
        a,b = a,b
    
    if a>0:
        return a
    elif b>0:
        return b
    elif c>0:
        return c
        
def f2(a, b, c):
    if a>b:
        a,b = b,a
    if b>c:
        b,c = c,b
    if a>b:
        a,b = a,b
    
    if c<0:
        return c
    elif b<0:
        return b
    elif a<0:
        return a
    
def f3(a, b, c):
    result = a+b+c
    s = str(result)
    if result>0:
        return int(s[0])
    elif result<0:
        return int(s[1])

def f4(a, b, c):
    result = a+b+c
    s = str(result)
    return int(s[len(s)-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
        
exec(input().strip()) # DON'T remove this line

# 1640973, 2022-09-24 10:11:49, P--P[PP][PPPP] (67%)

def f1(a, b, c):
    if a>b:
        a,b = b,a
    if b>c:
        b,c = c,b
    if a>b:
        a,b = a,b
    
    if a>0:
        return a
    elif b>0:
        return b
    elif c>0:
        return c
        
def f2(a, b, c):
    if a>b:
        a,b = b,a
    if b>c:
        b,c = c,b
    if a>b:
        a,b = a,b
    
    if c<0:
        return c
    elif b<0:
        return b
    elif a<0:
        return a
    
def f3(a, b, c):
    result = a+b+c
    s = str(result)
    if result>0:
        return int(s[0])
    elif result<0:
        return int(s[1])

def f4(a, b, c):
    result = a+b+c
    s = str(result)
    return int(s[len(s)-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
        
exec(input().strip()) # DON'T remove this line

# 1640990, 2022-09-24 10:12:23, P--P[PP][PPPP] (67%)

def f1(a, b, c):
    if a>b:
        a,b = b,a
    if b>c:
        b,c = c,b
    if a>b:
        a,b = a,b
    
    if a>0:
        return a
    elif b>0:
        return b
    elif c>0:
        return c
        
def f2(a, b, c):
    if a>b:
        a,b = b,a
    if b>c:
        b,c = c,b
    if a>b:
        a,b = a,b
    
    if c<0:
        return c
    elif b<0:
        return b
    elif a<0:
        return a
    
def f3(a, b, c):
    result = a+b+c
    s = str(result)
    if result>0:
        return int(s[0])
    elif result<0:
        return int(s[1])

def f4(a, b, c):
    result = a+b+c
    s = str(result)
    return int(s[len(s)-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
        
exec(input().strip()) # DON'T remove this line

# 1641008, 2022-09-24 10:12:50, P--P[PP][PPPP] (67%)

def f1(a, b, c):
    if a>b:
        a,b = b,a
    if b>c:
        b,c = c,b
    if a>b:
        a,b = a,b
    
    if a>0:
        return a
    elif b>0:
        return b
    elif c>0:
        return c
        
def f2(a, b, c):
    if a>b:
        a,b = b,a
    if b>c:
        b,c = c,b
    if a>b:
        a,b = a,b
    
    if c<0:
        return c
    elif b<0:
        return b
    elif a<0:
        return a
    
def f3(a, b, c):
    result = a+b+c
    s = str(result)
    if result>0:
        return int(s[0])
    elif result<0:
        return int(s[1])

def f4(a, b, c):
    result = a+b+c
    s = str(result)
    return int(s[len(s)-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
        
exec(input().strip()) # DON'T remove this line

# 1641031, 2022-09-24 10:13:12, PP-P[PP][PPPP] (83%)

def f1(a, b, c):
    result = []
    result.append(a)
    result.append(b)
    result.append(c)
    result.sort()
    
    if result[0]>0:
        return result[0]
    elif result[1]>0:
        return result[1]
    elif result[2]>0:
        return result[2]
        
def f2(a, b, c):
    result = []
    result.append(a)
    result.append(b)
    result.append(c)
    result.sort()
    
    if result[2]<0:
        return result[2]
    elif result[1]<0:
        return result[1]
    elif result[0]<0:
        return result[0]
    
def f3(a, b, c):
    result = a+b+c
    s = str(result)
    if result>0:
        return int(s[0])
    elif result<0:
        return int(s[1])

def f4(a, b, c):
    result = a+b+c
    s = str(result)
    return int(s[len(s)-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
        
exec(input().strip()) # DON'T remove this line


# 1641461, 2022-09-24 10:22:44, P--P[PP][PPPP] (67%)

def f1(a, b, c):
    if a>b:
        a,b = b,a
    if b>c:
        b,c = c,b
    if a>b:
        a,b = a,b
    
    if a>0:
        return a
    elif b>0:
        return b
    elif c>0:
        return c
        
def f2(a, b, c):
    if a>b:
        a,b = b,a
    if b>c:
        b,c = c,b
    if a>b:
        a,b = a,b
    
    if c<0:
        return c
    elif b<0:
        return b
    elif a<0:
        return a
    
def f3(a, b, c):
    result = a+b+c
    s = str(result)
    if result>0:
        return int(s[0])
    elif result<0:
        return int(s[1])

def f4(a, b, c):
    result = a+b+c
    s = str(result)
    return int(s[len(s)-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
        
exec(input().strip()) # DON'T remove this line

# 1641465, 2022-09-24 10:22:55, PP-P[PP][PPPP] (83%)

def f1(a, b, c):
    result = []
    result.append(a)
    result.append(b)
    result.append(c)
    result.sort()
    
    if result[0]>0:
        return result[0]
    elif result[1]>0:
        return result[1]
    elif result[2]>0:
        return result[2]
        
def f2(a, b, c):
    result = []
    result.append(a)
    result.append(b)
    result.append(c)
    result.sort()
    
    if result[2]<0:
        return result[2]
    elif result[1]<0:
        return result[1]
    elif result[0]<0:
        return result[0]
    
def f3(a, b, c):
    result = a+b+c
    s = str(result)
    if result>0:
        return int(s[0])
    elif result<0:
        return int(s[1])

def f4(a, b, c):
    result = a+b+c
    s = str(result)
    return int(s[len(s)-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
        
exec(input().strip()) # DON'T remove this line


# 1641568, 2022-09-24 10:24:49, PP-P[PP][PPPP] (83%)

def f1(a, b, c):
    result = []
    result.append(a)
    result.append(b)
    result.append(c)
    result.sort()
    
    if result[0]>0:
        return result[0]
    elif result[1]>0:
        return result[1]
    elif result[2]>0:
        return result[2]
        
def f2(a, b, c):
    result = []
    result.append(a)
    result.append(b)
    result.append(c)
    result.sort()
    
    if result[2]<0:
        return result[2]
    elif result[1]<0:
        return result[1]
    elif result[0]<0:
        return result[0]
    
def f3(a, b, c):
    result = a+b+c
    s = str(result)
    if result>0:
        return int(s[0])
    elif result<0:
        return int(s[1])

def f4(a, b, c):
    result = a+b+c
    s = str(result)
    return int(s[len(s)-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
        
exec(input().strip()) # DON'T remove this line



# 1641631, 2022-09-24 10:26:01, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    result = []
    result.append(a)
    result.append(b)
    result.append(c)
    result.sort()
    
    if result[0]>0:
        return result[0]
    elif result[1]>0:
        return result[1]
    elif result[2]>0:
        return result[2]
        
def f2(a, b, c):
    result = []
    result.append(a)
    result.append(b)
    result.append(c)
    result.sort()
    
    if result[2]<0:
        return result[2]
    elif result[1]<0:
        return result[1]
    elif result[0]<0:
        return result[0]
    
def f3(a, b, c):
    result = a+b+c
    s = str(result)
    if result>0:
        return int(s[0])
    elif result<0:
        return int(s[1])
    elif result==0:
        return 0

def f4(a, b, c):
    result = a+b+c
    s = str(result)
    return int(s[len(s)-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
        
exec(input().strip()) # DON'T remove this line




6431105021
# 1639255, 2022-09-24 09:25:48, x---[--][----] (0%)

def f1(a, b, c):
    x = [a,b,c]
    l = []
    for i in x:
        if i > 0:
            l += i
    r = min(l)
    return l
    
    
 
def f2(a, b, c):
    pass
def f3(a, b, c):
    pass
 
def f4(a, b, c):
    pass
 
def main():
    pass
exec(input().strip())
# 1639283, 2022-09-24 09:26:14, x---[--][----] (0%)

def f1(a, b, c):
    x = [a,b,c]
    l = []
    for i in x:
        if i > 0:
            l += i
    r = min(l)
    return r
    
    
 
def f2(a, b, c):
    pass
def f3(a, b, c):
    pass
 
def f4(a, b, c):
    pass
 
def main():
    pass
exec(input().strip())
# 1639366, 2022-09-24 09:28:39, P---[--][----] (17%)

def f1(a, b, c):
    x = [a,b,c]
    l = []
    for i in x:
        if i > 0:
            l += [i]
    r = min(l)
    return r
    
    
 
def f2(a, b, c):
    pass
def f3(a, b, c):
    pass
 
def f4(a, b, c):
    pass
 
def main():
    pass
exec(input().strip())

# 1639434, 2022-09-24 09:30:23, P---[--][----] (17%)

def f1(a, b, c):
    x = [a,b,c]
    l = []
    for i in x:
        if i > 0:
            l += [i]
    r = min(l)
    return r
    
    
 
def f2(a, b, c):
    x = [a,b,c]
    l = []
    for i in x:
        if i < 0:
            l += [i]
    r = max(l)
    return print(r)
    
def f3(a, b, c):
    pass
 
def f4(a, b, c):
    pass
 
def main():
    pass
exec(input().strip())

# 1639450, 2022-09-24 09:30:39, PP--[--][----] (33%)

def f1(a, b, c):
    x = [a,b,c]
    l = []
    for i in x:
        if i > 0:
            l += [i]
    r = min(l)
    return r
    
    
 
def f2(a, b, c):
    x = [a,b,c]
    l = []
    for i in x:
        if i < 0:
            l += [i]
    r = max(l)
    return r
    
def f3(a, b, c):
    pass
 
def f4(a, b, c):
    pass
 
def main():
    pass
exec(input().strip())
# 1639677, 2022-09-24 09:36:22, P---[--][----] (17%)

def f1(a, b, c):
    x = [a,b,c]
    l = []
    for i in x:
        if i > 0:
            l += [i]
    r = min(l)
    return r
    
    
 
def f2(a, b, c):
    x = [a,b,c]
    l = []
    for i in x:
        if i < 0:
            l += [i]
    r = max(l)
    return print(r)
    
def f3(a, b, c):
    x = sum([a,b,c])
    if x < 0:
        x = x*(-1)
    y = str(x)
    r = y[0]
    return r
 
def f4(a, b, c):
    pass
 
def main():
    pass
exec(input().strip())

# 1639693, 2022-09-24 09:36:54, PP--[--][----] (33%)

def f1(a, b, c):
    x = [a,b,c]
    l = []
    for i in x:
        if i > 0:
            l += [i]
    r = min(l)
    return r
    
    
 
def f2(a, b, c):
    x = [a,b,c]
    l = []
    for i in x:
        if i < 0:
            l += [i]
    r = max(l)
    return r
    
def f3(a, b, c):
    x = sum([a,b,c])
    if x < 0:
        x = x*(-1)
    y = str(x)
    r = y[0]
    return r
 
def f4(a, b, c):
    pass
 
def main():
    pass
exec(input().strip())
# 1639724, 2022-09-24 09:37:44, ----[--][----] (0%)

def f3(a, b, c):
    x = sum([a,b,c])
    if x < 0:
        x = x*(-1)
    y = str(x)
    r = y[0]
    return r
# 1639825, 2022-09-24 09:40:33, PP--[--][----] (33%)

def f1(a, b, c):
    x = [a,b,c]
    l = []
    for i in x:
        if i > 0:
            l += [i]
    r = min(l)
    return r
    
    
 
def f2(a, b, c):
    x = [a,b,c]
    l = []
    for i in x:
        if i < 0:
            l += [i]
    r = max(l)
    return r
    
def f3(a, b, c):
    x = sum([a,b,c])
    if x < 0:
        x = x*(-1)
    y = str(x)
    r = y[0]
    return r
 
def f4(a, b, c):
    pass
 
def main():
    pass
exec(input().strip())

# 1640074, 2022-09-24 09:47:36, PPPP[--][----] (67%)

def f1(a, b, c):
    x = [a,b,c]
    l = []
    for i in x:
        if i > 0:
            l += [i]
    r = min(l)
    return r
    
    
 
def f2(a, b, c):
    x = [a,b,c]
    l = []
    for i in x:
        if i < 0:
            l += [i]
    r = max(l)
    return r
    
def f3(a, b, c):
    x = sum([a,b,c])
    if x < 0:
        x = x*(-1)
    y = str(x)
    r = y[0]
    return int(r)
 
def f4(a, b, c):
    x = sum([a,b,c])
    if x < 0:
        x = x*(-1)
    y = str(x)
    r = y[-1]
    return int(r)
    
 
def main():
    pass
exec(input().strip())

# 1640852, 2022-09-24 10:08:40, PPPP[--][----] (67%)

def f1(a, b, c):
    x = [a,b,c]
    l = []
    for i in x:
        if i > 0:
            l += [i]
    r = min(l)
    return r
    
    
 
def f2(a, b, c):
    x = [a,b,c]
    l = []
    for i in x:
        if i < 0:
            l += [i]
    r = max(l)
    return r
    
def f3(a, b, c):
    x = sum([a,b,c])
    if x < 0:
        x = x*(-1)
    y = str(x)
    r = y[0]
    return int(r)
 
def f4(a, b, c):
    x = sum([a,b,c])
    if x < 0:
        x = x*(-1)
    y = str(x)
    r = y[-1]
    return int(r)
    
 
def main():
    a = input()
    s = a.split()
    x = [int(e) for e in s]
    if (x[0] == 0) and (x[1] == 0):
        a = f1(x[2],x[3],x[4])
    elif  x[0] ==0 and x[1]==1:
        a = f2(x[2],x[3] , x[4])
    elif  x[0] ==1 and x[1]==0:
        a = f3(x[2],x[3] , x[4])
    elif  x[0] ==1 and x[1]==1:
        a = f4(x[2],x[3] , x[4])
    else:
        a='Error'
    
    return a
    
    
exec(input().strip())

# 1640879, 2022-09-24 10:09:11, PPPP[--][----] (67%)

def f1(a, b, c):
    x = [a,b,c]
    l = []
    for i in x:
        if i > 0:
            l += [i]
    r = min(l)
    return r
    
    
 
def f2(a, b, c):
    x = [a,b,c]
    l = []
    for i in x:
        if i < 0:
            l += [i]
    r = max(l)
    return r
    
def f3(a, b, c):
    x = sum([a,b,c])
    if x < 0:
        x = x*(-1)
    y = str(x)
    r = y[0]
    return int(r)
 
def f4(a, b, c):
    x = sum([a,b,c])
    if x < 0:
        x = x*(-1)
    y = str(x)
    r = y[-1]
    return int(r)
    
 
def main():
    a = input()
    s = a.split()
    x = [int(e) for e in s]
    if (x[0] == 0) and (x[1] == 0):
        a = f1(x[2],x[3],x[4])
    elif  x[0] ==0 and x[1]==1:
        a = f2(x[2],x[3] , x[4])
    elif  x[0] ==1 and x[1]==0:
        a = f3(x[2],x[3] , x[4])
    elif  x[0] ==1 and x[1]==1:
        a = f4(x[2],x[3] , x[4])
    else:
        a='Error'
    
    return a
    
    
exec(input().strip())
# 1640929, 2022-09-24 10:10:35, PPPP[--][----] (67%)

def f1(a, b, c):
    x = [a,b,c]
    l = []
    for i in x:
        if i > 0:
            l += [i]
    r = min(l)
    return r
    
    
 
def f2(a, b, c):
    x = [a,b,c]
    l = []
    for i in x:
        if i < 0:
            l += [i]
    r = max(l)
    return r
    
def f3(a, b, c):
    x = sum([a,b,c])
    if x < 0:
        x = x*(-1)
    y = str(x)
    r = y[0]
    return int(r)
 
def f4(a, b, c):
    x = sum([a,b,c])
    if x < 0:
        x = x*(-1)
    y = str(x)
    r = y[-1]
    return int(r)
    
 
def main():
    w = input()
    s = w.split()
    x = [int(e) for e in s]
    if (x[0] == 0) and (x[1] == 0):
        a = f1(x[2],x[3],x[4])
    elif  x[0] ==0 and x[1]==1:
        a = f2(x[2],x[3] , x[4])
    elif  x[0] ==1 and x[1]==0:
        a = f3(x[2],x[3] , x[4])
    elif  x[0] ==1 and x[1]==1:
        a = f4(x[2],x[3] , x[4])
    else:
        a='Error'
    
    return a
    
    
exec(input().strip())
# 1641024, 2022-09-24 10:13:06, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    x = [a,b,c]
    l = []
    for i in x:
        if i > 0:
            l += [i]
    r = min(l)
    return r
    
    
 
def f2(a, b, c):
    x = [a,b,c]
    l = []
    for i in x:
        if i < 0:
            l += [i]
    r = max(l)
    return r
    
def f3(a, b, c):
    x = sum([a,b,c])
    if x < 0:
        x = x*(-1)
    y = str(x)
    r = y[0]
    return int(r)
 
def f4(a, b, c):
    x = sum([a,b,c])
    if x < 0:
        x = x*(-1)
    y = str(x)
    r = y[-1]
    return int(r)
    
 
def main():
    w = input()
    s = w.split()
    x = [int(e) for e in s]
    if (x[0] == 0) and (x[1] == 0):
        a = f1(x[2],x[3],x[4])
    elif  x[0] ==0 and x[1]==1:
        a = f2(x[2],x[3] , x[4])
    elif  x[0] ==1 and x[1]==0:
        a = f3(x[2],x[3] , x[4])
    elif  x[0] ==1 and x[1]==1:
        a = f4(x[2],x[3] , x[4])
    else:
        a = 'Error'
    
    return print(a)
    
    
exec(input().strip())

6430328421
# 1639768, 2022-09-24 09:38:55, PP--[--][P-P-] (33%)

def f1(a, b, c):
    x=[a,b,c]
    x.sort()
    y=[]
    for e in x:
        if e>0 :
            y.append(e)
    return y[0]
def f2(a, b, c):
    x=[a,b,c]
    y=[]
    for e in x:
        if e<0 :
            y.append(e)
    y.sort()
    return y[len(y)-1]
def f3(a, b, c):
    x=a+b+c
    return
def f4(a, b, c):
    x=a+b+c
    return
def main():
    x=input().split()
    s1=int(x[0])
    s2=int(x[1])
    a=int(x[2])
    b=int(x[3])
    c=int(x[4])
    if s1==0 and s2==0 :
        print(f1(a,b,c))
    if s1==0 and s2==1 :
        print(f2(a,b,c))
    if s1==1 and s2==0 :
        print(f3(a,b,c))
    if s1==1 and s2==1 :
        print(f4(a,b,c))
    if s1 != 0 or s1 != 1 or s2 !=0 or s2 != 1 :
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1639810, 2022-09-24 09:40:03, ----[--][P-P-] (0%)

def f1(a, b, c):
    return 
def f2(a, b, c):
    return
def f3(a, b, c):
    x=a+b+c
    return
def f4(a, b, c):
    x=a+b+c
    return
def main():
    x=input().split()
    s1=int(x[0])
    s2=int(x[1])
    a=int(x[2])
    b=int(x[3])
    c=int(x[4])
    if s1==0 and s2==0 :
        print(f1(a,b,c))
    if s1==0 and s2==1 :
        print(f2(a,b,c))
    if s1==1 and s2==0 :
        print(f3(a,b,c))
    if s1==1 and s2==1 :
        print(f4(a,b,c))
    if s1 != 0 or s1 != 1 or s2 !=0 or s2 != 1 :
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1639822, 2022-09-24 09:40:27, PP--[--][P-P-] (33%)

def f1(a, b, c):
    x=[a,b,c]
    x.sort()
    y=[]
    for e in x:
        if e>0 :
            y.append(e)
    return y[0]
def f2(a, b, c):
    x=[a,b,c]
    y=[]
    for e in x:
        if e<0 :
            y.append(e)
    y.sort()
    return y[len(y)-1]
def f3(a, b, c):
    x=a+b+c
    return
def f4(a, b, c):
    x=a+b+c
    return
def main():
    x=input().split()
    s1=int(x[0])
    s2=int(x[1])
    a=int(x[2])
    b=int(x[3])
    c=int(x[4])
    if s1==0 and s2==0 :
        print(f1(a,b,c))
    if s1==0 and s2==1 :
        print(f2(a,b,c))
    if s1==1 and s2==0 :
        print(f3(a,b,c))
    if s1==1 and s2==1 :
        print(f4(a,b,c))
    if s1 != 0 or s1 != 1 or s2 !=0 or s2 != 1 :
        print('Error')
exec(input().strip()) # DON'T remove this line




# 1639839, 2022-09-24 09:40:47, P---[--][P-P-] (17%)

def f1(a, b, c):
    x=[a,b,c]
    x.sort()
    y=[]
    for e in x:
        if e>0 :
            y.append(e)
    return y[0]
def f2(a, b, c):
  
    return 
def f3(a, b, c):
    x=a+b+c
    return
def f4(a, b, c):
    x=a+b+c
    return
def main():
    x=input().split()
    s1=int(x[0])
    s2=int(x[1])
    a=int(x[2])
    b=int(x[3])
    c=int(x[4])
    if s1==0 and s2==0 :
        print(f1(a,b,c))
    if s1==0 and s2==1 :
        print(f2(a,b,c))
    if s1==1 and s2==0 :
        print(f3(a,b,c))
    if s1==1 and s2==1 :
        print(f4(a,b,c))
    if s1 != 0 or s1 != 1 or s2 !=0 or s2 != 1 :
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1639851, 2022-09-24 09:41:01, PP--[--][P-P-] (33%)

def f1(a, b, c):
    x=[a,b,c]
    x.sort()
    y=[]
    for e in x:
        if e>0 :
            y.append(e)
    return y[0]
def f2(a, b, c):
    x=[a,b,c]
    y=[]
    for e in x:
        if e<0 :
            y.append(e)
    y.sort()
    return y[len(y)-1]
def f3(a, b, c):
    x=a+b+c
    return
def f4(a, b, c):
    x=a+b+c
    return
def main():
    x=input().split()
    s1=int(x[0])
    s2=int(x[1])
    a=int(x[2])
    b=int(x[3])
    c=int(x[4])
    if s1==0 and s2==0 :
        print(f1(a,b,c))
    if s1==0 and s2==1 :
        print(f2(a,b,c))
    if s1==1 and s2==0 :
        print(f3(a,b,c))
    if s1==1 and s2==1 :
        print(f4(a,b,c))
    if s1 != 0 or s1 != 1 or s2 !=0 or s2 != 1 :
        print('Error')
exec(input().strip()) # DON'T remove this line




# 1640019, 2022-09-24 09:46:04, PPP-[--][P-P-] (50%)

def f1(a, b, c):
    x=[a,b,c]
    x.sort()
    y=[]
    for e in x:
        if e>0 :
            y.append(e)
    return y[0]
def f2(a, b, c):
    x=[a,b,c]
    y=[]
    for e in x:
        if e<0 :
            y.append(e)
    y.sort()
    return y[len(y)-1]
def f3(a, b, c):
    x=a+b+c
    if x<0 :
        x=-x
    y=str(x)
    z=y[0]
    z=int(z)
    return z
def f4(a, b, c):
    x=a+b+c
    if x<0 :
        x=-x
    return
def main():
    x=input().split()
    s1=int(x[0])
    s2=int(x[1])
    a=int(x[2])
    b=int(x[3])
    c=int(x[4])
    if s1==0 and s2==0 :
        print(f1(a,b,c))
    if s1==0 and s2==1 :
        print(f2(a,b,c))
    if s1==1 and s2==0 :
        print(f3(a,b,c))
    if s1==1 and s2==1 :
        print(f4(a,b,c))
    if s1 != 0 or s1 != 1 or s2 !=0 or s2 != 1 :
        print('Error')
exec(input().strip()) # DON'T remove this line




# 1640052, 2022-09-24 09:46:56, compilation error (0%)

def f1(a, b, c):
    x=[a,b,c]
    x.sort()
    y=[]
    for e in x:
        if e>0 :
            y.append(e)
    return y[0]
def f2(a, b, c):
    x=[a,b,c]
    y=[]
    for e in x:
        if e<0 :
            y.append(e)
    y.sort()
    return y[len(y)-1]
def f3(a, b, c):
    x=a+b+c
    if x<0 :
        x=-x
    y=str(x)
    z=y[0]
    z=int(z)
    return z
def f4(a, b, c):
    x=a+b+c
    if x<0 :
        x=-x
    y=str(x)
    z=y[len(x)-]
    z=int(z)
    return z
def main():
    x=input().split()
    s1=int(x[0])
    s2=int(x[1])
    a=int(x[2])
    b=int(x[3])
    c=int(x[4])
    if s1==0 and s2==0 :
        print(f1(a,b,c))
    if s1==0 and s2==1 :
        print(f2(a,b,c))
    if s1==1 and s2==0 :
        print(f3(a,b,c))
    if s1==1 and s2==1 :
        print(f4(a,b,c))
    if s1 != 0 or s1 != 1 or s2 !=0 or s2 != 1 :
        print('Error')
exec(input().strip()) # DON'T remove this line




# 1640068, 2022-09-24 09:47:26, PPPx[--][P-P-] (50%)

def f1(a, b, c):
    x=[a,b,c]
    x.sort()
    y=[]
    for e in x:
        if e>0 :
            y.append(e)
    return y[0]
def f2(a, b, c):
    x=[a,b,c]
    y=[]
    for e in x:
        if e<0 :
            y.append(e)
    y.sort()
    return y[len(y)-1]
def f3(a, b, c):
    x=a+b+c
    if x<0 :
        x=-x
    y=str(x)
    z=y[0]
    z=int(z)
    return z
def f4(a, b, c):
    x=a+b+c
    if x<0 :
        x=-x
    y=str(x)
    z=y[len(x)-1]
    z=int(z)
    return z
def main():
    x=input().split()
    s1=int(x[0])
    s2=int(x[1])
    a=int(x[2])
    b=int(x[3])
    c=int(x[4])
    if s1==0 and s2==0 :
        print(f1(a,b,c))
    if s1==0 and s2==1 :
        print(f2(a,b,c))
    if s1==1 and s2==0 :
        print(f3(a,b,c))
    if s1==1 and s2==1 :
        print(f4(a,b,c))
    if s1 != 0 or s1 != 1 or s2 !=0 or s2 != 1 :
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1640269, 2022-09-24 09:52:36, PPPP[--][P-P-] (67%)

def f1(a, b, c):
    x=[a,b,c]
    x.sort()
    y=[]
    for e in x:
        if e>0 :
            y.append(e)
    return y[0]
def f2(a, b, c):
    x=[a,b,c]
    y=[]
    for e in x:
        if e<0 :
            y.append(e)
    y.sort()
    return y[len(y)-1]
def f3(a, b, c):
    x=a+b+c
    if x<0 :
        x=-x
    y=str(x)
    z=y[0]
    z=int(z)
    return z
def f4(a, b, c):
    x=a+b+c
    if x<0 :
        x=-x
    y=str(x)+''
    z=y[len(y)-1]
    z=int(z)
    return z
def main():
    x=input().split()
    s1=int(x[0])
    s2=int(x[1])
    a=int(x[2])
    b=int(x[3])
    c=int(x[4])
    if s1==0 and s2==0 :
        print(f1(a,b,c))
    if s1==0 and s2==1 :
        print(f2(a,b,c))
    if s1==1 and s2==0 :
        print(f3(a,b,c))
    if s1==1 and s2==1 :
        print(f4(a,b,c))
    if s1 != 0 or s1 != 1 or s2 !=0 or s2 != 1 :
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1640419, 2022-09-24 09:57:23, PPPP[PP][-P-P] (83%)

def f1(a, b, c):
    x=[a,b,c]
    x.sort()
    y=[]
    for e in x:
        if e>0 :
            y.append(e)
    return y[0]
def f2(a, b, c):
    x=[a,b,c]
    y=[]
    for e in x:
        if e<0 :
            y.append(e)
    y.sort()
    return y[len(y)-1]
def f3(a, b, c):
    x=a+b+c
    if x<0 :
        x=-x
    y=str(x)
    z=y[0]
    z=int(z)
    return z
def f4(a, b, c):
    x=a+b+c
    if x<0 :
        x=-x
    y=str(x)+''
    z=y[len(y)-1]
    z=int(z)
    return z
def main():
    x=input().split()
    s1=int(x[0])
    s2=int(x[1])
    a=int(x[2])
    b=int(x[3])
    c=int(x[4])
    if s1==0 or s1==1 or s2==0 or s2 ==1 :
        if s1==0 and s2==0 :
            print(f1(a,b,c))
        if s1==0 and s2==1 :
            print(f2(a,b,c))
        if s1==1 and s2==0 :
            print(f3(a,b,c))
        if s1==1 and s2==1 :
            print(f4(a,b,c))
    else :
        print('Error')
exec(input().strip()) # DON'T remove this line

# 1640746, 2022-09-24 10:06:03, compilation error (0%)

def f1(a, b, c):
    x=[a,b,c]
    x.sort()
    y=[]
    for e in x:
        if e>0 :
            y.append(e)
    return y[0]
def f2(a, b, c):
    x=[a,b,c]
    y=[]
    for e in x:
        if e<0 :
            y.append(e)
    y.sort()
    return y[len(y)-1]
def f3(a, b, c):
    x=a+b+c
    if x<0 :
        x=-x
    y=str(x)
    z=y[0]
    z=int(z)
    return z
def f4(a, b, c):
    x=a+b+c
    if x<0 :
        x=-x
    y=str(x)+''
    z=y[len(y)-1]
    z=int(z)
    return z
def main():
    x=input().split()
    s1=int(x[0])
    s2=int(x[1])
    a=int(x[2])
    b=int(x[3])
    c=int(x[4])
    if s1==0 or s1==1 or s2==0 or s2 ==1 :
        if s1==0 and s2==0 :
            print(f1(a,b,c))
        if s1==0 and s2==1 :
            print(f2(a,b,c))
        if s1==1 and s2==0 :
            print(f3(a,b,c))
        if s1==1 and s2==1 :
            print(f4(a,b,c))
        if s1==0 and (s2!=0 or s2=!1):
            print('Error')
        if s1==1 and (s2!=0 or s2=!1): 
            print('Error')
        if s2==0 and (s1!=0 or s1!=1):
            print('Error')
        if s2==1 and (s1!=0 or s1!=1):
            print('Error')
    else :
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1640775, 2022-09-24 10:06:39, compilation error (0%)

def f1(a, b, c):
    x=[a,b,c]
    x.sort()
    y=[]
    for e in x:
        if e>0 :
            y.append(e)
    return y[0]
def f2(a, b, c):
    x=[a,b,c]
    y=[]
    for e in x:
        if e<0 :
            y.append(e)
    y.sort()
    return y[len(y)-1]
def f3(a, b, c):
    x=a+b+c
    if x<0 :
        x=-x
    y=str(x)
    z=y[0]
    z=int(z)
    return z
def f4(a, b, c):
    x=a+b+c
    if x<0 :
        x=-x
    y=str(x)+''
    z=y[len(y)-1]
    z=int(z)
    return z
def main():
    x=input().split()
    s1=int(x[0])
    s2=int(x[1])
    a=int(x[2])
    b=int(x[3])
    c=int(x[4])
    if s1==0 or s1==1 or s2==0 or s2 ==1 :
        if s1==0 and s2==0 :
            print(f1(a,b,c))
        if s1==0 and s2==1 
            print(f2(a,b,c))
        if s1==1 and s2==0 :
            print(f3(a,b,c))
        if s1==1 and s2==1 :
            print(f4(a,b,c))
        if s1==0 and (s2!=0 or s2!=1):
            print('Error')
        if s1==1 and (s2!=0 or s2!=1): 
            print('Error')
        if s2==0 and (s1!=0 or s1!=1):
            print('Error')
        if s2==1 and (s1!=0 or s1!=1):
            print('Error')
    else :
        print('Error')
exec(input().strip()) # DON'T remove this line

# 1640786, 2022-09-24 10:06:57, PPPP[--][P-P-] (67%)

def f1(a, b, c):
    x=[a,b,c]
    x.sort()
    y=[]
    for e in x:
        if e>0 :
            y.append(e)
    return y[0]
def f2(a, b, c):
    x=[a,b,c]
    y=[]
    for e in x:
        if e<0 :
            y.append(e)
    y.sort()
    return y[len(y)-1]
def f3(a, b, c):
    x=a+b+c
    if x<0 :
        x=-x
    y=str(x)
    z=y[0]
    z=int(z)
    return z
def f4(a, b, c):
    x=a+b+c
    if x<0 :
        x=-x
    y=str(x)+''
    z=y[len(y)-1]
    z=int(z)
    return z
def main():
    x=input().split()
    s1=int(x[0])
    s2=int(x[1])
    a=int(x[2])
    b=int(x[3])
    c=int(x[4])
    if s1==0 or s1==1 or s2==0 or s2 ==1 :
        if s1==0 and s2==0 :
            print(f1(a,b,c))
        if s1==0 and s2==1 :
            print(f2(a,b,c))
        if s1==1 and s2==0 :
            print(f3(a,b,c))
        if s1==1 and s2==1 :
            print(f4(a,b,c))
        if s1==0 and (s2!=0 or s2!=1):
            print('Error')
        if s1==1 and (s2!=0 or s2!=1): 
            print('Error')
        if s2==0 and (s1!=0 or s1!=1):
            print('Error')
        if s2==1 and (s1!=0 or s1!=1):
            print('Error')
    else :
        print('Error')
exec(input().strip()) # DON'T remove this line

# 1640900, 2022-09-24 10:09:56, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    x=[a,b,c]
    x.sort()
    y=[]
    for e in x:
        if e>0 :
            y.append(e)
    return y[0]
def f2(a, b, c):
    x=[a,b,c]
    y=[]
    for e in x:
        if e<0 :
            y.append(e)
    y.sort()
    return y[len(y)-1]
def f3(a, b, c):
    x=a+b+c
    if x<0 :
        x=-x
    y=str(x)
    z=y[0]
    z=int(z)
    return z
def f4(a, b, c):
    x=a+b+c
    if x<0 :
        x=-x
    y=str(x)+''
    z=y[len(y)-1]
    z=int(z)
    return z
def main():
    x=input().split()
    s1=int(x[0])
    s2=int(x[1])
    a=int(x[2])
    b=int(x[3])
    c=int(x[4])
    if (s1==0 and s2==0) or (s1==0 and s2==1) or (s1==1 and s2==0) or (s1==1 and s2==1) :
        if s1==0 and s2==0 :
            print(f1(a,b,c))
        if s1==0 and s2==1 :
            print(f2(a,b,c))
        if s1==1 and s2==0 :
            print(f3(a,b,c))
        if s1==1 and s2==1 :
            print(f4(a,b,c))
    else :
        print('Error')
exec(input().strip()) # DON'T remove this line


6530075721
# 1639651, 2022-09-24 09:35:44, ----[--][P-P-] (0%)

def f1(a,b,c) : 
    if a <= 0 :
        return min(b,c)
    elif b <= 0 :
        return min(a,c)
    else :
        return min(a,b)

def f2(a,b,c) : 
    if a >= 0 :
        return max(b,c)
    elif b >= 0 :
        return max(a,c)
    else :
        return max(a,b)

def f3(a,b,c) :
    ans = a+b+c
    if ans < 0 :
        return str(-1*ans)[0]
    return str(ans)[0]

def f4(a,b,c) :
    ans = str(a+b+c)
    return ans[-1]

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    #if -1000 > a or a > 1000 or -1000 > b or b > 1000 \
    #   or -1000 > c or c > 1000 :
    #    print('Error')
    #if a < 0 and b < 0 and c < 0 :
    #    print('Error')
    #if a > 0 and b > 0 and c > 0 :
    #    print('Error')
    
    if not s1 in [0,1] or s2 not in [0,1] :
        print('Error')
    elif s1 == 0 :
        if s2 == 0 :
            print('f1')
            print(f1(a,b,c))
        else :
            print('f2')
            print(f2(a,b,c))
    else :
        if s2 == 0 :
            print('f3')
            print(f3(a,b,c))
        else :
            print('f4')
            print(f4(a,b,c))
        
exec(input().strip())
# 1639678, 2022-09-24 09:36:24, ----[PP][PPPP] (33%)

def f1(a,b,c) : 
    if a <= 0 :
        return min(b,c)
    elif b <= 0 :
        return min(a,c)
    else :
        return min(a,b)

def f2(a,b,c) : 
    if a >= 0 :
        return max(b,c)
    elif b >= 0 :
        return max(a,c)
    else :
        return max(a,b)

def f3(a,b,c) :
    ans = a+b+c
    if ans < 0 :
        return str(-1*ans)[0]
    return str(ans)[0]

def f4(a,b,c) :
    ans = str(a+b+c)
    return ans[-1]

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    #if -1000 > a or a > 1000 or -1000 > b or b > 1000 \
    #   or -1000 > c or c > 1000 :
    #    print('Error')
    #if a < 0 and b < 0 and c < 0 :
    #    print('Error')
    #if a > 0 and b > 0 and c > 0 :
    #    print('Error')
    
    if not s1 in [0,1] or s2 not in [0,1] :
        print('Error')
    elif s1 == 0 :
        if s2 == 0 :
            print(f1(a,b,c))
        else :
            print(f2(a,b,c))
    else :
        if s2 == 0 :
            print(f3(a,b,c))
        else :
            print(f4(a,b,c))
        
exec(input().strip())
# 1640321, 2022-09-24 09:54:24, --x-[--][P-Px] (0%)

def f1(a,b,c) : 
    if a <= 0 :
        return min(b,c)
    elif b <= 0 :
        return min(a,c)
    else :
        return min(a,b)

def f2(a,b,c) : 
    if a >= 0 :
        return max(b,c)
    elif b >= 0 :
        return max(a,c)
    else :
        return max(a,b)

def f3(a,b,c) :
    ans = a+b+c
    if ans < 0 :
        return str[1]
    return str(ans)[0]

def f4(a,b,c) :
    ans = str(a+b+c)
    return ans[-1]

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if not s1 in [0,1] or s2 not in [0,1] :
        print('Error')
    elif s1 == 0 :
        if s2 == 0 :
            print('f1')
            print(f1(a,b,c))
        else :
            print('f2')
            print(f2(a,b,c))
    else :
        if s2 == 0 :
            print('f3')
            print(f3(a,b,c))
        else :
            print('f4')
            print(f4(a,b,c))
        
exec(input().strip())
# 1640338, 2022-09-24 09:54:52, ----[--][P-P-] (0%)

def f1(a,b,c) : 
    if a <= 0 :
        return min(b,c)
    elif b <= 0 :
        return min(a,c)
    else :
        return min(a,b)

def f2(a,b,c) : 
    if a >= 0 :
        return max(b,c)
    elif b >= 0 :
        return max(a,c)
    else :
        return max(a,b)

def f3(a,b,c) :
    ans = a+b+c
    if ans < 0 :
        return str(ans)[1]
    return str(ans)[0]

def f4(a,b,c) :
    ans = str(a+b+c)
    return ans[-1]

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if not s1 in [0,1] or s2 not in [0,1] :
        print('Error')
    elif s1 == 0 :
        if s2 == 0 :
            print('f1')
            print(f1(a,b,c))
        else :
            print('f2')
            print(f2(a,b,c))
    else :
        if s2 == 0 :
            print('f3')
            print(f3(a,b,c))
        else :
            print('f4')
            print(f4(a,b,c))
        
exec(input().strip())
# 1640449, 2022-09-24 09:58:15, ----[PP][PPPP] (33%)

def f1(a,b,c) : 
    if a <= 0 :
        return min(b,c)
    elif b <= 0 :
        return min(a,c)
    else :
        return min(a,b)

def f2(a,b,c) : 
    if a >= 0 :
        return max(b,c)
    elif b >= 0 :
        return max(a,c)
    else :
        return max(a,b)

def f3(a,b,c) :
    ans = a+b+c
    if ans < 0 :
        return str(ans)[1]
    return str(ans)[0]

def f4(a,b,c) :
    ans = str(a+b+c)
    return ans[-1]

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if not s1 in [0,1] or s2 not in [0,1] :
        print('Error')
    elif s1 == 0 :
        if s2 == 0 :
            print(f1(a,b,c))
        else :
            print(f2(a,b,c))
    else :
        if s2 == 0 :
            print(f3(a,b,c))
        else :
            print(f4(a,b,c))
        
exec(input().strip())
# 1641148, 2022-09-24 10:16:27, ----[xx][xxxx] (0%)

def f1(a,b,c) : 
    if a <= 0 :
        return min(b,c)
    elif b <= 0 :
        return min(a,c)
    else :
        return min(a,b)

def f2(a,b,c) : 
    if a >= 0 :
        return max(b,c)
    elif b >= 0 :
        return max(a,c)
    else :
        return max(a,b)

def f3(a,b,c) :
    ans = a+b+c
    if ans < 0 :
        return str(ans)[1]
    return str(ans)[0]

def f4(a,b,c) :
    ans = str(a+b+c)
    return ans[-1]

        
exec(input().strip())
# 1641164, 2022-09-24 10:16:47, ----[PP][PPPP] (33%)

def f1(a,b,c) : 
    if a <= 0 :
        return min(b,c)
    elif b <= 0 :
        return min(a,c)
    else :
        return min(a,b)

def f2(a,b,c) : 
    if a >= 0 :
        return max(b,c)
    elif b >= 0 :
        return max(a,c)
    else :
        return max(a,b)

def f3(a,b,c) :
    ans = a+b+c
    if ans < 0 :
        return str(ans)[1]
    return str(ans)[0]

def f4(a,b,c) :
    ans = str(a+b+c)
    return ans[-1]

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if not s1 in [0,1] or s2 not in [0,1] :
        print('Error')
    elif s1 == 0 :
        if s2 == 0 :
            print(f1(a,b,c))
        else :
            print(f2(a,b,c))
    else :
        if s2 == 0 :
            print(f3(a,b,c))
        else :
            print(f4(a,b,c))
        
exec(input().strip())
# 1641363, 2022-09-24 10:20:46, ----[--][PPPP] (17%)

def f1(a,b,c) : 
    if a <= 0 and b>0 and c>0 :
        print(min(b,c))
    elif b <= 0 and a>0 and c>0 :
        print(min(a,c))
    else :
        print(min(a,b))

def f2(a,b,c) : 
    if a >= 0 and b<0 and c<0 :
        print(max(b,c))
    elif b >= 0 and a <0 and c<0 :
        print(max(a,c))
    else :
        print(max(a,b))

def f3(a,b,c) :
    ans = a+b+c
    if ans < 0 :
        return str(ans)[1]
    return str(ans)[0]

def f4(a,b,c) :
    ans = str(a+b+c)
    return ans[-1]

def main() : #checked
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if not s1 in [0,1] or s2 not in [0,1] :
        print('Error')
    elif s1 == 0 :
        if s2 == 0 :
            print(f1(a,b,c))
        else :
            print(f2(a,b,c))
    else :
        if s2 == 0 :
            print(f3(a,b,c))
        else :
            print(f4(a,b,c))
        
exec(input().strip())
# 1641474, 2022-09-24 10:23:10, --PP[PP][PPPP] (67%)

def f1(a,b,c) : 
    if a <= 0 :
        return min(b,c)
    elif b <= 0 :
        return min(a,c)
    elif c <= 0 :
        return min(a,b)

def f2(a,b,c) : 
    if a >= 0 :
        return max(b,c)
    elif b >= 0 :
        return max(a,c)
    elif c >= 0 :
        return max(a,b)

def f3(a,b,c) :
    ans = a+b+c
    if ans < 0 :
        return int(str(ans)[1])
    return int(str(ans)[0])

def f4(a,b,c) :
    ans = str(a+b+c)
    return int(ans[-1])

def main() : #checked
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if not s1 in [0,1] or s2 not in [0,1] :
        print('Error')
    elif s1 == 0 :
        if s2 == 0 :
            print(f1(a,b,c))
        else :
            print(f2(a,b,c))
    else :
        if s2 == 0 :
            print(f3(a,b,c))
        else :
            print(f4(a,b,c))
        
exec(input().strip())
# 1641526, 2022-09-24 10:24:12, compilation error (0%)

def f1(a,b,c) : 
    if b>0 ad c>0:
        return min(b,c)
    elif a>0 and c>0 :
        return min(a,c)
    elif a>0 and b>0 :
        return min(a,b)

def f2(a,b,c) : 
    if a >= 0 :
        return max(b,c)
    elif b >= 0 :
        return max(a,c)
    elif c >= 0 :
        return max(a,b)

def f3(a,b,c) :
    ans = a+b+c
    if ans < 0 :
        return int(str(ans)[1])
    return int(str(ans)[0])

def f4(a,b,c) :
    ans = str(a+b+c)
    return int(ans[-1])

def main() : #checked
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if not s1 in [0,1] or s2 not in [0,1] :
        print('Error')
    elif s1 == 0 :
        if s2 == 0 :
            print(f1(a,b,c))
        else :
            print(f2(a,b,c))
    else :
        if s2 == 0 :
            print(f3(a,b,c))
        else :
            print(f4(a,b,c))
        
exec(input().strip())
# 1641543, 2022-09-24 10:24:29, --PP[PP][PPPP] (67%)

def f1(a,b,c) : 
    if a <= 0 :
        return min(b,c)
    elif b <= 0 :
        return min(a,c)
    elif c <= 0 :
        return min(a,b)

def f2(a,b,c) : 
    if a >= 0 :
        return max(b,c)
    elif b >= 0 :
        return max(a,c)
    elif c >= 0 :
        return max(a,b)

def f3(a,b,c) :
    ans = a+b+c
    if ans < 0 :
        return int(str(ans)[1])
    return int(str(ans)[0])

def f4(a,b,c) :
    ans = str(a+b+c)
    return int(ans[-1])

def main() : #checked
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if not s1 in [0,1] or s2 not in [0,1] :
        print('Error')
    elif s1 == 0 :
        if s2 == 0 :
            print(f1(a,b,c))
        else :
            print(f2(a,b,c))
    else :
        if s2 == 0 :
            print(f3(a,b,c))
        else :
            print(f4(a,b,c))
        
exec(input().strip())
# 1641609, 2022-09-24 10:25:38, x-PP[xP][PPPP] (50%)

def f1(a,b,c) : 
    ans.append(a)
    ans.append(b)
    ans.append(c)
    return min([i for i in ans if i>= 0])

def f2(a,b,c) : 
    if a >= 0 :
        return max(b,c)
    elif b >= 0 :
        return max(a,c)
    elif c >= 0 :
        return max(a,b)

def f3(a,b,c) :
    ans = a+b+c
    if ans < 0 :
        return int(str(ans)[1])
    return int(str(ans)[0])

def f4(a,b,c) :
    ans = str(a+b+c)
    return int(ans[-1])

def main() : #checked
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if not s1 in [0,1] or s2 not in [0,1] :
        print('Error')
    elif s1 == 0 :
        if s2 == 0 :
            print(f1(a,b,c))
        else :
            print(f2(a,b,c))
    else :
        if s2 == 0 :
            print(f3(a,b,c))
        else :
            print(f4(a,b,c))
        
exec(input().strip())
# 1641733, 2022-09-24 10:27:54, --PP[PP][PPPP] (67%)

def f1(a,b,c) : 
  ans = []
  ans.append(a)
  ans.append(b)
  ans.append(c)
  return min([i for i in ans if i>= 0])

def f2(a,b,c) : 
    if a >= 0 :
        return max(b,c)
    elif b >= 0 :
        return max(a,c)
    elif c >= 0 :
        return max(a,b)

def f3(a,b,c) :
    ans = a+b+c
    if ans < 0 :
        return int(str(ans)[1])
    return int(str(ans)[0])

def f4(a,b,c) :
    ans = str(a+b+c)
    return int(ans[-1])

def main() : #checked
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if not s1 in [0,1] or s2 not in [0,1] :
        print('Error')
    elif s1 == 0 :
        if s2 == 0 :
            print(f1(a,b,c))
        else :
            print(f2(a,b,c))
    else :
        if s2 == 0 :
            print(f3(a,b,c))
        else :
            print(f4(a,b,c))
        
exec(input().strip())
# 1641831, 2022-09-24 10:29:43, PPPP[PP][PPPP] (100%)

def f1(a,b,c) :
    ans = []
    ans.append(a)
    ans.append(b)
    ans.append(c)
    return min([i for i in ans if i> 0])

def f2(a,b,c) : 
    ans = []
    ans.append(a)
    ans.append(b)
    ans.append(c)
    return max([i for i in ans if i < 0])

def f3(a,b,c) :
    ans = a+b+c
    if ans < 0 :
        return int(str(ans)[1])
    return int(str(ans)[0])

def f4(a,b,c) :
    ans = str(a+b+c)
    return int(ans[-1])

def main() : #checked
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if not s1 in [0,1] or s2 not in [0,1] :
        print('Error')
    elif s1 == 0 :
        if s2 == 0 :
            print(f1(a,b,c))
        else :
            print(f2(a,b,c))
    else :
        if s2 == 0 :
            print(f3(a,b,c))
        else :
            print(f4(a,b,c))
        
exec(input().strip())

6531341821
# 1640345, 2022-09-24 09:55:11, --PP[PP][-P--] (50%)


def f1(a, b, c):
    if a<0 and b<0:
        return c
    elif b<0 and c<0:
        return a
    elif a<0 and c<0:
        return b
    elif a<0:
        if b<c:
            return b
        else:
            return c
    elif b<0:
        if a<c:
            return a
        else:
            return c
    elif c<0:
        if a<b:
            return a
        else:
            return b

def f2(a, b, c):
    if a>0 and b>0:
        return c
    elif b>0 and c>0:
        return a
    elif a>0 and c>0:
        return b
    elif a>0:
        if b>c:
            return b
        else:
            return c
    elif b>0:
        if a>c:
            return a
        else:
            return c
    elif c>0:
        if a>b:
            return a
        else:
            return b

def f3(a, b, c):
    k=a+b+c
    u=str(k)
    s=k//10**(len(u)-1)
    if s<0:
        s=-s
    return s

def f4(a, b, c):
    k=a+b+c
    if k<10:
        k=-k
    s=k%10
    return s

def main():
    s1,s2,a,b,c=input().split()
    a,b,c=int(a),int(b),int(c)
    if(s1=='0') and (s2=='0') :
        y=f1(a,b,c)
        print(y)
    if(s1=='0') and (s2=='1') :
        y=f2(a,b,c)
        print(y)
    if(s1=='1') and (s2=='0') :
        y=f3(a,b,c)
        print(y)
    if(s1=='1') and (s2=='1') :
        y=f4(a,b,c)
        print(y)
    
exec(input().strip()) 
# 1640536, 2022-09-24 10:00:13, --PP[--][P-P-] (33%)

def f1(a, b, c):
    if a<0 and b<0:
        return c
    elif b<0 and c<0:
        return a
    elif a<0 and c<0:
        return b
    elif a<0:
        if b<c:
            return b
        else:
            return c
    elif b<0:
        if a<c:
            return a
        else:
            return c
    elif c<0:
        if a<b:
            return a
        else:
            return b

def f2(a, b, c):
    if a>0 and b>0:
        return c
    elif b>0 and c>0:
        return a
    elif a>0 and c>0:
        return b
    elif a>0:
        if b>c:
            return b
        else:
            return c
    elif b>0:
        if a>c:
            return a
        else:
            return c
    elif c>0:
        if a>b:
            return a
        else:
            return b

def f3(a, b, c):
    k=a+b+c
    u=str(k)
    s=k//10**(len(u)-1)
    if s<0:
        s=-s
    return s

def f4(a, b, c):
    k=a+b+c
    if k<10:
        k=-k
    s=k%10
    return s

def main():
    s1,s2,a,b,c=input().split()
    a,b,c=int(a),int(b),int(c)
    if(s1=='0') and (s2=='0') :
        y=f1(a,b,c)
        print(y)
    if(s1=='0') and (s2=='1') :
        y=f2(a,b,c)
        print(y)
    if(s1=='1') and (s2=='0') :
        y=f3(a,b,c)
        print(y)
    if(s1=='1') and (s2=='1') :
        y=f4(a,b,c)
        print(y)
    else:
      print('Error')
    
exec(input().strip())
# 1640541, 2022-09-24 10:00:28, --PP[--][P-P-] (33%)

def f1(a, b, c):
    if a<0 and b<0:
        return c
    elif b<0 and c<0:
        return a
    elif a<0 and c<0:
        return b
    elif a<0:
        if b<c:
            return b
        else:
            return c
    elif b<0:
        if a<c:
            return a
        else:
            return c
    elif c<0:
        if a<b:
            return a
        else:
            return b

def f2(a, b, c):
    if a>0 and b>0:
        return c
    elif b>0 and c>0:
        return a
    elif a>0 and c>0:
        return b
    elif a>0:
        if b>c:
            return b
        else:
            return c
    elif b>0:
        if a>c:
            return a
        else:
            return c
    elif c>0:
        if a>b:
            return a
        else:
            return b

def f3(a, b, c):
    k=a+b+c
    u=str(k)
    s=k//10**(len(u)-1)
    if s<0:
        s=-s
    return s

def f4(a, b, c):
    k=a+b+c
    if k<10:
        k=-k
    s=k%10
    return s

def main():
    s1,s2,a,b,c=input().split()
    a,b,c=int(a),int(b),int(c)
    if(s1=='0') and (s2=='0') :
        y=f1(a,b,c)
        print(y)
    if(s1=='0') and (s2=='1') :
        y=f2(a,b,c)
        print(y)
    if(s1=='1') and (s2=='0') :
        y=f3(a,b,c)
        print(y)
    if(s1=='1') and (s2=='1') :
        y=f4(a,b,c)
        print(y)
    else:
      print('Error')
    
exec(input().strip())
# 1640546, 2022-09-24 10:00:39, --PP[PP][-P--] (50%)

def f1(a, b, c):
    if a<0 and b<0:
        return c
    elif b<0 and c<0:
        return a
    elif a<0 and c<0:
        return b
    elif a<0:
        if b<c:
            return b
        else:
            return c
    elif b<0:
        if a<c:
            return a
        else:
            return c
    elif c<0:
        if a<b:
            return a
        else:
            return b

def f2(a, b, c):
    if a>0 and b>0:
        return c
    elif b>0 and c>0:
        return a
    elif a>0 and c>0:
        return b
    elif a>0:
        if b>c:
            return b
        else:
            return c
    elif b>0:
        if a>c:
            return a
        else:
            return c
    elif c>0:
        if a>b:
            return a
        else:
            return b

def f3(a, b, c):
    k=a+b+c
    u=str(k)
    s=k//10**(len(u)-1)
    if s<0:
        s=-s
    return s

def f4(a, b, c):
    k=a+b+c
    if k<10:
        k=-k
    s=k%10
    return s

def main():
    s1,s2,a,b,c=input().split()
    a,b,c=int(a),int(b),int(c)
    if(s1=='0') and (s2=='0') :
        y=f1(a,b,c)
        print(y)
    if(s1=='0') and (s2=='1') :
        y=f2(a,b,c)
        print(y)
    if(s1=='1') and (s2=='0') :
        y=f3(a,b,c)
        print(y)
    if(s1=='1') and (s2=='1') :
        y=f4(a,b,c)
        print(y)
    
exec(input().strip())
# 1640585, 2022-09-24 10:01:52, --PP[PP][-P--] (50%)

def f1(a, b, c):
    if a<0 and b<0:
        return c
    elif b<0 and c<0:
        return a
    elif a<0 and c<0:
        return b
    elif a<0:
        if b<c:
            return b
        else:
            return c
    elif b<0:
        if a<c:
            return a
        else:
            return c
    elif c<0:
        if a<b:
            return a
        else:
            return b

def f2(a, b, c):
    if a>0 and b>0:
        return c
    elif b>0 and c>0:
        return a
    elif a>0 and c>0:
        return b
    elif a>0:
        if b>c:
            return b
        else:
            return c
    elif b>0:
        if a>c:
            return a
        else:
            return c
    elif c>0:
        if a>b:
            return a
        else:
            return b

def f3(a, b, c):
    k=a+b+c
    u=str(k)
    s=k//10**(len(u)-1)
    if s<0:
        s=-s
    return s

def f4(a, b, c):
    k=a+b+c
    if k<10:
        k=-k
    s=k%10
    return s

def main():
    s1,s2,a,b,c=input().split()
    a,b,c=int(a),int(b),int(c)
    if s1=='0' and s2=='0' :
        y=f1(a,b,c)
        print(y)
    if s1=='0' and  s2=='1' :
        y=f2(a,b,c)
        print(y)
    if s1=='1'  and  s2=='0' :
        y=f3(a,b,c)
        print(y)
    if s1=='1'  and  s2=='1' :
        y=f4(a,b,c)
        print(y)
    
exec(input().strip())
# 1640615, 2022-09-24 10:02:34, --PP[PP][PPP-] (50%)

def f1(a, b, c):
    if a<0 and b<0:
        return c
    elif b<0 and c<0:
        return a
    elif a<0 and c<0:
        return b
    elif a<0:
        if b<c:
            return b
        else:
            return c
    elif b<0:
        if a<c:
            return a
        else:
            return c
    elif c<0:
        if a<b:
            return a
        else:
            return b

def f2(a, b, c):
    if a>0 and b>0:
        return c
    elif b>0 and c>0:
        return a
    elif a>0 and c>0:
        return b
    elif a>0:
        if b>c:
            return b
        else:
            return c
    elif b>0:
        if a>c:
            return a
        else:
            return c
    elif c>0:
        if a>b:
            return a
        else:
            return b

def f3(a, b, c):
    k=a+b+c
    u=str(k)
    s=k//10**(len(u)-1)
    if s<0:
        s=-s
    return s

def f4(a, b, c):
    k=a+b+c
    if k<10:
        k=-k
    s=k%10
    return s

def main():
    s1,s2,a,b,c=input().split()
    a,b,c=int(a),int(b),int(c)
    if s1=='0' and s2=='0' :
        y=f1(a,b,c)
        print(y)
    elif s1=='0' and  s2=='1' :
        y=f2(a,b,c)
        print(y)
    elif s1=='1'  and  s2=='0' :
        y=f3(a,b,c)
        print(y)
    elif s1=='1'  and  s2=='1' :
        y=f4(a,b,c)
        print(y)
    else:
      print('Error')
      
    
exec(input().strip())
# 1640808, 2022-09-24 10:07:38, --PP[--][P-P-] (33%)

def f1(a, b, c):
    if a<0 and b<0:
        return c
    elif b<0 and c<0:
        return a
    elif a<0 and c<0:
        return b
    elif a<0:
        if b<c:
            return b
        else:
            return c
    elif b<0:
        if a<c:
            return a
        else:
            return c
    elif c<0:
        if a<b:
            return a
        else:
            return b

def f2(a, b, c):
    if a>0 and b>0:
        return c
    elif b>0 and c>0:
        return a
    elif a>0 and c>0:
        return b
    elif a>0:
        if b>c:
            return b
        else:
            return c
    elif b>0:
        if a>c:
            return a
        else:
            return c
    elif c>0:
        if a>b:
            return a
        else:
            return b

def f3(a, b, c):
    k=a+b+c
    u=str(k)
    s=k//10**(len(u)-1)
    if s<0:
        s=-s
    return s

def f4(a, b, c):
    k=a+b+c
    if k<10:
        k=-k
    s=k%10
    return s

def main():
    s1,s2,a,b,c=input().split()
    a,b,c=int(a),int(b),int(c)
    if (s1!='0' or s1!='1') or (s2!='0' or s2!='1'):
      print ('Error')
    if(s1=='0') and (s2=='0') :
      y=f1(a,b,c)
      print(y)
    if(s1=='0') and (s2=='1') :
      y=f2(a,b,c)
      print(y)
    if(s1=='1') and (s2=='0') :
      y=f3(a,b,c)
      print(y)
    if(s1=='1') and (s2=='1') :
      y=f4(a,b,c)
      print(y)

      
    
exec(input().strip())
# 1641332, 2022-09-24 10:20:03, --xP[--][PxPx] (17%)

def f1(a, b, c):
    if a<0 and b<0:
        return c
    elif b<0 and c<0:
        return a
    elif a<0 and c<0:
        return b
    elif a<0:
        if b<c:
            return b
        else:
            return c
    elif b<0:
        if a<c:
            return a
        else:
            return c
    elif c<0:
        if a<b:
            return a
        else:
            return b

def f2(a, b, c):
    if a>0 and b>0:
        return c
    elif b>0 and c>0:
        return a
    elif a>0 and c>0:
        return b
    elif a>0:
        if b>c:
            return b
        else:
            return c
    elif b>0:
        if a>c:
            return a
        else:
            return c
    elif c>0:
        if a>b:
            return a
        else:
            return b

def f3(a, b, c):
    k=a+b+c
    u=str(k)
    if k<0:
        k=-k
    s=k//10**(len(u-1))
    return s

def f4(a, b, c):
    k=a+b+c
    if k<0:
        k=-k
    s=k%10
    return s

def main():
    s1,s2,a,b,c=input().split()
    s1,s2,a,b,c=int(s1),int(s2),int(a),int(b),int(c)
    if(s1==0) and (s2==0) :
        y=f1(a,b,c)
        print(y)
    if(s1==0) and (s2==1) :
        y=f2(a,b,c)
        print(y)
    if(s1==1) and (s2==0) :
        y=f3(a,b,c)
        print(y)
    if(s1==1) and (s2==1) :
        y=f4(a,b,c)
        print(y)
    else:
      print ('Error')
exec(input().strip()) # DON'T remove this line
# 1641422, 2022-09-24 10:21:57, --PP[--][P-P-] (33%)

def f1(a, b, c):
    if a<0 and b<0:
        return c
    elif b<0 and c<0:
        return a
    elif a<0 and c<0:
        return b
    elif a<0:
        if b<c:
            return b
        else:
            return c
    elif b<0:
        if a<c:
            return a
        else:
            return c
    elif c<0:
        if a<b:
            return a
        else:
            return b

def f2(a, b, c):
    if a>0 and b>0:
        return c
    elif b>0 and c>0:
        return a
    elif a>0 and c>0:
        return b
    elif a>0:
        if b>c:
            return b
        else:
            return c
    elif b>0:
        if a>c:
            return a
        else:
            return c
    elif c>0:
        if a>b:
            return a
        else:
            return b

def f3(a, b, c):
    k=a+b+c
    if k<0:
        k=-k
    u=str(k)
    s=k//10**(len(u)-1)
    return s

def f4(a, b, c):
    k=a+b+c
    if k<0:
        k=-k
    s=k%10
    return s

def main():
    s1,s2,a,b,c=input().split()
    s1,s2,a,b,c=int(s1),int(s2),int(a),int(b),int(c)
    if(s1==0) and (s2==0) :
        y=f1(a,b,c)
        print(y)
    if(s1==0) and (s2==1) :
        y=f2(a,b,c)
        print(y)
    if(s1==1) and (s2==0) :
        y=f3(a,b,c)
        print(y)
    if(s1==1) and (s2==1) :
        y=f4(a,b,c)
        print(y)
    else:
      print ('Error')
exec(input().strip()) # DON'T remove this line
# 1641791, 2022-09-24 10:29:01, compilation error (0%)

def f1(a, b, c):
    if a<=0 and b<=0:
        return c
    elif b<=0 and c<=0:
        return a
    elif a<=0 and c<=0:
        return b
    elif a<=0:
        if b<c:
            return b
        else:
            return c
    elif b<=0:
        if a<c:
            return a
        else:
            return c
    elif c<=0:
        if a<b:
            return a
        else:
            return b

def f2(a, b, c):
    if a>=0 and b>=0:
        return c
    elif b>=0 and c>=0:
        return a
    elif a>=0 and c=>0:
        return b
    elif a>=0:
        if b>c:
            return b
        else:
            return c
    elif b>=0:
        if a>c:
            return a
        else:
            return c
    elif c>=0:
        if a>b:
            return a
        else:
            return b

def f3(a, b, c):
    k=a+b+c
    if k<0:
        k=-k
    u=str(k)
    s=k//10**(len(u)-1)
    return s

def f4(a, b, c):
    k=a+b+c
    if k<0:
        k=-k
    s=k%10
    return s

def main():
    s1,s2,a,b,c=input().split()
    s1,s2,a,b,c=int(s1),int(s2),int(a),int(b),int(c)
    if(s1==0) and (s2==0) :
        y=f1(a,b,c)
        print(y)
    if(s1==0) and (s2==1) :
        y=f2(a,b,c)
        print(y)
    if(s1==1) and (s2==0) :
        y=f3(a,b,c)
        print(y)
    if(s1==1) and (s2==1) :
        y=f4(a,b,c)
        print(y)
    else:
      print ('Error')
exec(input().strip()) # DON'T remove this line
# 1641816, 2022-09-24 10:29:26, PPPP[--][P-P-] (67%)

def f1(a, b, c):
    if a<=0 and b<=0:
        return c
    elif b<=0 and c<=0:
        return a
    elif a<=0 and c<=0:
        return b
    elif a<=0:
        if b<c:
            return b
        else:
            return c
    elif b<=0:
        if a<c:
            return a
        else:
            return c
    elif c<=0:
        if a<b:
            return a
        else:
            return b

def f2(a, b, c):
    if a>=0 and b>=0:
        return c
    elif b>=0 and c>=0:
        return a
    elif a>=0 and c>=0:
        return b
    elif a>=0:
        if b>c:
            return b
        else:
            return c
    elif b>=0:
        if a>c:
            return a
        else:
            return c
    elif c>=0:
        if a>b:
            return a
        else:
            return b

def f3(a, b, c):
    k=a+b+c
    if k<0:
        k=-k
    u=str(k)
    s=k//10**(len(u)-1)
    return s

def f4(a, b, c):
    k=a+b+c
    if k<0:
        k=-k
    s=k%10
    return s

def main():
    s1,s2,a,b,c=input().split()
    s1,s2,a,b,c=int(s1),int(s2),int(a),int(b),int(c)
    if(s1==0) and (s2==0) :
        y=f1(a,b,c)
        print(y)
    if(s1==0) and (s2==1) :
        y=f2(a,b,c)
        print(y)
    if(s1==1) and (s2==0) :
        y=f3(a,b,c)
        print(y)
    if(s1==1) and (s2==1) :
        y=f4(a,b,c)
        print(y)
    else:
      print ('Error')
exec(input().strip()) # DON'T remove this line
# 1641997, 2022-09-24 10:32:40, PPxx[--][PxPx] (33%)

import math
def f1(a, b, c):
    if a<=0 and b<=0:
        return c
    elif b<=0 and c<=0:
        return a
    elif a<=0 and c<=0:
        return b
    elif a<=0:
        if b<c:
            return b
        else:
            return c
    elif b<=0:
        if a<c:
            return a
        else:
            return c
    elif c<=0:
        if a<b:
            return a
        else:
            return b

def f2(a, b, c):
    if a>=0 and b>=0:
        return c
    elif b>=0 and c>=0:
        return a
    elif a>=0 and c>=0:
        return b
    elif a>=0:
        if b>c:
            return b
        else:
            return c
    elif b>=0:
        if a>c:
            return a
        else:
            return c
    elif c>=0:
        if a>b:
            return a
        else:
            return b

def f3(a, b, c):
    k=a+b+c
    k=math.abs(k)
    u=str(k)
    s=k//10**(len(u)-1)
    return s

def f4(a, b, c):
    k=a+b+c
    k=math.abs(k)
    s=k%10
    return s

def main():
    s1,s2,a,b,c=input().split()
    s1,s2,a,b,c=int(s1),int(s2),int(a),int(b),int(c)
    if(s1==0) and (s2==0) :
        y=f1(a,b,c)
        print(y)
    if(s1==0) and (s2==1) :
        y=f2(a,b,c)
        print(y)
    if(s1==1) and (s2==0) :
        y=f3(a,b,c)
        print(y)
    if(s1==1) and (s2==1) :
        y=f4(a,b,c)
        print(y)
    else:
      print ('Error')
exec(input().strip()) # DON'T remove this line
# 1642125, 2022-09-24 10:34:42, PPPP[--][P-P-] (67%)

def f1(a, b, c):
    if a<=0 and b<=0:
        return c
    elif b<=0 and c<=0:
        return a
    elif a<=0 and c<=0:
        return b
    elif a<=0:
        if b<c:
            return b
        else:
            return c
    elif b<=0:
        if a<c:
            return a
        else:
            return c
    elif c<=0:
        if a<b:
            return a
        else:
            return b

def f2(a, b, c):
    if a>=0 and b>=0:
        return c
    elif b>=0 and c>=0:
        return a
    elif a>=0 and c>=0:
        return b
    elif a>=0:
        if b>c:
            return b
        else:
            return c
    elif b>=0:
        if a>c:
            return a
        else:
            return c
    elif c>=0:
        if a>b:
            return a
        else:
            return b

def f3(a, b, c):
    k=a+b+c
    k=abs(k)
    u=str(k)
    s=k//10**(len(u)-1)
    return s

def f4(a, b, c):
    k=a+b+c
    k=abs(k)
    
    s=k%10
    return s

def main():
    s1,s2,a,b,c=input().split()
    s1,s2,a,b,c=int(s1),int(s2),int(a),int(b),int(c)
    if(s1==0) and (s2==0) :
        y=f1(a,b,c)
        print(y)
    if(s1==0) and (s2==1) :
        y=f2(a,b,c)
        print(y)
    if(s1==1) and (s2==0) :
        y=f3(a,b,c)
        print(y)
    if(s1==1) and (s2==1) :
        y=f4(a,b,c)
        print(y)
    else:
      print ('Error')
exec(input().strip()) # DON'T remove this line
# 1642263, 2022-09-24 10:36:38, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    if a<=0 and b<=0:
        return c
    elif b<=0 and c<=0:
        return a
    elif a<=0 and c<=0:
        return b
    elif a<=0:
        if b<c:
            return b
        else:
            return c
    elif b<=0:
        if a<c:
            return a
        else:
            return c
    elif c<=0:
        if a<b:
            return a
        else:
            return b

def f2(a, b, c):
    if a>=0 and b>=0:
        return c
    elif b>=0 and c>=0:
        return a
    elif a>=0 and c>=0:
        return b
    elif a>=0:
        if b>c:
            return b
        else:
            return c
    elif b>=0:
        if a>c:
            return a
        else:
            return c
    elif c>=0:
        if a>b:
            return a
        else:
            return b

def f3(a, b, c):
    k=a+b+c
    k=abs(k)
    u=str(k)
    s=k//(10**(len(u)-1))
    return s

def f4(a, b, c):
    k=a+b+c
    k=abs(k)
    s=k%10
    return s

def main():
    s1,s2,a,b,c=input().split()
    s1,s2,a,b,c=int(s1),int(s2),int(a),int(b),int(c)
    if(s1==0) and (s2==0) :
        y=f1(a,b,c)
        print(y)
    elif(s1==0) and (s2==1) :
        y=f2(a,b,c)
        print(y)
    elif(s1==1) and (s2==0) :
        y=f3(a,b,c)
        print(y)
    elif(s1==1) and (s2==1) :
        y=f4(a,b,c)
        print(y)
    else:
      print ('Error')
exec(input().strip()) # DON'T remove this line

6430201321
# 1639135, 2022-09-24 09:23:01, Pxxx[xx][xxxx] (17%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for i in x:
        if i > 0:
            y.append(i)
    return min(y)
    
exec(input().strip()) # DON'T remove this line
# 1639176, 2022-09-24 09:23:58, compilation error (0%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for i in x:
        if i > 0:
            y.append(i)
    return min(y)
    
def f2(a, b, c):
        x = [a,b,c]
    y = []
    for i in x:
        if i < 0:
            y.append(i)
    return max(y)
    
exec(input().strip()) # DON'T remove this line
# 1639193, 2022-09-24 09:24:18, PPxx[xx][xxxx] (33%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for i in x:
        if i > 0:
            y.append(i)
    return min(y)
    
def f2(a, b, c):
    x = [a,b,c]
    y = []
    for i in x:
        if i < 0:
            y.append(i)
    return max(y)
    
exec(input().strip()) # DON'T remove this line
# 1639203, 2022-09-24 09:24:30, PPxx[xx][xxxx] (33%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for i in x:
        if i > 0:
            y.append(i)
    return min(y)
    
def f2(a, b, c):
    x = [a,b,c]
    y = []
    for i in x:
        if i < 0:
            y.append(i)
    return max(y)
    
exec(input().strip()) # DON'T remove this line
# 1639240, 2022-09-24 09:25:30, PP-x[xx][xxxx] (33%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for i in x:
        if i > 0:
            y.append(i)
    return min(y)
    
def f2(a, b, c):
    x = [a,b,c]
    y = []
    for i in x:
        if i < 0:
            y.append(i)
    return max(y)
    
def f3(a, b, c):
    x = a + b + c
    return str(x)[-1]
    
    
exec(input().strip()) # DON'T remove this line
# 1639284, 2022-09-24 09:26:14, PPx-[xx][xxxx] (33%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for i in x:
        if i > 0:
            y.append(i)
    return min(y)
    
def f2(a, b, c):
    x = [a,b,c]
    y = []
    for i in x:
        if i < 0:
            y.append(i)
    return max(y)
    
def f4(a, b, c):
    x = a + b + c
    return str(x)[-1]
    
    
exec(input().strip()) # DON'T remove this line
# 1639328, 2022-09-24 09:27:32, PP--[xx][xxxx] (33%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for i in x:
        if i > 0:
            y.append(i)
    return min(y)
    
def f2(a, b, c):
    x = [a,b,c]
    y = []
    for i in x:
        if i < 0:
            y.append(i)
    return max(y)
    
def f3(a, b, c):
    x = a + b + c
    if str(x)[0] != '-':
        return str(x)[0]
    else:
        return str(x)[1]
    
def f4(a, b, c):
    x = a + b + c
    return str(x)[-1]
    
    
exec(input().strip()) # DON'T remove this line
# 1639354, 2022-09-24 09:28:19, PP--[xx][xxxx] (33%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for i in x:
        if i > 0:
            y.append(i)
    return min(y)
    
def f2(a, b, c):
    x = [a,b,c]
    y = []
    for i in x:
        if i < 0:
            y.append(i)
    return max(y)
    
def f3(a, b, c):
    x = a + b + c
    if str(x)[0] != '-':
        return str(x)[0]
    else:
        return str(x)[1]
    
def f4(a, b, c):
    x = a + b + c
    return str(x)[-1]
    
    
exec(input().strip()) # DON'T remove this line
# 1639374, 2022-09-24 09:28:49, PPP-[xx][xxxx] (50%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for i in x:
        if i > 0:
            y.append(i)
    return min(y)
    
def f2(a, b, c):
    x = [a,b,c]
    y = []
    for i in x:
        if i < 0:
            y.append(i)
    return max(y)
    
def f3(a, b, c):
    x = a + b + c
    if str(x)[0] != '-':
        return int(str(x)[0])
    else:
        return int(str(x)[1])
    
def f4(a, b, c):
    x = a + b + c
    return str(x)[-1]
    
    
exec(input().strip()) # DON'T remove this line
# 1639380, 2022-09-24 09:29:01, PPPP[xx][xxxx] (67%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for i in x:
        if i > 0:
            y.append(i)
    return min(y)
    
def f2(a, b, c):
    x = [a,b,c]
    y = []
    for i in x:
        if i < 0:
            y.append(i)
    return max(y)
    
def f3(a, b, c):
    x = a + b + c
    if str(x)[0] != '-':
        return int(str(x)[0])
    else:
        return int(str(x)[1])
    
def f4(a, b, c):
    x = a + b + c
    return int(str(x)[-1])
    
    
exec(input().strip()) # DON'T remove this line
# 1639527, 2022-09-24 09:32:28, PPPP[PP][-P-P] (83%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for i in x:
        if i > 0:
            y.append(i)
    return min(y)
    
def f2(a, b, c):
    x = [a,b,c]
    y = []
    for i in x:
        if i < 0:
            y.append(i)
    return max(y)
    
def f3(a, b, c):
    x = a + b + c
    if str(x)[0] != '-':
        return int(str(x)[0])
    else:
        return int(str(x)[1])
    
def f4(a, b, c):
    x = a + b + c
    return int(str(x)[-1])
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 ==0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 ==1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    
exec(input().strip()) # DON'T remove this line
# 1639563, 2022-09-24 09:33:29, PPPP[PP][-P-P] (83%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for i in x:
        if i > 0:
            y.append(i)
    return min(y)
    
def f2(a, b, c):
    x = [a,b,c]
    y = []
    for i in x:
        if i < 0:
            y.append(i)
    return max(y)
    
def f3(a, b, c):
    x = a + b + c
    if str(x)[0] != '-':
        return int(str(x)[0])
    else:
        return int(str(x)[1])
    
def f4(a, b, c):
    x = a + b + c
    return int(str(x)[-1])
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 ==0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 ==1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Erorr')
    
    
exec(input().strip()) # DON'T remove this line
# 1639580, 2022-09-24 09:33:52, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for i in x:
        if i > 0:
            y.append(i)
    return min(y)
    
def f2(a, b, c):
    x = [a,b,c]
    y = []
    for i in x:
        if i < 0:
            y.append(i)
    return max(y)
    
def f3(a, b, c):
    x = a + b + c
    if str(x)[0] != '-':
        return int(str(x)[0])
    else:
        return int(str(x)[1])
    
def f4(a, b, c):
    x = a + b + c
    return int(str(x)[-1])
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 ==0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 ==1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
    
    
exec(input().strip()) # DON'T remove this line

6530015021
# 1639085, 2022-09-24 09:21:47, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    x = [a,b,c]
    for i in x:
        if i<=0:
            x.remove(i)
    return min(x)
def f2(a, b, c):
    x = [a,b,c]
    for i in x:
        if i >=0:
            x.remove(i)
    return max(x)
def f3(a, b, c):
    x = a+b+c
    x = str(abs(x))
    x = x[0]
    return int(x)
def f4(a, b, c):
    x = a+b+c
    x = str(abs(x))
    x = x[-1]
    return int(x)    
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2 ==0:
        print(f1(a,b,c))
    elif s1==0 and s2 ==1:
        print(f2(a,b,c))
    elif s1==1 and s2 ==0:
        print(f3(a,b,c))
    elif s1==1 and s2 ==1:
        print(f4(a,b,c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line


# 1639231, 2022-09-24 09:25:10, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    x = [a,b,c]
    for i in x:
        if i<=0:
            x.remove(i)
    return int(min(x))
def f2(a, b, c):
    x = [a,b,c]
    for i in x:
        if i >=0:
            x.remove(i)
    return int(max(x))
def f3(a, b, c):
    x = a+b+c
    x = str(abs(x))
    x = x[0]
    return int(x)
def f4(a, b, c):
    x = a+b+c
    x = str(abs(x))
    x = x[-1]
    return int(x)    
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2 ==0:
        print(f1(a,b,c))
    elif s1==0 and s2 ==1:
        print(f2(a,b,c))
    elif s1==1 and s2 ==0:
        print(f3(a,b,c))
    elif s1==1 and s2 ==1:
        print(f4(a,b,c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line


# 1639886, 2022-09-24 09:41:50, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    x = [a,b,c]
    for i in x:
        if i<=0:
            x.remove(i)
    return int(min(x))
def f2(a, b, c):
    x = [a,b,c]
    for i in x:
        if i >=0:
            x.remove(i)
    return int(max(x))
def f3(a, b, c):
    x = a+b+c
    x = str(abs(int(x)))
    x = x[0]
    return int(x)
def f4(a, b, c):
    x = a+b+c
    x = str(abs(int(x)))
    x = x[-1]
    return int(x)    
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2 ==0:
        print(f1(a,b,c))
    elif s1==0 and s2 ==1:
        print(f2(a,b,c))
    elif s1==1 and s2 ==0:
        print(f3(a,b,c))
    elif s1==1 and s2 ==1:
        print(f4(a,b,c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line


# 1639910, 2022-09-24 09:42:43, -xPP[-x][PPPP] (50%)

def f1(a, b, c):
    x = [a,b,c]
    f = []
    for i in x:
        if i<=0:
            f.append(i)
    return int(min(f))
def f2(a, b, c):
    x = [a,b,c]
    for i in x:
        if i >=0:
            f.append(i)
    return int(max(f))
def f3(a, b, c):
    x = a+b+c
    x = str(abs(int(x)))
    x = x[0]
    return int(x)
def f4(a, b, c):
    x = a+b+c
    x = str(abs(int(x)))
    x = x[-1]
    return int(x)    
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2 ==0:
        print(f1(a,b,c))
    elif s1==0 and s2 ==1:
        print(f2(a,b,c))
    elif s1==1 and s2 ==0:
        print(f3(a,b,c))
    elif s1==1 and s2 ==1:
        print(f4(a,b,c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line
# 1639926, 2022-09-24 09:43:15, PxPP[Px][PPPP] (67%)

def f1(a, b, c):
    x = [a,b,c]
    f = []
    for i in x:
        if i>0:
            f.append(i)
    return int(min(f))
def f2(a, b, c):
    x = [a,b,c]
    for i in x:
        if i <0:
            f.append(i)
    return int(max(f))
def f3(a, b, c):
    x = a+b+c
    x = str(abs(int(x)))
    x = x[0]
    return int(x)
def f4(a, b, c):
    x = a+b+c
    x = str(abs(int(x)))
    x = x[-1]
    return int(x)    
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2 ==0:
        print(f1(a,b,c))
    elif s1==0 and s2 ==1:
        print(f2(a,b,c))
    elif s1==1 and s2 ==0:
        print(f3(a,b,c))
    elif s1==1 and s2 ==1:
        print(f4(a,b,c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line
# 1639958, 2022-09-24 09:44:06, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    x = [a,b,c]
    for i in x:
        if i<=0:
            x.remove(i)
    return int(min(x))
def f2(a, b, c):
    x = [a,b,c]
    for i in x:
        if i >=0:
            x.remove(i)
    return int(max(x))
def f3(a, b, c):
    x = a+b+c
    x = str(abs(int(x)))
    x = x[0]
    return int(x)
def f4(a, b, c):
    x = a+b+c
    x = str(abs(int(x)))
    x = x[-1]
    return int(x)    
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2 ==0:
        print(f1(a,b,c))
    elif s1==0 and s2 ==1:
        print(f2(a,b,c))
    elif s1==1 and s2 ==0:
        print(f3(a,b,c))
    elif s1==1 and s2 ==1:
        print(f4(a,b,c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line


# 1640020, 2022-09-24 09:46:05, PxPP[Px][PPPP] (67%)

def f1(a, b, c):
    x = [a,b,c]
    f = []
    for i in x:
        if i>0:
            f.append(i)
    return min(f)
def f2(a, b, c):
    x = [a,b,c]
    for i in x:
        if i <0:
            f.append(i)
    return max(f)
def f3(a, b, c):
    x = a+b+c
    x = str(abs(int(x)))
    x = x[0]
    return int(x)
def f4(a, b, c):
    x = a+b+c
    x = str(abs(int(x)))
    x = x[-1]
    return int(x)    
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2 ==0:
        print(f1(a,b,c))
    elif s1==0 and s2 ==1:
        print(f2(a,b,c))
    elif s1==1 and s2 ==0:
        print(f3(a,b,c))
    elif s1==1 and s2 ==1:
        print(f4(a,b,c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line

# 66 [ PxPP[Px][PPPP] ] 

# 1640247, 2022-09-24 09:52:05, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    x = [a,b,c]
    for i in x:
        if i<=0:
            x.remove(i)
    return int(min(x))
def f2(a, b, c):
    x = [a,b,c]
    for i in x:
        if i >=0:
            x.remove(i)
    return int(max(x))
def f3(a, b, c):
    x = a+b+c
    x = str(abs(int(x)))
    x = x[0]
    return int(x)
def f4(a, b, c):
    x = a+b+c
    x = str(abs(int(x)))
    x = x[-1]
    return int(x)    
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2 ==0:
        print(f1(a,b,c))
    elif s1==0 and s2 ==1:
        print(f2(a,b,c))
    elif s1==1 and s2 ==0:
        print(f3(a,b,c))
    elif s1==1 and s2 ==1:
        print(f4(a,b,c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line

#66 [ --PP[PP][PPPP] ] 

# 1640364, 2022-09-24 09:55:48, -xP-[-x][PPPP] (33%)

def f1(a, b, c):
    x = [a,b,c]
    f1 = []
    for i in x:
        if i>0:
            f1.append(i)
    return int(min(x))
def f2(a, b, c):
    y = [a,b,c]
    f2 = []
    for e in y:
        if e < 0:
            f2.append(i)
    return int(max(x))
def f3(a, b, c):
    x = a+b+c
    x = str(abs(int(x)))
    x = x[0]
    return int(x)
def f4(a, b, c):
    x = a+b+c
    x %= 10
    return int(x)    
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2 ==0:
        print(f1(a,b,c))
    elif s1==0 and s2 ==1:
        print(f2(a,b,c))
    elif s1==1 and s2 ==0:
        print(f3(a,b,c))
    elif s1==1 and s2 ==1:
        print(f4(a,b,c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line

#66 [ --PP[PP][PPPP] ] 

# 1640384, 2022-09-24 09:56:15, -xPP[-x][PPPP] (50%)

def f1(a, b, c):
    x = [a,b,c]
    f1 = []
    for i in x:
        if i>0:
            f1.append(i)
    return int(min(x))
def f2(a, b, c):
    y = [a,b,c]
    f2 = []
    for e in y:
        if e < 0:
            f2.append(i)
    return int(max(x))
def f3(a, b, c):
    x = a+b+c
    x = str(abs(int(x)))
    x = x[0]
    return int(x)
def f4(a, b, c):
    x = a+b+c
    x = str(abs(int(x)))
    x = x[-1]
    return int(x)    
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2 ==0:
        print(f1(a,b,c))
    elif s1==0 and s2 ==1:
        print(f2(a,b,c))
    elif s1==1 and s2 ==0:
        print(f3(a,b,c))
    elif s1==1 and s2 ==1:
        print(f4(a,b,c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line

#66 [ --PP[PP][PPPP] ] 

# 1640396, 2022-09-24 09:56:44, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    x = [a,b,c]
    for i in x:
        if i<=0:
            x.remove(i)
    return int(min(x))
def f2(a, b, c):
    x = [a,b,c]
    for i in x:
        if i >=0:
            x.remove(i)
    return int(max(x))
def f3(a, b, c):
    x = a+b+c
    x = str(abs(int(x)))
    x = x[0]
    return int(x)
def f4(a, b, c):
    x = a+b+c
    x = str(abs(int(x)))
    x = x[-1]
    return int(x)    
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2 ==0:
        print(f1(a,b,c))
    elif s1==0 and s2 ==1:
        print(f2(a,b,c))
    elif s1==1 and s2 ==0:
        print(f3(a,b,c))
    elif s1==1 and s2 ==1:
        print(f4(a,b,c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line



# 1641104, 2022-09-24 10:15:26, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    x = [a,b,c]
    for i in x:
        if i<=0:
            x.remove(i)
    return min(x)

def f2(a, b, c):
    x = [a,b,c]
    for i in x:
        if i >=0:
            x.remove(i)
    return max(x)

def f3(a, b, c):
    x = abs(a+b+c)
    y = str(x)[0]
    return int(y)

def f4(a, b, c):
    x = abs(a+b+c)
    y = str(x)[-1]
    return int(y)    
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2 ==0:
        print(f1(a,b,c))
    elif s1==0 and s2 ==1:
        print(f2(a,b,c))
    elif s1==1 and s2 ==0:
        print(f3(a,b,c))
    elif s1==1 and s2 ==1:
        print(f4(a,b,c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line



# 1641149, 2022-09-24 10:16:28, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    x = [a,b,c]
    f = []
    for i in x:
        if i>0:
            f.append(i)
    return min(f)

def f2(a, b, c):
    x = [a,b,c]
    f = []
    for i in x:
        if i<0:
            f.append(i)
    return max(f)

def f3(a, b, c):
    x = abs(a+b+c)
    y = str(x)[0]
    return int(y)

def f4(a, b, c):
    x = abs(a+b+c)
    y = str(x)[-1]
    return int(y)    
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2 ==0:
        print(f1(a,b,c))
    elif s1==0 and s2 ==1:
        print(f2(a,b,c))
    elif s1==1 and s2 ==0:
        print(f3(a,b,c))
    elif s1==1 and s2 ==1:
        print(f4(a,b,c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line




6530067721
# 1639932, 2022-09-24 09:43:29, ---P[--][P-P-] (17%)

def f1(a, b, c):
    return min(a,b,c)
def f2(a, b, c):
    return max(a,b,c)
def f3(a, b, c):
    su = a+b+c
    d = 0
    if su <= 0:
        su = abs(su)
        d += 1
    else:
        d += 1
    return d
def f4(a, b, c):
    cu = a+b+c
    if cu <= 0:
        cu = abs(cu)
    else:
        pass
    full = cu%10
    return full
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a ,b, c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line
# 1640232, 2022-09-24 09:51:43, ---P[--][PPPP] (33%)

def f1(a, b, c):
    return min(a,b,c)
def f2(a, b, c):
    return max(a,b,c)
def f3(a, b, c):
    f = a+b+c
    if f <= 0:
        f = abs(f)
    f = str(f)
    d = str(f[0])
    return d
def f4(a, b, c):
    cu = a+b+c
    if cu <= 0:
        cu = abs(cu)
    else:
        pass
    full = cu%10
    return full
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a ,b, c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line
# 1640264, 2022-09-24 09:52:28, --PP[--][PPPP] (50%)

def f1(a, b, c):
    return min(a,b,c)
def f2(a, b, c):
    return max(a,b,c)
def f3(a, b, c):
    f = a+b+c
    if f <= 0:
        f = abs(f)
    f = str(f)
    d = str(f[0])
    d = int(d)
    return d
def f4(a, b, c):
    cu = a+b+c
    if cu <= 0:
        cu = abs(cu)
    else:
        pass
    full = cu%10
    return full
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a ,b, c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line
# 1640339, 2022-09-24 09:54:55, --PP[--][PPPP] (50%)

def f1(a, b, c):
    return min(a,b,c)
def f2(a, b, c):
    return max(a,b,c)
def f3(a, b, c):
    f = a+b+c
    if f <= 0:
        f = abs(f)
    f = str(f)
    d = str(f[0])
    d = int(d)
    return d
def f4(a, b, c):
    cu = a+b+c
    if cu <= 0:
        cu = abs(cu)
    else:
        pass
    full = cu%10
    full = int(full)
    return full
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a ,b, c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line
# 1640380, 2022-09-24 09:56:10, --PP[--][PPPP] (50%)

def f1(a, b, c):
    return min(a,b,c)
def f2(a, b, c):
    return max(a,b,c)
def f3(a, b, c):
    f = a+b+c
    if f <= 0:
        f = abs(f)
    f = str(f)
    d = f[0]
    d = int(d)
    return d
def f4(a, b, c):
    cu = a+b+c
    if cu <= 0:
        cu = abs(cu)
    else:
        pass
    full = cu%10
    full = int(full)
    return full
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a ,b, c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line
# 1640391, 2022-09-24 09:56:35, --PP[--][PPPP] (50%)

def f1(a, b, c):
    return min(a,b,c)
def f2(a, b, c):
    return max(a,b,c)
def f3(a, b, c):
    f = a+b+c
    if f <= 0:
        f = abs(f)
    else:
      pass
    f = str(f)
    d = f[0]
    d = int(d)
    return d
def f4(a, b, c):
    cu = a+b+c
    if cu <= 0:
        cu = abs(cu)
    else:
        pass
    full = cu%10
    full = int(full)
    return full
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a ,b, c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line
# 1640476, 2022-09-24 09:58:51, ---P[--][PPPP] (33%)

def f1(a, b, c):
    return min(a,b,c)
def f2(a, b, c):
    return max(a,b,c)
def f3(a, b, c):
    f = a+b+c
    if f <= 0:
        f = abs(f)
    else:
      pass
    f = str(f)[0]
    
    return f
def f4(a, b, c):
    cu = a+b+c
    if cu <= 0:
        cu = abs(cu)
    else:
        pass
    full = cu%10
    full = int(full)
    return full
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a ,b, c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line
# 1640488, 2022-09-24 09:59:06, --PP[--][PPPP] (50%)

def f1(a, b, c):
    return min(a,b,c)
def f2(a, b, c):
    return max(a,b,c)
def f3(a, b, c):
    f = a+b+c
    if f <= 0:
        f = abs(f)
    else:
      pass
    f = str(f)[0]
    f = int(f)
    return f
def f4(a, b, c):
    cu = a+b+c
    if cu <= 0:
        cu = abs(cu)
    else:
        pass
    full = cu%10
    full = int(full)
    return full
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a ,b, c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line
# 1640914, 2022-09-24 10:10:19, --PP[P-][PPPP] (50%)

def f1(a, b, c):
    if a < 0:
        a = abs(a)
    if b < 0:
        b = abs(b)
    if c < 0:
        c = abs(c)
    return min(a,b,c)
def f2(a, b, c):
    return max(a,b,c)
def f3(a, b, c):
    f = a+b+c
    if f <= 0:
        f = abs(f)
    else:
      pass
    f = str(f)[0]
    f = int(f)
    return f
def f4(a, b, c):
    cu = a+b+c
    if cu <= 0:
        cu = abs(cu)
    else:
        pass
    full = cu%10
    full = int(full)
    return full
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a ,b, c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line
# 1641387, 2022-09-24 10:21:11, --PP[P-][PPPP] (50%)

def f1(a, b, c):
    ku = []
    if a > 0:
        ku += str(a) 
    if b > 0:
        ku += str(b)
    if c > 0:
        ku += str(c)
    
    return min(ku)  
def f2(a, b, c):
    return max(a,b,c)
def f3(a, b, c):
    f = a+b+c
    if f <= 0:
        f = abs(f)
    else:
      pass
    f = str(f)[0]
    f = int(f)
    return f
def f4(a, b, c):
    cu = a+b+c
    if cu <= 0:
        cu = abs(cu)
    else:
        pass
    full = cu%10
    full = int(full)
    return full
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a ,b, c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line
# 1642027, 2022-09-24 10:33:14, P-PP[P-][PPPP] (67%)

def f1(a, b, c):
    ku = []
    if a > 0:
        ku.append(a)
    if b > 0:
        ku.append(b)
    if c > 0:
        ku.append(c)
    
    return min(ku)  
def f2(a, b, c):
    return max(a,b,c)
def f3(a, b, c):
    f = a+b+c
    if f <= 0:
        f = abs(f)
    else:
      pass
    f = str(f)[0]
    f = int(f)
    return f
def f4(a, b, c):
    cu = a+b+c
    if cu <= 0:
        cu = abs(cu)
    else:
        pass
    full = cu%10
    full = int(full)
    return full
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a ,b, c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line
# 1642100, 2022-09-24 10:34:20, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    ku = []
    if a > 0:
        ku.append(a)
    if b > 0:
        ku.append(b)
    if c > 0:
        ku.append(c)
    
    return min(ku)  
def f2(a, b, c):
    gu = []
    if a < 0:
        gu.append(a)
    if b < 0:
        gu.append(b)
    if c < 0:
        gu.append(c)
    return max(gu)
    
def f3(a, b, c):
    f = a+b+c
    if f <= 0:
        f = abs(f)
    else:
      pass
    f = str(f)[0]
    f = int(f)
    return f
def f4(a, b, c):
    cu = a+b+c
    if cu <= 0:
        cu = abs(cu)
    else:
        pass
    full = cu%10
    full = int(full)
    return full
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a ,b, c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line

6530003521
# 1639496, 2022-09-24 09:31:41, ---P[PP][P-P-] (33%)

def f1(a,b,c) :
    x = [a,b,c]
    for e in x :
        if e <=  0 :
            x.remove(e)
    return min(x)
def f2(a,b,c) :
    y = [a,b,c]
    for k in y :
            if k >= 0 :
                y.remove(k)
    return max(y)
def f3(a,b,c) :
    g = a+b+c
    return abs(g//(10**len(str(g))-1))
def f4(a,b,c) :
    l = a+b+c
    return abs(l)%10
def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1==0 and s2==1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 ==1 and s2 == 1 :
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line
        
# 1639980, 2022-09-24 09:44:32, ---P[PP][P-P-] (33%)

def f1(a,b,c) :
    x = [a,b,c]
    for e in x :
        if e <=  0 :
            x.remove(e)
    return min(x)
def f2(a,b,c) :
    y = [a,b,c]
    for k in y :
            if k >= 0 :
                y.remove(k)
    return max(y)
def f3(a,b,c) :
    g = a+b+c
    return abs(g//((10**len(str(g))-1)))
def f4(a,b,c) :
    l = a+b+c
    return abs(l)%10
def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1==0 and s2==1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 ==1 and s2 == 1 :
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line
        
# 1640040, 2022-09-24 09:46:32, --PP[PP][PPPP] (67%)

def f1(a,b,c) :
    x = [a,b,c]
    for e in x :
        if e <=  0 :
            x.remove(e)
    return min(x)
def f2(a,b,c) :
    y = [a,b,c]
    for k in y :
            if k >= 0 :
                y.remove(k)
    return max(y)
def f3(a,b,c) :
    g = a+b+c
    return  abs(g)//(10**(len(str(abs(g)))-1))
def f4(a,b,c) :
    l = a+b+c
    return abs(l)%10
def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1==0 and s2==1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 ==1 and s2 == 1 :
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line
# 1640567, 2022-09-24 10:01:10, xx-P[xx][P-P-] (17%)

def f1(a,b,c) :
    x = [a,b,c]
    m = []
    for e in a :
        if e >  0 :
            m.append(e)
    return min(m)
def f2(a,b,c) :
    y = [a,b,c]
    n = []
    for k in y :
            if k < 0 :
                yn.append(k)
    return max(y)
def f3(a,b,c) :
    g = a+b+c
    return abs(g//((10**len(str(g))-1)))
def f4(a,b,c) :
    l = a+b+c
    return abs(l)%10
def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1==0 and s2==1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 ==1 and s2 == 1 :
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line
        
# 1640582, 2022-09-24 10:01:40, xx-P[xx][P-P-] (17%)

def f1(a,b,c) :
    x = [a,b,c]
    m = []
    for e in a :
        if e >  0 :
            m.append(e)
    return min(m)
def f2(a,b,c) :
    y = [a,b,c]
    n = []
    for k in y :
            if k < 0 :
                yn.append(k)
    return max(n)
def f3(a,b,c) :
    g = a+b+c
    return abs(g//((10**len(str(g))-1)))
def f4(a,b,c) :
    l = a+b+c
    return abs(l)%10
def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1==0 and s2==1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 ==1 and s2 == 1 :
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line
# 1640591, 2022-09-24 10:01:57, xP-P[xP][P-P-] (33%)

def f1(a,b,c) :
    x = [a,b,c]
    m = []
    for e in a :
        if e >  0 :
            m.append(e)
    return min(m)
def f2(a,b,c) :
    y = [a,b,c]
    n = []
    for k in y :
            if k < 0 :
                n.append(k)
    return max(n)
def f3(a,b,c) :
    g = a+b+c
    return abs(g//((10**len(str(g))-1)))
def f4(a,b,c) :
    l = a+b+c
    return abs(l)%10
def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1==0 and s2==1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 ==1 and s2 == 1 :
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line
# 1640611, 2022-09-24 10:02:29, xP-P[xP][P-P-] (33%)

def f1(a,b,c) :
    x = [a,b,c]
    m = []
    for e in a :
        if e >  0 :
            m.append(e)
    return min(m)
def f2(a,b,c) :
    y = [a,b,c]
    n = []
    for k in y :
        if k < 0 :
            n.append(k)
    return max(n)
def f3(a,b,c) :
    g = a+b+c
    return abs(g//((10**len(str(g))-1)))
def f4(a,b,c) :
    l = a+b+c
    return abs(l)%10
def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1==0 and s2==1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 ==1 and s2 == 1 :
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line
# 1640637, 2022-09-24 10:03:13, PP-P[PP][P-P-] (67%)

def f1(a,b,c) :
    x = [a,b,c]
    m = []
    for e in x :
        if e >  0 :
            m.append(e)
    return min(m)
def f2(a,b,c) :
    y = [a,b,c]
    n = []
    for k in y :
        if k < 0 :
            n.append(k)
    return max(n)
def f3(a,b,c) :
    g = a+b+c
    return abs(g//((10**len(str(g))-1)))
def f4(a,b,c) :
    l = a+b+c
    return abs(l)%10
def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1==0 and s2==1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 ==1 and s2 == 1 :
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line
# 1640888, 2022-09-24 10:09:32, PP-P[PP][P-P-] (67%)

def f1(a,b,c) :
    x = [a,b,c]
    m = []
    for e in x :
        if e >  0 :
            m.append(e)
    return min(m)
def f2(a,b,c) :
    y = [a,b,c]
    n = []
    for k in y :
            if k < 0 :
                n.append(k)
    return max(n)
def f3(a,b,c) :
    g = a+b+c
    return abs(g)//(10**len(str(g))-1)
def f4(a,b,c) :
    l = a+b+c
    return abs(l)%10
def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1==0 and s2==1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 ==1 and s2 == 1 :
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line
        
# 1640896, 2022-09-24 10:09:51, PP-P[PP][PPP-] (67%)

def f1(a,b,c) :
    x = [a,b,c]
    m = []
    for e in x :
        if e >  0 :
            m.append(e)
    return min(m)
def f2(a,b,c) :
    y = [a,b,c]
    n = []
    for k in y :
            if k < 0 :
                n.append(k)
    return max(n)
def f3(a,b,c) :
    g = a+b+c
    return abs(g)//(10**(len(str(g))-1))
def f4(a,b,c) :
    l = a+b+c
    return abs(l)%10
def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1==0 and s2==1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 ==1 and s2 == 1 :
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line
# 1640939, 2022-09-24 10:10:49, PPPP[PP][PPPP] (100%)

def f1(a,b,c) :
    x = [a,b,c]
    m = []
    for e in x :
        if e >  0 :
            m.append(e)
    return min(m)
def f2(a,b,c) :
    y = [a,b,c]
    n = []
    for k in y :
            if k < 0 :
                n.append(k)
    return max(n)
def f3(a,b,c) :
    g = a+b+c
    return abs(g)//(10**(len(str(abs(g)))-1))
def f4(a,b,c) :
    l = a+b+c
    return abs(l)%10
def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1==0 and s2==1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 ==1 and s2 == 1 :
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

6530116821
# 1639364, 2022-09-24 09:28:36, PPxx[PP][PxPx] (50%)

def f1(a, b, c):
    x=[]
    for i in [int(a),int(b),int(c)]:
        if i>0:
            x.append(i)
    return min(x)
def f2(a, b, c):
    x=[]
    for i in [int(a),int(b),int(c)]:
        if i<0:
            x.append(i)
    return max(x)
def f3(a, b, c):
    s=str(abs(sum(a,b,c)))
    return s[1]
    
def f4(a, b, c):
    s=str(abs(sum(a,b,c)))
    return s[-1]
def main():
    s1,s2,a,b,c= [int(e) for e in input().split()]

    if s1==0 and s2==0:
        return print(f1(a,b,c))
    if s1==0 and s2==1:
        return print(f2(a,b,c))
    if s1==1 and s2==0:
        return print(f3(a,b,c))
    if s1==1 and s2==1:
        return print(f4(a,b,c))
    else:
        return print('Error')
exec(input().strip()) # DON'T remove this line
# 1639486, 2022-09-24 09:31:31, PPxx[PP][P-P-] (50%)

def f1(a, b, c):
    x=[]
    for i in [int(a),int(b),int(c)]:
        if i>0:
            x.append(i)
    return min(x)
def f2(a, b, c):
    x=[]
    for i in [int(a),int(b),int(c)]:
        if i<0:
            x.append(i)
    return max(x)
def f3(a, b, c):
    s=str(abs(a+b+c))
    return s[1]
    
def f4(a, b, c):
    s=str(abs(sum(a,b,c)))
    return s[-1]
def main():
    s1,s2,a,b,c= [int(e) for e in input().split()]

    if s1==0 and s2==0:
        return print(f1(a,b,c))
    if s1==0 and s2==1:
        return print(f2(a,b,c))
    if s1==1 and s2==0:
        return print(f3(a,b,c))
    if s1==1 and s2==1:
        return print(f4(a,b,c))
    else:
        return print('Error')
exec(input().strip()) # DON'T remove this line
# 1639601, 2022-09-24 09:34:30, PPx-[PP][P-P-] (50%)

def f1(a, b, c):
    x=[]
    for i in [int(a),int(b),int(c)]:
        if i>0:
            x.append(i)
    return min(x)
def f2(a, b, c):
    x=[]
    for i in [int(a),int(b),int(c)]:
        if i<0:
            x.append(i)
    return max(x)
def f3(a, b, c):
    s=str(abs(a+b+c))
    return s[1]
    
def f4(a, b, c):
    s=str(abs(a+b+c))
    return s[-1]
def main():
    s1,s2,a,b,c= [int(e) for e in input().split()]

    if s1==0 and s2==0:
        return print(f1(a,b,c))
    if s1==0 and s2==1:
        return print(f2(a,b,c))
    if s1==1 and s2==0:
        return print(f3(a,b,c))
    if s1==1 and s2==1:
        return print(f4(a,b,c))
    else:
        return print('Error')
exec(input().strip()) # DON'T remove this line
# 1639904, 2022-09-24 09:42:36, --x-[PP][P-P-] (17%)

def f1(a, b, c):
    x=[]
    for i in [int(a),int(b),int(c)]:
        if i>=0:
            x.append(i)
    return min(x)
def f2(a, b, c):
    x=[]
    for i in [int(a),int(b),int(c)]:
        if i<=0:
            x.append(i)
    return max(x)
def f3(a, b, c):
    s=str(abs(a+b+c))
    return s[1]
    
def f4(a, b, c):
    s=str(abs(a+b+c))
    return s[-1]
def main():
    s1,s2,a,b,c= [int(e) for e in input().split()]

    if s1==0 and s2==0:
        return print(f1(a,b,c))
    if s1==0 and s2==1:
        return print(f2(a,b,c))
    if s1==1 and s2==0:
        return print(f3(a,b,c))
    if s1==1 and s2==1:
        return print(f4(a,b,c))
    else:
        return print('Error')
exec(input().strip()) # DON'T remove this line
# 1640085, 2022-09-24 09:47:47, PPx-[PP][P-P-] (50%)

def f1(a, b, c):
    x=[]
    for i in [int(a),int(b),int(c)]:
        if i>0:
            x.append(i)
    return min(x)
def f2(a, b, c):
    x=[]
    for i in [int(a),int(b),int(c)]:
        if i<0:
            x.append(i)
    return max(x)
def f3(a, b, c):
    s=str(abs(a+b+c))
    return s[1]
    
def f4(a, b, c):
    s=str(abs(a+b+c))
    return s[-1]
def main():
    s1,s2,a,b,c= [int(e) for e in input().split()]

    if s1==0 and s2==0:
        return print(f1(a,b,c))
    if s1==0 and s2==1:
        return print(f2(a,b,c))
    if s1==1 and s2==0:
        return print(f3(a,b,c))
    if s1==1 and s2==1:
        return print(f4(a,b,c))
    else:
        return print('Error')
exec(input().strip()) # DON'T remove this line
# 1640163, 2022-09-24 09:50:02, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x=[]
    for i in [int(a),int(b),int(c)]:
        if i>0:
            x.append(i)
    return min(x)
def f2(a, b, c):
    x=[]
    for i in [int(a),int(b),int(c)]:
        if i<0:
            x.append(i)
    return max(x)
def f3(a, b, c):
    s=str(abs(a+b+c))
    return s[0]
    
def f4(a, b, c):
    s=str(abs(a+b+c))
    return s[-1]
def main():
    s1,s2,a,b,c= [int(e) for e in input().split()]

    if s1==0 and s2==0:
        return print(f1(a,b,c))
    if s1==0 and s2==1:
        return print(f2(a,b,c))
    if s1==1 and s2==0:
        return print(f3(a,b,c))
    if s1==1 and s2==1:
        return print(f4(a,b,c))
    else:
        return print('Error')
exec(input().strip()) # DON'T remove this line
# 1640557, 2022-09-24 10:00:52, P---[P-][PPPP] (33%)

def f1(a, b, c):
    x=[]
    for i in [int(a),int(b),int(c)]:
        if i>0:
            x.append(i)
    return abs(min(x))
def f2(a, b, c):
    x=[]
    for i in [int(a),int(b),int(c)]:
        if i<0:
            x.append(i)
    return abs(max(x))
def f3(a, b, c):
    s=str(abs(a+b+c))
    return s[0]
    
def f4(a, b, c):
    s=str(abs(a+b+c))
    return s[-1]
def main():
    s1,s2,a,b,c= [int(e) for e in input().split()]

    if s1==0 and s2==0:
        return print(f1(a,b,c))
    if s1==0 and s2==1:
        return print(f2(a,b,c))
    if s1==1 and s2==0:
        return print(f3(a,b,c))
    if s1==1 and s2==1:
        return print(f4(a,b,c))
    else:
        return print('Error')
exec(input().strip()) # DON'T remove this line
# 1640568, 2022-09-24 10:01:12, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x=[]
    for i in [int(a),int(b),int(c)]:
        if i>0:
            x.append(i)
    return min(x)
def f2(a, b, c):
    x=[]
    for i in [int(a),int(b),int(c)]:
        if i<0:
            x.append(i)
    return max(x)
def f3(a, b, c):
    s=str(abs(a+b+c))
    return s[0]
    
def f4(a, b, c):
    s=str(abs(a+b+c))
    return s[-1]
def main():
    s1,s2,a,b,c= [int(e) for e in input().split()]

    if s1==0 and s2==0:
        return print(f1(a,b,c))
    if s1==0 and s2==1:
        return print(f2(a,b,c))
    if s1==1 and s2==0:
        return print(f3(a,b,c))
    if s1==1 and s2==1:
        return print(f4(a,b,c))
    else:
        return print('Error')
exec(input().strip()) # DON'T remove this line
# 1640893, 2022-09-24 10:09:38, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x=[]
    for i in [int(a),int(b),int(c)]:
        if i>0:
            x.append(i)
    return min(x)
def f2(a, b, c):
    x=[]
    for i in [int(a),int(b),int(c)]:
        if i<0:
            x.append(i)
    return max(x)
def f3(a, b, c):
    s=str(abs(a+b+c))
    return s[0]
    
def f4(a, b, c):
    s=str(abs(a+b+c))
    return s[-1]
def main():
    x=input().split()
    s1=int(x[0])
    s2=int(x[1])
    a=int(x[2])
    b=int(x[3])
    c=int(x[4])
    if s1==0 and s2==0:
        return print(f1(a,b,c))
    if s1==0 and s2==1:
        return print(f2(a,b,c))
    if s1==1 and s2==0:
        return print(f3(a,b,c))
    if s1==1 and s2==1:
        return print(f4(a,b,c))
    else:
        return print('Error')
exec(input().strip()) # DON'T remove this line
# 1641849, 2022-09-24 10:29:55, compilation error (0%)

def f1(a, b, c):
    x=[]
    for i in [int(a),int(b),int(c)]:
        if i>0:
            x.append(i)
    return min(x)
def f2(a, b, c):
    x=[]
    for i in [int(a),int(b),int(c)]:
        if i<0:
            x.append(i)
    return max(x)
def f3(a, b, c):
    s=str(abs(a+b+c))
    return int(s[0])
    
def f4(a, b, c):
    s=str(abs(a+b+c))
    return int(s[-1]0
def main():
    x=input().split()
    s1=int(x[0])
    s2=int(x[1])
    a=int(x[2])
    b=int(x[3])
    c=int(x[4])
    if s1==0 and s2==0:
        return print(f1(a,b,c))
    if s1==0 and s2==1:
        return print(f2(a,b,c))
    if s1==1 and s2==0:
        return print(f3(a,b,c))
    if s1==1 and s2==1:
        return print(f4(a,b,c))
    else:
        return print('Error')
exec(input().strip()) # DON'T remove this line
# 1641862, 2022-09-24 10:30:08, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    x=[]
    for i in [int(a),int(b),int(c)]:
        if i>0:
            x.append(i)
    return min(x)
def f2(a, b, c):
    x=[]
    for i in [int(a),int(b),int(c)]:
        if i<0:
            x.append(i)
    return max(x)
def f3(a, b, c):
    s=str(abs(a+b+c))
    return int(s[0])
    
def f4(a, b, c):
    s=str(abs(a+b+c))
    return int(s[-1])
def main():
    x=input().split()
    s1=int(x[0])
    s2=int(x[1])
    a=int(x[2])
    b=int(x[3])
    c=int(x[4])
    if s1==0 and s2==0:
        return print(f1(a,b,c))
    if s1==0 and s2==1:
        return print(f2(a,b,c))
    if s1==1 and s2==0:
        return print(f3(a,b,c))
    if s1==1 and s2==1:
        return print(f4(a,b,c))
    else:
        return print('Error')
exec(input().strip()) # DON'T remove this line

6530140821
# 1639074, 2022-09-24 09:21:35, --x-[--][P-P-] (0%)

def f1(a, b, c):
    return min(a,b,c)
def f2(a, b, c):
    return max(a,b,c)
def f3(a, b, c):
    a = str(a)
    b= str(b)
    c=str(c)
    z = int(a[0]) + int(b[0]) + int(c[0])
    return z
def f4(a, b, c):
    a = str(a)
    b= str(b)
    c=str(c)
    n = int(a[-1]) + int(b[-1]) + int(c[-1])
    return n
def main():
    s1,s2,a,b,c = input().split()
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip())
# 1639333, 2022-09-24 09:27:48, xxx-[--][P-P-] (0%)

def f1(a, b, c):
    if a <=0 and b>0 and c>0:
        return min(b,c)
    if a >0 and b<=0 and c>0:
        return min(a,c)
    if a >0 and b>0 and c<=0:
        return min(a,b)
    if a <=0 and b<=0 and c>0:
        return min(c)
    if a >0 and b<=0 and c<=0:
        return min(a)
    if a <=0 and b>0 and c<=0:
        return min(b)
def f2(a, b, c):
    if a <=0 and b>0 and c>0:
        return max(b,c)
    if a >0 and b<=0 and c>0:
        return max(a,c)
    if a >0 and b>0 and c<=0:
        return max(a,b)
    if a <=0 and b<=0 and c>0:
        return max(c)
    if a >0 and b<=0 and c<=0:
        return max(a)
    if a <=0 and b>0 and c<=0:
        return max(b)
def f3(a, b, c):
    a = str(a)
    b= str(b)
    c=str(c)
    z = int(a[0]) + int(b[0]) + int(c[0])
    return z
def f4(a, b, c):
    a = str(a)
    b= str(b)
    c=str(c)
    n = int(a[-1]) + int(b[-1]) + int(c[-1])
    return n
def main():
    s1,s2,a,b,c = input().split()
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip())
# 1639495, 2022-09-24 09:31:40, xxx-[--][P-P-] (0%)

def f1(a, b, c):
    if a <=0 and b>0 and c>0:
        return min(b,c)
    if a >0 and b<=0 and c>0:
        return min(a,c)
    if a >0 and b>0 and c<=0:
        return min(a,b)
    if a <=0 and b<=0 and c>0:
        return min(c)
    if a >0 and b<=0 and c<=0:
        return min(a)
    if a <=0 and b>0 and c<=0:
        return min(b)
def f2(a, b, c):
    if a <0 and b>=0 and c>=0:
        return max(a)
    if a >=0 and b<0 and c>=0:
        return max(b)
    if a >=0 and b>=0 and c<0:
        return max(c)
    if a <0 and b<0 and c>=0:
        return max(a,b)
    if a >=0 and b<0 and c<0:
        return max(b,c)
    if a <0 and b>=0 and c<0:
        return max(a,c)
def f3(a, b, c):
    a = str(a)
    b= str(b)
    c=str(c)
    z = int(a[0]) + int(b[0]) + int(c[0])
    return abs(z)
def f4(a, b, c):
    a = str(a)
    b= str(b)
    c=str(c)
    n = int(a[-1]) + int(b[-1]) + int(c[-1])
    return abs(n)
def main():
    s1,s2,a,b,c = input().split()
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip())
# 1639769, 2022-09-24 09:38:58, xx--[--][P-P-] (0%)

def f1(a, b, c):
    if a <=0 and b>0 and c>0:
        return min(b,c)
    if a >0 and b<=0 and c>0:
        return min(a,c)
    if a >0 and b>0 and c<=0:
        return min(a,b)
    if a <=0 and b<=0 and c>0:
        return min(c)
    if a >0 and b<=0 and c<=0:
        return min(a)
    if a <=0 and b>0 and c<=0:
        return min(b)
def f2(a, b, c):
    if a <0 and b>=0 and c>=0:
        return max(a)
    if a >=0 and b<0 and c>=0:
        return max(b)
    if a >=0 and b>=0 and c<0:
        return max(c)
    if a <0 and b<0 and c>=0:
        return max(a,b)
    if a >=0 and b<0 and c<0:
        return max(b,c)
    if a <0 and b>=0 and c<0:
        return max(a,c)
def f3(a, b, c):
    z = a+b+c
    z=abs(z)
    z=str(z)
    return z[0]
def f4(a, b, c):
    z = a+b+c
    z=abs(z)
    z=str(z)
    return z[-1]
def main():
    s1,s2,a,b,c = input().split()
    if s1==0 and s2==0:
        print(f1(a, b, c))
    if s1==0 and s2==1:
        print(f2(a, b, c))
    if s1==1 and s2==0:
        print(f3(a, b, c))
    if s1==1 and s2==1:
        print(f4(a, b, c))
    elif (s1 !=1 or s1!=0) and (s2 !=1 or s2!=0):
        print("Error")
exec(input().strip())
# 1640047, 2022-09-24 09:46:42, xx--[--][P-P-] (0%)

def f1(a, b, c):
    if a <=0 and b>0 and c>0:
        return min(b,c)
    if a >0 and b<=0 and c>0:
        return min(a,c)
    if a >0 and b>0 and c<=0:
        return min(a,b)
    if a <=0 and b<=0 and c>0:
        return min(c)
    if a >0 and b<=0 and c<=0:
        return min(a)
    if a <=0 and b>0 and c<=0:
        return min(b)


def f2(a, b, c):
    if a <0 and b>=0 and c>=0:
        return max(a)
    if a >=0 and b<0 and c>=0:
        return max(b)
    if a >=0 and b>=0 and c<0:
        return max(c)
    if a <0 and b<0 and c>=0:
        return max(a,b)
    if a >=0 and b<0 and c<0:
        return max(b,c)
    if a <0 and b>=0 and c<0:
        return max(a,c)
def f3(a, b, c):
    z = a+b+c
    z=abs(z)
    z=str(z)
    return z[0]
def f4(a, b, c):
    z = a+b+c
    z=abs(z)
    z=str(z)
    return z[-1]
def main():
    s1,s2,a,b,c = input().split()
    s1 = int(s1)
    s2 = int(s2)
    a = int(a)
    b = int(b)
    c = int(c)
    if s1==0 and s2==0:
        print(f1(a, b, c))
    if s1==0 and s2==1:
        print(f2(a, b, c))
    if s1==1 and s2==0:
        print(f3(a, b, c))
    if s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip())
# 1640192, 2022-09-24 09:50:42, xx--[PP][PPPP] (33%)

def f1(a, b, c):
    if a <=0 and b>0 and c>0:
        return min(b,c)
    if a >0 and b<=0 and c>0:
        return min(a,c)
    if a >0 and b>0 and c<=0:
        return min(a,b)
    if a <=0 and b<=0 and c>0:
        return min(c)
    if a >0 and b<=0 and c<=0:
        return min(a)
    if a <=0 and b>0 and c<=0:
        return min(b)
def f2(a, b, c):
    if a <0 and b>=0 and c>=0:
        return max(a)
    if a >=0 and b<0 and c>=0:
        return max(b)
    if a >=0 and b>=0 and c<0:
        return max(c)
    if a <0 and b<0 and c>=0:
        return max(a,b)
    if a >=0 and b<0 and c<0:
        return max(b,c)
    if a <0 and b>=0 and c<0:
        return max(a,c)
def f3(a, b, c):
    z = a+b+c
    z=abs(z)
    z=str(z)
    return z[0]
def f4(a, b, c):
    z = a+b+c
    z=abs(z)
    z=str(z)
    return z[-1]
def main():
    s1,s2,a,b,c = input().split()
    s1 = int(s1)
    s2 = int(s2)
    a = int(a)
    b = int(b)
    c = int(c)
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip())
# 1640300, 2022-09-24 09:53:37, xx--[PP][PPPP] (33%)

def f1(a, b, c):
    if a <0 and b>0 and c>0:
        return min(b,c)
    if a >0 and b<0 and c>0:
        return min(a,c)
    if a >0 and b>0 and c<0:
        return min(a,b)
    if a <0 and b<0 and c>0:
        return min(c)
    if a >0 and b<0 and c<0:
        return min(a)
    if a <0 and b>0 and c<0:
        return min(b)
def f2(a, b, c):
    if a <0 and b>0 and c>0:
        return max(a)
    if a >0 and b<0 and c>0:
        return max(b)
    if a >0 and b>0 and c<0:
        return max(c)
    if a <0 and b<0 and c>0:
        return max(a,b)
    if a >0 and b<0 and c<0:
        return max(b,c)
    if a <0 and b>0 and c<0:
        return max(a,c)
def f3(a, b, c):
    z = a+b+c
    z=abs(z)
    z=str(z)
    return z[0]
def f4(a, b, c):
    z = a+b+c
    z=abs(z)
    z=str(z)
    return z[-1]
def main():
    s1,s2,a,b,c = input().split()
    s1 = int(s1)
    s2 = int(s2)
    a = int(a)
    b = int(b)
    c = int(c)
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip())
# 1640604, 2022-09-24 10:02:17, -P--[PP][PPPP] (50%)

def f1(a, b, c):
    if a <0 and b>0 and c>0:
        return min(b,c)
    if a >0 and b<0 and c>0:
        return min(a,c)
    if a >0 and b>0 and c<0:
        return min(a,b)
    if a <0 and b<0 and c>0:
        return c
    if a >0 and b<0 and c<0:
        return a
    if a ==0 and b>0 and c<0:
        return b
    if a ==0 and b<0 and c>0:
        return c
    if a <0 and b==0 and c>0:
        return c
    if a >0 and b==0 and c<0:
        return a
    if a >0 and b<0 and c==0:
        return a
    if a <0 and b>0 and c==0:
        return b
def f2(a, b, c):
    if a <0 and b>0 and c>0:
        return a
    if a >0 and b<0 and c>0:
        return b
    if a >0 and b>0 and c<0:
        return c
    if a <0 and b<0 and c>0:
        return max(a,b)
    if a >0 and b<0 and c<0:
        return max(b,c)
    if a <0 and b>0 and c<0:
        return max(a,c)
    if a ==0 and b>0 and c<0:
        return c
    if a ==0 and b<0 and c>0:
        return b
    if a <0 and b==0 and c>0:
        return a
    if a >0 and b==0 and c<0:
        return c
    if a >0 and b<0 and c==0:
        return b
    if a <0 and b>0 and c==0:
        return a
def f3(a, b, c):
    z = a+b+c
    z=abs(z)
    z=str(z)
    return z[0]
def f4(a, b, c):
    z = a+b+c
    z=abs(z)
    z=str(z)
    return z[-1]
def main():
    s1,s2,a,b,c = input().split()
    s1 = int(s1)
    s2 = int(s2)
    a = int(a)
    b = int(b)
    c = int(c)
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip())
# 1640832, 2022-09-24 10:08:05, -P--[PP][PPPP] (50%)

def f1(a, b, c):
    if a <0 and b>0 and c>0:
        return min(b,c)
    if a >0 and b<0 and c>0:
        return min(a,c)
    if a >0 and b>0 and c<0:
        return min(a,b)
    if a <0 and b<0 and c>0:
        return c
    if a >0 and b<0 and c<0:
        return a
    if a ==0 and b>0 and c<0:
        return b
    if a ==0 and b<0 and c>0:
        return c
    if a <0 and b==0 and c>0:
        return c
    if a >0 and b==0 and c<0:
        return a
    if a >0 and b<0 and c==0:
        return a
    if a <0 and b>0 and c==0:
        return b
def f2(a, b, c):
    if a <0 and b>0 and c>0:
        return a
    if a >0 and b<0 and c>0:
        return b
    if a >0 and b>0 and c<0:
        return c
    if a <0 and b<0 and c>0:
        return max(a,b)
    if a >0 and b<0 and c<0:
        return max(b,c)
    if a <0 and b>0 and c<0:
        return max(a,c)
    if a ==0 and b>0 and c<0:
        return c
    if a ==0 and b<0 and c>0:
        return b
    if a <0 and b==0 and c>0:
        return a
    if a >0 and b==0 and c<0:
        return c
    if a >0 and b<0 and c==0:
        return b
    if a <0 and b>0 and c==0:
        return a
def f3(a, b, c):
    z = a+b+c
    z=abs(z)
    z=str(z)
    return z[0]
def f4(a, b, c):
    z = a+b+c
    z=abs(z)
    z=str(z)
    return z[-1]
def main():
    s1,s2,a,b,c = input().split()
    s1 = int(s1)
    s2 = int(s2)
    a = int(a)
    b = int(b)
    c = int(c)
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip())
# 1641040, 2022-09-24 10:13:31, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    if a <0 and b>0 and c>0:
        return min(b,c)
    if a >0 and b<0 and c>0:
        return min(a,c)
    if a >0 and b>0 and c<0:
        return min(a,b)
    if a <0 and b<0 and c>0:
        return c
    if a >0 and b<0 and c<0:
        return a
    if a <0 and b>0 and c<0:
        return b
    if a ==0 and b>0 and c<0:
        return b
    if a ==0 and b<0 and c>0:
        return c
    if a <0 and b==0 and c>0:
        return c
    if a >0 and b==0 and c<0:
        return a
    if a >0 and b<0 and c==0:
        return a
    if a <0 and b>0 and c==0:
        return b
def f2(a, b, c):
    if a <0 and b>0 and c>0:
        return a
    if a >0 and b<0 and c>0:
        return b
    if a >0 and b>0 and c<0:
        return c
    if a <0 and b<0 and c>0:
        return max(a,b)
    if a >0 and b<0 and c<0:
        return max(b,c)
    if a <0 and b>0 and c<0:
        return max(a,c)
    if a ==0 and b>0 and c<0:
        return c
    if a ==0 and b<0 and c>0:
        return b
    if a <0 and b==0 and c>0:
        return a
    if a >0 and b==0 and c<0:
        return c
    if a >0 and b<0 and c==0:
        return b
    if a <0 and b>0 and c==0:
        return a
def f3(a, b, c):
    z = a+b+c
    z=abs(z)
    z=str(z)
    return z[0]
def f4(a, b, c):
    z = a+b+c
    z=abs(z)
    z=str(z)
    return z[-1]
def main():
    s1,s2,a,b,c = input().split()
    s1 = int(s1)
    s2 = int(s2)
    a = int(a)
    b = int(b)
    c = int(c)
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip())
# 1641090, 2022-09-24 10:15:07, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    if a <0 and b>0 and c>0:
        return min(b,c)
    if a >0 and b<0 and c>0:
        return min(a,c)
    if a >0 and b>0 and c<0:
        return min(a,b)
    if a <0 and b<0 and c>0:
        return c
    if a >0 and b<0 and c<0:
        return a
    if a <0 and b>0 and c<0:
        return b
    if a ==0 and b>0 and c<0:
        return b
    if a ==0 and b<0 and c>0:
        return c
    if a <0 and b==0 and c>0:
        return c
    if a >0 and b==0 and c<0:
        return a
    if a >0 and b<0 and c==0:
        return a
    if a <0 and b>0 and c==0:
        return b
def f2(a, b, c):
    if a <0 and b>0 and c>0:
        return a
    if a >0 and b<0 and c>0:
        return b
    if a >0 and b>0 and c<0:
        return c
    if a <0 and b<0 and c>0:
        return max(a,b)
    if a >0 and b<0 and c<0:
        return max(b,c)
    if a <0 and b>0 and c<0:
        return max(a,c)
    if a ==0 and b>0 and c<0:
        return c
    if a ==0 and b<0 and c>0:
        return b
    if a <0 and b==0 and c>0:
        return a
    if a >0 and b==0 and c<0:
        return c
    if a >0 and b<0 and c==0:
        return b
    if a <0 and b>0 and c==0:
        return a
def f3(a, b, c):
    z = a+b+c
    z=abs(z)
    z=str(z)
    return int(z[0])
def f4(a, b, c):
    z = a+b+c
    z=abs(z)
    z=str(z)
    return int(z[-1])
def main():
    s1,s2,a,b,c = input().split()
    s1 = int(s1)
    s2 = int(s2)
    a = int(a)
    b = int(b)
    c = int(c)
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip())

6330175621
# 1639177, 2022-09-24 09:23:58, ----[--][----] (0%)

def f1(a, b, c):
    y = [a,b,c]
    for e in y:
        if e>0:
            pass
        else:
            y.remove(e)
    x = min(y)
    return x
def f2(a, b, c):
    pass
def f3(a, b, c):
    pass
def f4(a, b, c):
    pass
def main():
    pass
  
exec(input().strip())
# 1639247, 2022-09-24 09:25:42, ----[xx][xxxx] (0%)

def f1(a, b, c):
    y = [a,b,c]
    for e in y:
        if e>0:
            pass
        else:
            y.remove(e)
    x = min(y)
    return x
def f2(a, b, c):
    pass
def f3(a, b, c):
    pass
def f4(a, b, c):
    pass
    
def f5(a, b, c):
    pass
exec(input().strip())
# 1639377, 2022-09-24 09:28:54, ----[xx][xxxx] (0%)

def f1(a, b, c):
    y = [a,b,c]
    for e in y:
        if e>0:
            pass
        else:
            y.remove(e)
    x = min(y)
    return x
def f2(a, b, c):
    y = [a,b,c]
    for e in y:
        if e<0:
            pass
        else:
            y.remove(e)
    x = max(y)
    return x
def f3(a, b, c):
    pass
def f4(a, b, c):
    pass
    
def f5(a, b, c):
    pass

exec(input().strip())
# 1639410, 2022-09-24 09:29:44, ----[xx][xxxx] (0%)

def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    y = [a,b,c]
    for e in y:
        if e>0:
            pass
        else:
            y.remove(e)
    x = min(y)
    return x
def f2(a, b, c):
    y = [a,b,c]
    for e in y:
        if e<0:
            pass
        else:
            y.remove(e)
    x = max(y)
    return x
def f3(a, b, c):
    pass
def f4(a, b, c):
    pass
    
def f5(a, b, c):
    pass

exec(input().strip())
# 1639650, 2022-09-24 09:35:43, ----[xx][xxxx] (0%)

def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    y = [a,b,c]
    for e in y:
        if e>0:
            pass
        else:
            y.remove(e)
    x = min(y)
    return x
def f2(a, b, c):
    y = [a,b,c]
    for e in y:
        if e<0:
            pass
        else:
            y.remove(e)
    x = max(y)
    return x
def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    y = a+b+c
    if y < 0:
        y =(-1)*y    
    x = str(y)[0]
    return x
    
    
def f4(a, b, c):
    pass
    
def f5(a, b, c):
    pass
exec(input().strip())
# 1639837, 2022-09-24 09:40:46, -xxx[xx][xxxx] (0%)

def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    y = [a,b,c]
    for e in y:
        if e>0:
            pass
        else:
            y.remove(e)
    x = min(y)
    return x
exec(input().strip())
# 1639866, 2022-09-24 09:41:24, ----[xx][xxxx] (0%)

def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    y = [a,b,c]
    for e in y:
        if e>0:
            pass
        else:
            y.remove(e)
    x = min(y)
    return x
def f2(a, b, c):
    y = [a,b,c]
    for e in y:
        if e<0:
            pass
        else:
            y.remove(e)
    x = max(y)
    return x
def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    y = a+b+c
    if y < 0:
        y =(-1)*y    
    x = str(y)[0]
    return x
    
    
def f4(a, b, c):
    pass
    
def main(a, b, c):
    pass

exec(input().strip())
# 1640282, 2022-09-24 09:53:04, ----[PP][PPPP] (33%)

def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    y = [a,b,c]
    for e in y:
        if e > 0:
            pass
        else:
            y.remove(e)
    x = min(y)
    return x
def f2(a, b, c):
    y = [a,b,c]
    for e in y:
        if e<0:
            pass
        else:
            y.remove(e)
    x = max(y)
    return x
def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    y = a+b+c
    if y < 0:
        y =(-1)*y    
    x = str(y)[0]
    return x
    
    
def f4(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    y = a+b+c    
    x = str(y)[-1]
    return x
   
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
        
exec(input().strip())
# 1640498, 2022-09-24 09:59:19, ----[PP][PPPP] (33%)

def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    y = [a,b,c]
    for e in y:
        if e > 0:
            pass
        else:
            y.remove(e)
    x = min(y)
    return int(x)
def f2(a, b, c):
    y = [a,b,c]
    for e in y:
        if e<0:
            pass
        else:
            y.remove(e)
    x = max(y)
    return x
def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    y = a+b+c
    if y < 0:
        y =(-1)*y    
    x = str(y)[0]
    return x
    
    
def f4(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    y = a+b+c    
    x = str(y)[-1]
    return x
   
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
        
exec(input().strip())
# 1640544, 2022-09-24 10:00:35, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    y = [a,b,c]
    for e in y:
        if e > 0:
            pass
        else:
            y.remove(e)
    x = min(y)
    return int(x)
def f2(a, b, c):
    y = [a,b,c]
    for e in y:
        if e<0:
            pass
        else:
            y.remove(e)
    x = max(y)
    return x
def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    y = a+b+c
    if y < 0:
        y =(-1)*y    
    x = str(y)[0]
    return int(x)
    
    
def f4(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    y = a+b+c    
    x = str(y)[-1]
    return int(x)
   
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
        
exec(input().strip())
# 1640677, 2022-09-24 10:04:12, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    y = [a,b,c]
    z = y[:]
    for e in z:
        if e > 0:
            pass
        else:
            y.remove(e)
    x = min(y)
    return int(x)
def f2(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    y = [a,b,c]
    z = y[:]
    for e in z:
        if e<0:
            pass
        else:
            y.remove(e)
    x = max(y)
    return int(x)
def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    y = a+b+c
    if y < 0:
        y =(-1)*y    
    x = str(y)[0]
    return int(x)
    
    
def f4(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    y = a+b+c    
    x = str(y)[-1]
    return int(x)
   
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
        
exec(input().strip())

6530165521
# 1639235, 2022-09-24 09:25:25, PP--[xx][xPPP] (33%)

def f1(a, b, c):
    li = [a,b,c]
    more = []
    for i in range(len(li)):
        if li[i] > 0:
            more.append(li[i])
    ans = min(more)
    return ans

def f2(a, b, c):
    li = [a,b,c]
    more = []
    for i in range(len(li)):
        if li[i] < 0:
            more.append(li[i])
    ans = max(more)
    return ans

def f3(a, b, c):
    li = [a,b,c]
    su = abs(sum(li))
    ans = str(su)
    return ans[0]
    
def f4(a, b, c):
    li = [a,b,c]
    su = abs(sum(li))
    ans = str(su)
    return ans[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and a2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')

exec(input().strip())
# 1639337, 2022-09-24 09:27:52, PP--[xx][x---] (33%)

def f1(a, b, c):
    li = [a,b,c]
    more = []
    for i in range(len(li)):
        if li[i] > 0:
            more.append(li[i])
    ans = min(more)
    return ans

def f2(a, b, c):
    li = [a,b,c]
    more = []
    for i in range(len(li)):
        if li[i] < 0:
            more.append(li[i])
    ans = max(more)
    return ans

def f3(a, b, c):
    li = [a,b,c]
    su = abs(sum(li))
    ans = str(su)
    return ans[0]
    
def f4(a, b, c):
    li = [a,b,c]
    su = abs(sum(li))
    ans = str(su)
    return ans[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and a2 == 0:
        return f1(a, b, c)
    elif s1 == 0 and s2 == 1:
        return f2(a, b, c)
    elif s1 == 1 and s2 == 0:
        return f3(a, b, c)
    elif s1 == 1 and s2 == 1:
        return f4(a, b, c)
    else:
        return 'Error'

exec(input().strip())
# 1640514, 2022-09-24 09:59:34, PP--[xx][x---] (33%)

def f1(a, b, c):
    li = [a,b,c]
    more = []
    for i in range(len(li)):
        if li[i] > 0:
            more.append(li[i])
    ans = min(more)
    return ans

def f2(a, b, c):
    li = [a,b,c]
    more = []
    for i in range(len(li)):
        if li[i] < 0:
            more.append(li[i])
    ans = max(more)
    return ans

def f3(a, b, c):
    li = [a,b,c]
    su = abs(sum(li))
    ans = str(su)
    return ans[0]
    
def f4(a, b, c):
    li = [a,b,c]
    su = abs(sum(li))
    ans = str(su)
    return ans[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and a2 == 0:
        return f1(a, b, c)
    elif s1 == 0 and s2 == 1:
        return f2(a, b, c)
    elif s1 == 1 and s2 == 0:
        return f3(a, b, c)
    elif s1 == 1 and s2 == 1:
        return f4(a, b, c)
    else:
        return 'Error'

exec(input().strip())
# 1640913, 2022-09-24 10:10:16, PP--[xx][x---] (33%)

def f1(a, b, c):
    li = [a,b,c]
    more = []
    for i in range(len(li)):
        if li[i] > 0:
            more.append(li[i])
    ans = min(more)
    return ans

def f2(a, b, c):
    li = [a,b,c]
    more = []
    for i in range(len(li)):
        if li[i] < 0:
            more.append(li[i])
    ans = max(more)
    return ans

def f3(a, b, c):
    li = [a,b,c]
    su = abs(sum(li))
    ans = str(su)
    return ans[0]
    
def f4(a, b, c):
    li = [a,b,c]
    su = abs(sum(li))
    ans = str(su)
    return ans[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and a2 == 0:
        return f1(a, b, c)
    elif s1 == 0 and s2 == 1:
        return f2(a, b, c)
    elif s1 == 1 and s2 == 0:
        return f3(a, b, c)
    elif s1 == 1 and s2 == 1:
        return f4(a, b, c)
    else:
        return 'Error'

exec(input().strip())
# 1641052, 2022-09-24 10:13:53, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    li = [a,b,c]
    more = []
    for i in range(len(li)):
        if li[i] > 0:
            more.append(li[i])
    ans = min(more)
    return ans

def f2(a, b, c):
    li = [a,b,c]
    more = []
    for i in range(len(li)):
        if li[i] < 0:
            more.append(li[i])
    ans = max(more)
    return ans

def f3(a, b, c):
    li = [a,b,c]
    su = abs(sum(li))
    ans = str(su)
    return ans[0]
    
def f4(a, b, c):
    li = [a,b,c]
    su = abs(sum(li))
    ans = str(su)
    return ans[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')

exec(input().strip())
# 1641095, 2022-09-24 10:15:14, PP--[PP][PPP-] (50%)

def f1(a, b, c):
    li = [a,b,c]
    more = []
    for i in range(len(li)):
        if li[i] > 0:
            more.append(li[i])
    ans = min(more)
    return ans

def f2(a, b, c):
    li = [a,b,c]
    more = []
    for i in range(len(li)):
        if li[i] < 0:
            more.append(li[i])
    ans = max(more)
    return ans

def f3(a, b, c):
    li = [a,b,c]
    su = sum(li)
    ans = str(su)
    return ans[0]
    
def f4(a, b, c):
    li = [a,b,c]
    su = sum(li)
    ans = str(su)
    return ans[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')

exec(input().strip())
# 1641110, 2022-09-24 10:15:35, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    li = [a,b,c]
    more = []
    for i in range(len(li)):
        if li[i] > 0:
            more.append(li[i])
    ans = min(more)
    return ans

def f2(a, b, c):
    li = [a,b,c]
    more = []
    for i in range(len(li)):
        if li[i] < 0:
            more.append(li[i])
    ans = max(more)
    return ans

def f3(a, b, c):
    li = [a,b,c]
    su = abs(sum(li))
    ans = str(su)
    return ans[0]
    
def f4(a, b, c):
    li = [a,b,c]
    su = abs(sum(li))
    ans = str(su)
    return ans[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')

exec(input().strip())
# 1641143, 2022-09-24 10:16:21, PPxx[PP][PxPx] (50%)

def f1(a, b, c):
    li = [a,b,c]
    more = []
    for i in range(len(li)):
        if li[i] > 0:
            more.append(li[i])
    ans = min(more)
    return ans

def f2(a, b, c):
    li = [a,b,c]
    more = []
    for i in range(len(li)):
        if li[i] < 0:
            more.append(li[i])
    ans = max(more)
    return ans

def f3(a, b, c):
    li = [a,b,c]
    su = sum(li)
    ans = int(str(su))
    return ans[0]
    
def f4(a, b, c):
    li = [a,b,c]
    su = sum(li)
    ans = int(str(su))
    return ans[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')

exec(input().strip())
# 1641175, 2022-09-24 10:17:03, PPxP[PP][PPPx] (67%)

def f1(a, b, c):
    li = [a,b,c]
    more = []
    for i in range(len(li)):
        if li[i] > 0:
            more.append(li[i])
    ans = min(more)
    return ans

def f2(a, b, c):
    li = [a,b,c]
    more = []
    for i in range(len(li)):
        if li[i] < 0:
            more.append(li[i])
    ans = max(more)
    return ans

def f3(a, b, c):
    li = [a,b,c]
    su = sum(li)
    ans = int(str(su)[0])
    return ans
    
def f4(a, b, c):
    li = [a,b,c]
    su = sum(li)
    ans = int(str(su)[-1])
    return ans

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')

exec(input().strip())
# 1641325, 2022-09-24 10:19:59, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    li = [a,b,c]
    more = []
    for i in range(len(li)):
        if li[i] > 0:
            more.append(li[i])
    ans = min(more)
    return ans

def f2(a, b, c):
    li = [a,b,c]
    more = []
    for i in range(len(li)):
        if li[i] < 0:
            more.append(li[i])
    ans = max(more)
    return ans

def f3(a, b, c):
    li = [a,b,c]
    su = sum(li)
    ans = int(str(abs(su))[0])
    return ans
    
def f4(a, b, c):
    li = [a,b,c]
    su = sum(li)
    ans = int(str(su)[-1])
    return ans

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')

exec(input().strip())

6531315521
# 1639378, 2022-09-24 09:28:56, PxP-[--][P-P-] (33%)

def f1(a, b, c):
  if a > 0 :
    xmin = a
  if b > 0 :
    xmin = b
  if c > 0 :
    xmin = c
  if a > 0 and a < xmin :
    xmin = a
  if b > 0 and b < xmin :
    xmin = b
  if c > 0 and c < xmin :
    xmin = c
  return(xmin)
    
def f2(a, b, c):
  if a < 0 :
    xmax = a
  if b < 0 :
    xmin = b
  if c < 0 :
    xmin = c
  if a < 0 and a > xmax :
    xmax = a
  if b < 0 and b > xmax :
    xmax = b
  if c < 0 and c > xmax :
    xmax = c
  return(xmax)
  
def f3(a, b, c):
  x = str(abs(a+b+c))[0]
  return(int(x))

def f4(a, b, c):
  x = str(abs(a+b+c))[-1]
  return(x)

def main():
  s1,s2,a,b,c = [int(e) for e in input().split()]
  if s1 == 0 and s2 == 0:
    print(f1(a,b,c))
  if s1 == 0 and s2 == 1:
    print(f2(a,b,c))
  if s1 == 1 and s2 == 0:
    print(f3(a,b,c))
  if s1 == 1 and s2 == 1:
    print(f4(a,b,c))
  else:
    print('Error')
exec(input().strip()) # DON'T remove this line

# 1640711, 2022-09-24 10:05:12, PxPP[--][P-P-] (50%)

def f1(a, b, c):
  if a > 0 :
    xmin = a
  if b > 0 :
    xmin = b
  if c > 0 :
    xmin = c
  if a > 0 and a < xmin :
    xmin = a
  if b > 0 and b < xmin :
    xmin = b
  if c > 0 and c < xmin :
    xmin = c
  return(xmin)
    
def f2(a, b, c):
  if a < 0 :
    xmax = a
  if b < 0 :
    xmin = b
  if c < 0 :
    xmin = c
  if a < 0 and a > xmax :
    xmax = a
  if b < 0 and b > xmax :
    xmax = b
  if c < 0 and c > xmax :
    xmax = c
  return(xmax)
  
def f3(a, b, c):
  x = str(abs(a+b+c))[0]
  return(int(x))

def f4(a, b, c):
  x = str(abs(a+b+c))[-1]
  return(int(x))

def main():
  s1,s2,a,b,c = [int(e) for e in input().split()]
  if s1 == 0 and s2 == 0:
    print(f1(a,b,c))
  if s1 == 0 and s2 == 1:
    print(f2(a,b,c))
  if s1 == 1 and s2 == 0:
    print(f3(a,b,c))
  if s1 == 1 and s2 == 1:
    print(f4(a,b,c))
  else:
    print('Error')

exec(input().strip()) # DON'T remove this line
# 1640885, 2022-09-24 10:09:24, compilation error (0%)

def f1(a, b, c):
  if a > 0 :
    xmin = a
  if b > 0 :
    xmin = b
  if c > 0 :
    xmin = c
  if a > 0 and a < xmin :
    xmin = a
  if b > 0 and b < xmin :
    xmin = b
  if c > 0 and c < xmin :
    xmin = c
  return(int(xmin))
    
def f2(a, b, c):
  if a < 0 :
    xmax = a
  if b < 0 :
    xmin = b
  if c < 0 :
    xmin = c
  if a < 0 and a > xmax :
    xmax = a
  if b < 0 and b > xmax :
    xmax = b
  if c < 0 and c > xmax :
    xmax = c
  return(int(xmax))
  
def f3(a, b, c):
  x = str(abs(a+b+c))[0]
  return(int(x))

def f4(a, b, c):
  x = str(abs(a+b+c))[-1]
  return(int(x))

def main():
  s1,s2,a,b,c = [int(e) for e in input().split()]
  if s1 == 0 and s2 == 0:
    print(f1(a, b, c))
  if s1 == 0 and s2 == 1:
    print(f2(a, b, c))
  if s1 == 1 and s2 == 0:
    print(f3(a, b c))
  if s1 == 1 and s2 == 1:
    print(f4(a, b, c))
  else:
    print('Error')

exec(input().strip()) # DON'T remove this line
# 1640919, 2022-09-24 10:10:23, PxPP[--][P-P-] (50%)

def f1(a, b, c):
  if a > 0 :
    xmin = a
  if b > 0 :
    xmin = b
  if c > 0 :
    xmin = c
  if a > 0 and a < xmin :
    xmin = a
  if b > 0 and b < xmin :
    xmin = b
  if c > 0 and c < xmin :
    xmin = c
  return(int(xmin))
    
def f2(a, b, c):
  if a < 0 :
    xmax = a
  if b < 0 :
    xmin = b
  if c < 0 :
    xmin = c
  if a < 0 and a > xmax :
    xmax = a
  if b < 0 and b > xmax :
    xmax = b
  if c < 0 and c > xmax :
    xmax = c
  return(int(xmax))
  
def f3(a, b, c):
  x = str(abs(a+b+c))[0]
  return(int(x))

def f4(a, b, c):
  x = str(abs(a+b+c))[-1]
  return(int(x))

def main():
  s1,s2,a,b,c = [int(e) for e in input().split()]
  if s1 == 0 and s2 == 0:
    print(f1(a, b, c))
  if s1 == 0 and s2 == 1:
    print(f2(a, b, c))
  if s1 == 1 and s2 == 0:
    print(f3(a, b, c))
  if s1 == 1 and s2 == 1:
    print(f4(a, b, c))
  else:
    print('Error')

exec(input().strip()) # DON'T remove this line
# 1640950, 2022-09-24 10:11:14, PxPP[--][P-P-] (50%)

def f1(a, b, c):
  if a > 0 :
    xmin = a
  if b > 0 :
    xmin = b
  if c > 0 :
    xmin = c
  if a > 0 and a <= xmin :
    xmin = a
  if b > 0 and b <= xmin :
    xmin = b
  if c > 0 and c <= xmin :
    xmin = c
  return(int(xmin))
    
def f2(a, b, c):
  if a < 0 :
    xmax = a
  if b < 0 :
    xmin = b
  if c < 0 :
    xmin = c
  if a < 0 and a >= xmax :
    xmax = a
  if b < 0 and b >= xmax :
    xmax = b
  if c < 0 and c >= xmax :
    xmax = c
  return(int(xmax))
  
def f3(a, b, c):
  x = str(abs(a+b+c))[0]
  return(int(x))

def f4(a, b, c):
  x = str(abs(a+b+c))[-1]
  return(int(x))

def main():
  s1,s2,a,b,c = [int(e) for e in input().split()]
  if s1 == 0 and s2 == 0:
    print(f1(a, b, c))
  if s1 == 0 and s2 == 1:
    print(f2(a, b, c))
  if s1 == 1 and s2 == 0:
    print(f3(a, b, c))
  if s1 == 1 and s2 == 1:
    print(f4(a, b, c))
  else:
    print('Error')

exec(input().strip()) # DON'T remove this line
# 1641069, 2022-09-24 10:14:22, PPPP[--][P-P-] (67%)

def f1(a, b, c):
  s = []
  if a > 0 :
    s.append(a)
  if b > 0 :
    s.append(b)
  if c > 0 :
    s.append(c)
  xmin = min(s)
  return(int(xmin))
    
def f2(a, b, c):
  s = []
  if a < 0 :
    s.append(a)
  if b < 0 :
    s.append(b)
  if c < 0 :
    s.append(c)
  xmax = max(s)
  return(int(xmax))
  
def f3(a, b, c):
  x = str(abs(a+b+c))[0]
  return(int(x))

def f4(a, b, c):
  x = str(abs(a+b+c))[-1]
  return(int(x))

def main():
  s1,s2,a,b,c = [int(e) for e in input().split()]
  if s1 == 0 and s2 == 0:
    print(f1(a, b, c))
  if s1 == 0 and s2 == 1:
    print(f2(a, b, c))
  if s1 == 1 and s2 == 0:
    print(f3(a, b, c))
  if s1 == 1 and s2 == 1:
    print(f4(a, b, c))
  else:
    print('Error')

exec(input().strip()) # DON'T remove this line
# 1641121, 2022-09-24 10:15:50, PPPP[--][P-P-] (67%)

def f1(a, b, c):
  s = []
  if a > 0 :
    s.append(a)
  if b > 0 :
    s.append(b)
  if c > 0 :
    s.append(c)
  xmin = min(s)
  return(int(xmin))
    
def f2(a, b, c):
  s = []
  if a < 0 :
    s.append(a)
  if b < 0 :
    s.append(b)
  if c < 0 :
    s.append(c)
  xmax = max(s)
  return(int(xmax))
  
def f3(a, b, c):
  x = str(abs(a+b+c))
  return(int(x[0]))

def f4(a, b, c):
  x = str(abs(a+b+c))
  return(int(x[-1]))

def main():
  s1,s2,a,b,c = [int(e) for e in input().split()]
  if s1 == 0 and s2 == 0:
    print(f1(a, b, c))
  if s1 == 0 and s2 == 1:
    print(f2(a, b, c))
  if s1 == 1 and s2 == 0:
    print(f3(a, b, c))
  if s1 == 1 and s2 == 1:
    print(f4(a, b, c))
  else:
    print('Error')

exec(input().strip()) # DON'T remove this line
# 1641446, 2022-09-24 10:22:27, PPPP[--][P-P-] (67%)

def f1(a, b, c):
  s = []
  if a > 0 :
    s.append(a)
  if b > 0 :
    s.append(b)
  if c > 0 :
    s.append(c)
  xmin = min(s)
  return(xmin)
    
def f2(a, b, c):
  s = []
  if a < 0 :
    s.append(a)
  if b < 0 :
    s.append(b)
  if c < 0 :
    s.append(c)
  xmax = max(s)
  return(xmax)
  
def f3(a, b, c):
  x = str(abs(a+b+c))
  return(int(x[0]))

def f4(a, b, c):
  x = str(abs(a+b+c))
  return(int(x[-1]))

def main():
  s1,s2,a,b,c = [int(e) for e in input().split()]
  if s1 == 0 and s2 == 0:
    print(f1(a, b, c))
  if s1 == 0 and s2 == 1:
    print(f2(a, b, c))
  if s1 == 1 and s2 == 0:
    print(f3(a, b, c))
  if s1 == 1 and s2 == 1:
    print(f4(a, b, c))
  else:
    print('Error')

exec(input().strip()) # DON'T remove this line
# 1641720, 2022-09-24 10:27:43, PPPP[--][P-P-] (67%)

def f1(a, b, c):
  s = []
  if a > 0 :
    s.append(a)
  if b > 0 :
    s.append(b)
  if c > 0 :
    s.append(c)
  xmin = min(s)
  return(int(xmin))
    
def f2(a, b, c):
  s = []
  if a < 0 :
    s.append(a)
  if b < 0 :
    s.append(b)
  if c < 0 :
    s.append(c)
  xmax = max(s)
  return(int(xmax))
  
def f3(a, b, c):
  x = str(abs(a+b+c))
  return(int(x[0]))

def f4(a, b, c):
  x = str(abs(a+b+c))
  return(int(x[-1]))

def main():
  s1,s2,a,b,c = [int(e) for e in input().split()]
  if s1 == 0 and s2 == 0:
    print(f1(a, b, c))
  if s1 == 0 and s2 == 1:
    print(f2(a, b, c))
  if s1 == 1 and s2 == 0:
    print(f3(a, b, c))
  if s1 == 1 and s2 == 1:
    print(f4(a, b, c))
  else:
    print('Error')

exec(input().strip()) # DON'T remove this line
# 1642010, 2022-09-24 10:32:55, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
  s = []
  if a > 0 :
    s.append(a)
  if b > 0 :
    s.append(b)
  if c > 0 :
    s.append(c)
  xmin = min(s)
  return(xmin)
    
def f2(a, b, c):
  s = []
  if a < 0 :
    s.append(a)
  if b < 0 :
    s.append(b)
  if c < 0 :
    s.append(c)
  xmax = max(s)
  return(xmax)
  
def f3(a, b, c):
  x = str(abs(a+b+c))
  return(int(x[0]))

def f4(a, b, c):
  x = str(abs(a+b+c))
  return(int(x[-1]))

def main():
  s1,s2,a,b,c = [int(e) for e in input().split()]
  if s1 == 0 and s2 == 0:
    print(f1(a, b, c))
  elif s1 == 0 and s2 == 1:
    print(f2(a, b, c))
  elif s1 == 1 and s2 == 0:
    print(f3(a, b, c))
  elif s1 == 1 and s2 == 1:
    print(f4(a, b, c))
  else:
    print('Error')

exec(input().strip()) # DON'T remove this line

6230098921
# 1639325, 2022-09-24 09:27:27, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    result = [a,b,c]
    k = []
    for i in range(len(result)) :
        if result[i] > 0 :
            k.append(result[i])
        elif result[i] <= 0 :
            pass
    m = min(k)
    return m
def f2(a, b, c):
    result = [a,b,c]
    k = []
    for i in range(len(result)) :
        if result[i] < 0 :
            k.append(result[i])
        elif result[i] >= 0 :
            pass
    m = max(k)
    return m
def f3(a, b, c):
    result = str(abs(a+b+c))
    return result[0]
def f4(a, b, c):
    result = str(abs(a+b+c))
    return result[-1]
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        m = f1(a,b,c)
        print(m)
    elif s1 == 0 and s2 == 1 :
        m = f2(a,b,c)
        print(m)
    elif s1 == 1 and s2 == 0 :
        m = f3(a,b,c)
        print(m)
    elif s1 == 1 and s2 == 1 :
        m = f4(a,b,c)
        print(m)
    else :
        print('Error')
exec(input().strip()) # DON'T remove t
# 1639338, 2022-09-24 09:27:53, P---[P-][PPPP] (33%)

def f1(a, b, c):
    result = [a,b,c]
    k = []
    for i in range(len(result)) :
        if result[i] > 0 :
            k.append(result[i])
        elif result[i] <= 0 :
            pass
    m = min(k)
    return m
def f2(a, b, c):
    pass
def f3(a, b, c):
    result = str(abs(a+b+c))
    return result[0]
def f4(a, b, c):
    result = str(abs(a+b+c))
    return result[-1]
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        m = f1(a,b,c)
        print(m)
    elif s1 == 0 and s2 == 1 :
        m = f2(a,b,c)
        print(m)
    elif s1 == 1 and s2 == 0 :
        m = f3(a,b,c)
        print(m)
    elif s1 == 1 and s2 == 1 :
        m = f4(a,b,c)
        print(m)
    else :
        print('Error')
exec(input().strip()) # DON'T remove t
# 1639367, 2022-09-24 09:28:41, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    result = [a,b,c]
    k = []
    for i in range(len(result)) :
        if result[i] > 0 :
            k.append(result[i])
        elif result[i] <= 0 :
            pass
    m = min(k)
    return m
def f2(a, b, c):
    result = [a,b,c]
    k = []
    for i in range(len(result)) :
        if result[i] < 0 :
            k.append(result[i])
        elif result[i] >= 0 :
            pass
    m = max(k)
    return m
def f3(a, b, c):
    result = str(abs(a+b+c))
    return result[0]
def f4(a, b, c):
    result = str(abs(a+b+c))
    return result[-1]
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        m = f1(a,b,c)
        print(m)
    elif s1 == 0 and s2 == 1 :
        m = f2(a,b,c)
        print(m)
    elif s1 == 1 and s2 == 0 :
        m = f3(a,b,c)
        print(m)
    elif s1 == 1 and s2 == 1 :
        m = f4(a,b,c)
        print(m)
    else :
        print('Error')
exec(input().strip()) # DON'T remove 
# 1640142, 2022-09-24 09:49:21, compilation error (0%)

def f1(a, b, c):
    def f1(a, b, c):
    result = [a,b,c]
    k = []
    for i in range(len(result)) :
        if result[i] > 0 :
            k.append(result[i])
        elif result[i] <= 0 :
            pass
    m = min(k)
    return m
def f2(a, b, c):
    result = [a,b,c]
    k = []
    for i in range(len(result)) :
        if result[i] < 0 :
            k.append(result[i])
        elif result[i] >= 0 :
            pass
    m = max(k)
    return m
def f3(a, b, c):
    result = str(abs(a+b+c))
    return result[0]
def f4(a, b, c):
    result = str(abs(a+b+c))
    return result[-1]
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        m = f1(a,b,c)
        print(m)
    elif s1 == 0 and s2 == 1 :
        m = f2(a,b,c)
        print(m)
    elif s1 == 1 and s2 == 0 :
        m = f3(a,b,c)
        print(m)
    elif s1 == 1 and s2 == 1 :
        m = f4(a,b,c)
        print(m)
    else :
        print('Error')
exec(input().strip()) # DON'T remove 
def f2(a, b, c):
    result = [a,b,c]
    k = []
    for i in range(len(result)) :
        if result[i] < 0 :
            k.append(result[i])
        elif result[i] >= 0 :
            pass
    m = max(k)
    return m
def f3(a, b, c):
    result = str(abs(a+b+c))
    return result[0]
def f4(a, b, c):
    result = str(abs(a+b+c))
    return result[-1]
def main():
    pass
exec(input().strip()) # DON'T remove
# 1640178, 2022-09-24 09:50:26, PP--[--][----] (33%)

def f1(a, b, c):
    result = [a,b,c]
    k = []
    for i in range(len(result)) :
        if result[i] > 0 :
            k.append(result[i])
        elif result[i] <= 0 :
            pass
    m = min(k)
    return m
def f2(a, b, c):
    result = [a,b,c]
    k = []
    for i in range(len(result)) :
        if result[i] < 0 :
            k.append(result[i])
        elif result[i] >= 0 :
            pass
    m = max(k)
    return m
def f3(a, b, c):
    result = str(abs(a+b+c))
    return result[0]
def f4(a, b, c):
    result = str(abs(a+b+c))
    return result[-1]
def main():
    pass
exec(input().strip()) # DON'T remove this line
# 1640201, 2022-09-24 09:50:52, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    result = [a,b,c]
    k = []
    for i in range(len(result)) :
        if result[i] > 0 :
            k.append(result[i])
        elif result[i] <= 0 :
            pass
    m = min(k)
    return m
def f2(a, b, c):
    result = [a,b,c]
    k = []
    for i in range(len(result)) :
        if result[i] < 0 :
            k.append(result[i])
        elif result[i] >= 0 :
            pass
    m = max(k)
    return m
def f3(a, b, c):
    result = str(abs(a+b+c))
    return result[0]
def f4(a, b, c):
    result = str(abs(a+b+c))
    return result[-1]
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        m = f1(a,b,c)
        print(m)
    elif s1 == 0 and s2 == 1 :
        m = f2(a,b,c)
        print(m)
    elif s1 == 1 and s2 == 0 :
        m = f3(a,b,c)
        print(m)
    elif s1 == 1 and s2 == 1 :
        m = f4(a,b,c)
        print(m)
    else :
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1640207, 2022-09-24 09:51:08, PP--[PP][P-P-] (50%)

def f1(a, b, c):
    result = [a,b,c]
    k = []
    for i in range(len(result)) :
        if result[i] > 0 :
            k.append(result[i])
        elif result[i] <= 0 :
            pass
    m = min(k)
    return m
def f2(a, b, c):
    result = [a,b,c]
    k = []
    for i in range(len(result)) :
        if result[i] < 0 :
            k.append(result[i])
        elif result[i] >= 0 :
            pass
    m = max(k)
    return m
def f3(a, b, c):
    pass
def f4(a, b, c):
    result = str(abs(a+b+c))
    return result[-1]
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        m = f1(a,b,c)
        print(m)
    elif s1 == 0 and s2 == 1 :
        m = f2(a,b,c)
        print(m)
    elif s1 == 1 and s2 == 0 :
        m = f3(a,b,c)
        print(m)
    elif s1 == 1 and s2 == 1 :
        m = f4(a,b,c)
        print(m)
    else :
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1640239, 2022-09-24 09:51:53, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    result = [a,b,c]
    k = []
    for i in range(len(result)) :
        if result[i] > 0 :
            k.append(result[i])
        elif result[i] <= 0 :
            pass
    m = min(k)
    return m
def f2(a, b, c):
    result = [a,b,c]
    k = []
    for i in range(len(result)) :
        if result[i] < 0 :
            k.append(result[i])
        elif result[i] >= 0 :
            pass
    m = max(k)
    return m
def f3(a, b, c):
    result = str(abs(a+b+c))
    return result[0]
def f4(a, b, c):
    result = str(abs(a+b+c))
    return result[-1]
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        m = f1(a,b,c)
        print(m)
    elif s1 == 0 and s2 == 1 :
        m = f2(a,b,c)
        print(m)
    elif s1 == 1 and s2 == 0 :
        m = f3(a,b,c)
        print(m)
    elif s1 == 1 and s2 == 1 :
        m = f4(a,b,c)
        print(m)
    else :
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1640280, 2022-09-24 09:53:04, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    result = [a,b,c]
    k = []
    for i in range(len(result)) :
        if result[i] > 0 :
            k.append(result[i])
        elif result[i] <= 0 :
            pass
    m = min(k)
    return m
def f2(a, b, c):
    result = [a,b,c]
    k = []
    for i in range(len(result)) :
        if result[i] < 0 :
            k.append(result[i])
        elif result[i] >= 0 :
            pass
    m = max(k)
    return m
def f3(a, b, c):
    result = str(abs(a+b+c))
    return int(result[0])
def f4(a, b, c):
    result = str(abs(a+b+c))
    return int(result[-1])
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        m = f1(a,b,c)
        print(m)
    elif s1 == 0 and s2 == 1 :
        m = f2(a,b,c)
        print(m)
    elif s1 == 1 and s2 == 0 :
        m = f3(a,b,c)
        print(m)
    elif s1 == 1 and s2 == 1 :
        m = f4(a,b,c)
        print(m)
    else :
        print('Error')
exec(input().strip()) # DON'T remove this line

6530044221
# 1639106, 2022-09-24 09:22:15, ----[xx][xxxx] (0%)

def f1(a,b,c) :
    return (min(a,b,c))

def f2(a,b,c):
    return(max(a,b,c))

def f3(a,b,c) :
    g = a+b+c
    if g >= 0 :
        return str(g)[0]
    else :
        return str(g)[1]
def f4(a,b,c):
    return(str(a+b+c)[-1])

def main():
    s1,s2,a,b,c = [int(i) for i in input()]
    if s1 == s2 == 0 :
        print(f1(a,b,c))
    elif s1 == s2 == 1 :
        print(f4(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == q and s2 == 0 :
        print(f3(a,b,c))
    else :
        print("Error")
        

exec(input().strip())
# 1639146, 2022-09-24 09:23:12, ----[--][xxxx] (0%)

def f1(a,b,c) :
    return (min(a,b,c))

def f2(a,b,c):
    return(max(a,b,c))

def f3(a,b,c) :
    g = a+b+c
    if g >= 0 :
        return str(g)[0]
    else :
        return str(g)[1]
def f4(a,b,c):
    return(str(a+b+c)[-1])

def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == s2 == 0 :
        print(f1(a,b,c))
    elif s1 == s2 == 1 :
        print(f4(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == q and s2 == 0 :
        print(f3(a,b,c))
    else :
        print("Error")
        

exec(input().strip())
# 1639184, 2022-09-24 09:24:08, ----[--][PPPP] (17%)

def f1(a,b,c) :
    return (min(a,b,c))

def f2(a,b,c):
    return(max(a,b,c))

def f3(a,b,c) :
    g = a+b+c
    if g >= 0 :
        return str(g)[0]
    else :
        return str(g)[1]
def f4(a,b,c):
    return(str(a+b+c)[-1])

def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == s2 == 0 :
        print(f1(a,b,c))
    elif s1 == s2 == 1 :
        print(f4(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    else :
        print("Error")
        

exec(input().strip())
# 1639346, 2022-09-24 09:28:09, PP--[PP][PPPP] (67%)

#1
'''
a,b,c,d = [int(i) for i in input().split()]
if a > b :
    a,b= b,a
    while d >= a :
        if c > d :
            a += 1
        else :
            d -= 1
            
else :
    if c%2 == 0 :
        d += a
    else :
        if d >c :
            c += d
        else :
            b += a
        a = b + c
print(a,b,c,d)
'''
#2
def f1(a,b,c) :
    g = []
    if int(a) > 0:
        g.append(int(a))
    if int(b) > 0:
        g.append(int(b))
    if int(c) > 0:
        g.append(int(c))
    return(min(g))

def f2(a,b,c):
    g = []
    if int(a) < 0:
        g.append(int(a))
    if int(b) < 0:
        g.append(int(b))
    if int(c) < 0:
        g.append(int(c))
    
    return(max(g))

def f3(a,b,c) :
    g = a+b+c
    if g >= 0 :
        return str(g)[0]
    else :
        return str(g)[1]
def f4(a,b,c):
    return(str(a+b+c)[-1])

def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == s2 == 0 :
        print(f1(a,b,c))
    elif s1 == s2 == 1 :
        print(f4(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    else :
        print("Error")
        

exec(input().strip())

# 1639405, 2022-09-24 09:29:36, PP--[PP][PPPP] (67%)

def f1(a,b,c) :
    g = []
    if int(a) > 0:
        g.append(int(a))
    if int(b) > 0:
        g.append(int(b))
    if int(c) > 0:
        g.append(int(c))
    return(min(g))

def f2(a,b,c):
    g = []
    if int(a) < 0:
        g.append(int(a))
    if int(b) < 0:
        g.append(int(b))
    if int(c) < 0:
        g.append(int(c))
    
    return(max(g))

def f3(a,b,c) :
    g = a+b+c
    if g >= 0 :
        return str(g)[0]
    else :
        return str(g)[1]
def f4(a,b,c):
    return(str(a+b+c)[-1])

def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == s2 == 0 :
        print(f1(a,b,c))
    elif s1 == s2 == 1 :
        print(f4(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    else :
        print("Error")
        

exec(input().strip())
# 1639970, 2022-09-24 09:44:18, PP--[PP][PPPP] (67%)

def f1(a,b,c) :
    g = []
    if int(a) > 0:
        g.append(int(a))
    if int(b) > 0:
        g.append(int(b))
    if int(c) > 0:
        g.append(int(c))
    return(min(g))

def f2(a,b,c):
    g = []
    if int(a) < 0:
        g.append(int(a))
    if int(b) < 0:
        g.append(int(b))
    if int(c) < 0:
        g.append(int(c))
    
    return(max(g))

def f3(a,b,c) :
    g = int(a)+int(b)+int(c)
    if g >= 0 :
        return str(g)[0]
    else :
        return str(g)[1]
def f4(a,b,c):
    return(str(int(a)+int(b)+int(c))[-1])

def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == s2 == 0 :
        print(f1(a,b,c))
    elif s1 == s2 == 1 :
        print(f4(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    else :
        print("Error")
        

exec(input().strip())
# 1640044, 2022-09-24 09:46:40, PP--[PP][PPPP] (67%)

def f1(a,b,c) :
    g = []
    if int(a) > 0:
        g.append(int(a))
    if int(b) > 0:
        g.append(int(b))
    if int(c) > 0:
        g.append(int(c))
    return(min(g))

def f2(a,b,c):
    g = []
    if int(a) < 0:
        g.append(int(a))
    if int(b) < 0:
        g.append(int(b))
    if int(c) < 0:
        g.append(int(c))
    
    return(max(g))

def f3(a,b,c) :
    g = int(a)+int(b)+int(c)
    if g >= 0 :
        return str(g)[0]
    else :
        return str(g)[1]
def f4(a,b,c):
    return(str(int(a)+int(b)+int(c))[-1])

def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == s2 == 0 :
        print(f1(a,b,c))
        
    elif s1 == s2 == 1 :
        print(f4(a,b,c))
        
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
        
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
        
    else :
        print("Error")
        

exec(input().strip())

# 1640702, 2022-09-24 10:04:57, PP--[PP][PPPP] (67%)

def f1(a,b,c) :
    g = []
    if int(a) > 0:
        g.append(int(a))
    if int(b) > 0:
        g.append(int(b))
    if int(c) > 0:
        g.append(int(c))
    return(min(g))

def f2(a,b,c):
    g = []
    if int(a) < 0:
        g.append(int(a))
    if int(b) < 0:
        g.append(int(b))
    if int(c) < 0:
        g.append(int(c))
    
    return(max(g))

def f3(a,b,c) :
    g = int(a)+int(b)+int(c)
    if g >= 0 :
        return str(g)[0]
    elif g < 0 :
        return str(g)[1]
def f4(a,b,c):
    return(str(int(a)+int(b)+int(c))[-1])

def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == s2 == 0 :
        print(f1(a,b,c))
        
    elif s1 == s2 == 1 :
        print(f4(a,b,c))
        
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
        
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
        
    else :
        print("Error")
        

exec(input().strip())
# 1640762, 2022-09-24 10:06:23, PPPP[PP][PPPP] (100%)

def f1(a,b,c) :
    g = []
    if int(a) > 0:
        g.append(int(a))
    if int(b) > 0:
        g.append(int(b))
    if int(c) > 0:
        g.append(int(c))
    return(min(g))

def f2(a,b,c):
    g = []
    if int(a) < 0:
        g.append(int(a))
    if int(b) < 0:
        g.append(int(b))
    if int(c) < 0:
        g.append(int(c))
    
    return(max(g))

def f3(a,b,c) :
    g = int(a)+int(b)+int(c)
    if g >= 0 :
        return int(str(g)[0])
    elif g < 0 :
        return int(str(g)[1])
def f4(a,b,c):
    return(int(str(int(a)+int(b)+int(c))[-1]))

def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == s2 == 0 :
        print(f1(a,b,c))
        
    elif s1 == s2 == 1 :
        print(f4(a,b,c))
        
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
        
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
        
    else :
        print("Error")
        

exec(input().strip())

6530109421
# 1639209, 2022-09-24 09:24:39, compilation error (0%)

def f1(a, b, c):

    x[]
    if a > 0:
        x += [a]
    if b > 0:
        x += [b]
    if c > 0:
        x += [c]
    return min(x)

def f2(a, b, c):
    x[]
    if a < 0:
        x += [a]
    if b < 0:
        x += [b]
    if c < 0:
        x += [c]
    return max(x)

def f3(a, b, c):
    a = str(abs(a))
    b = str(abs(b))
    c = str(abs(c))
    x = int(a[0])
    y = int(b[0])
    z = int(c[0])
    return x+y+z

def f4(a, b, c):
    a = str()
    b = str()
    c = str()
    x = int(a[-1])
    y = int(b[-1])
    z = int(c[-1])
    return x+y+z

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
        
exec(input().strip()) # DON'T remove this line
# 1639282, 2022-09-24 09:26:13, PP-x[PP][----] (50%)

def f1(a, b, c):
    x = []
    if a > 0:
        x += [a]
    if b > 0:
        x += [b]
    if c > 0:
        x += [c]
    return min(x)

def f2(a, b, c):
    x = []
    if a < 0:
        x += [a]
    if b < 0:
        x += [b]
    if c < 0:
        x += [c]
    return max(x)

def f3(a, b, c):
    a = str(abs(a))
    b = str(abs(b))
    c = str(abs(c))
    x = int(a[0])
    y = int(b[0])
    z = int(c[0])
    return x+y+z

def f4(a, b, c):
    a = str()
    b = str()
    c = str()
    x = int(a[-1])
    y = int(b[-1])
    z = int(c[-1])
    return x+y+z

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
        
exec(input().strip()) # DON'T remove this line
# 1639394, 2022-09-24 09:29:19, PP--[PP][-P-P] (50%)

def f1(a, b, c):

    x = []
    if a > 0:
        x += [a]
    if b > 0:
        x += [b]
    if c > 0:
        x += [c]
    return min(x)

def f2(a, b, c):
    x = []
    if a < 0:
        x += [a]
    if b < 0:
        x += [b]
    if c < 0:
        x += [c]
    return max(x)

def f3(a, b, c):
    x = a+b+c
    a = abs(x)
    y = str(a)
    return y[0]

def f4(a, b, c):
    x = a+b+c
    a = abs(x)
    y = str(a)
    return y[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
        
exec(input().strip()) # DON'T remove this line
    

# 1639438, 2022-09-24 09:30:26, PP--[PP][PPPP] (67%)

def f1(a, b, c):

    x = []
    if a > 0:
        x += [a]
    if b > 0:
        x += [b]
    if c > 0:
        x += [c]
    return min(x)

def f2(a, b, c):
    x = []
    if a < 0:
        x += [a]
    if b < 0:
        x += [b]
    if c < 0:
        x += [c]
    return max(x)

def f3(a, b, c):
    x = a+b+c
    a = abs(x)
    y = str(a)
    return y[0]

def f4(a, b, c):
    x = a+b+c
    a = abs(x)
    y = str(a)
    return y[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
        
exec(input().strip()) # DON'T remove this line
    

# 1639565, 2022-09-24 09:33:34, PP--[PP][PPPP] (67%)

def f1(a, b, c):

    x = []
    if a > 0:
        x += [a]
    if b > 0:
        x += [b]
    if c > 0:
        x += [c]
    return min(x)

def f2(a, b, c):
    x = []
    if a < 0:
        x += [a]
    if b < 0:
        x += [b]
    if c < 0:
        x += [c]
    return max(x)

def f3(a, b, c):
    x = a+b+c
    a = abs(x)
    y = str(a)
    return y[0]

def f4(a, b, c):
    x = a+b+c
    a = abs(x)
    y = str(a)
    return y[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
        
exec(input().strip()) # DON'T remove this line
# 1639597, 2022-09-24 09:34:20, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x = []
    if a > 0:
        x += [a]
    if b > 0:
        x += [b]
    if c > 0:
        x += [c]
    return min(x)

def f2(a, b, c):
    x = []
    if a < 0:
        x += [a]
    if b < 0:
        x += [b]
    if c < 0:
        x += [c]
    return max(x)

def f3(a, b, c):
    x = a+b+c
    a = abs(x)
    y = str(a)
    return y[0]

def f4(a, b, c):
    x = a+b+c
    y = str(x)
    return y[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
        
exec(input().strip()) # DON'T remove this line
# 1639612, 2022-09-24 09:34:41, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x = []
    if a > 0:
        x += [a]
    if b > 0:
        x += [b]
    if c > 0:
        x += [c]
    return min(x)

def f2(a, b, c):
    x = []
    if a < 0:
        x += [a]
    if b < 0:
        x += [b]
    if c < 0:
        x += [c]
    return max(x)

def f3(a, b, c):
    x = a+b+c
    a = abs(x)
    y = str(a)
    return y[0]

def f4(a, b, c):
    x = a+b+c
    y = str(x)
    return y[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
        
exec(input().strip()) # DON'T remove this line
# 1640220, 2022-09-24 09:51:24, PP--[PP][PPPP] (67%)

def f1(a, b, c):
  x = []
  if a > 0:
    x += [a]
  if b > 0:
    x += [b]
  if c > 0:
    x += [c]
  return min(x)

def f2(a, b, c):
  x = []
  if a < 0:
    x += [a]
  if b < 0:
    x += [b]
  if c < 0:
    x += [c]
  return max(x)

def f3(a, b, c):
  x = a+b+c
  a = abs(x)
  y = str(a)
  return y[0]

def f4(a, b, c):
  x = a+b+c
  y = str(x)
  return y[-1]

def main():
  s1,s2,a,b,c = [int(e) for e in input().split()]
  if s1 == 0 and s2 == 0:
    print(f1(a, b, c))
  elif s1 == 0 and s2 == 1:
    print(f2(a, b, c))
  elif s1 == 1 and s2 == 0:
    print(f3(a, b, c))
  elif s1 == 1 and s2 == 1:
    print(f4(a, b, c))
  else:
    print('Error')
        
exec(input().strip()) # DON'T remove this line
# 1640473, 2022-09-24 09:58:48, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
  x = []
  if a > 0:
    x += [a]
  if b > 0:
    x += [b]
  if c > 0:
    x += [c]
  return min(x)

def f2(a, b, c):
  x = []
  if a < 0:
    x += [a]
  if b < 0:
    x += [b]
  if c < 0:
    x += [c]
  return max(x)

def f3(a, b, c):
  x = a+b+c
  a = abs(x)
  y = str(a)
  return int(y[0])

def f4(a, b, c):
  x = a+b+c
  y = str(x)
  return int(y[-1])

def main():
  s1,s2,a,b,c = [int(e) for e in input().split()]
  if s1 == 0 and s2 == 0:
    print(f1(a, b, c))
  elif s1 == 0 and s2 == 1:
    print(f2(a, b, c))
  elif s1 == 1 and s2 == 0:
    print(f3(a, b, c))
  elif s1 == 1 and s2 == 1:
    print(f4(a, b, c))
  else:
    print('Error')
        
exec(input().strip()) # DON'T remove this line

6530162621
# 1639115, 2022-09-24 09:22:28, --PP[PP][PPPP] (67%)

# 2565_1_Quiz_1_2.py

def f1(a, b, c):
    if a < 0:
        a = 1001
    if b < 0:
        b = 1001
    if c < 0:
        c = 1001
    return  min(a,b,c)

def f2(a, b, c):
    if a > 0:
        a = -1001
    if b > 0:
        b = -1001
    if c > 0:
        c = -1001
    return  max(a,b,c)
    
def f3(a, b, c):
    return  int(str(abs(a+b+c))[0])
    
def f4(a, b, c):
    return  int(str(abs(a+b+c))[-1])
    
def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

exec(input())

# 1640695, 2022-09-24 10:04:44, --PP[PP][PPPP] (67%)

# 2565_1_Quiz_1_2.py

def f1(a, b, c):
    x = [a,b,c]
    if a < 0:
        x.remove(a)
    if b < 0:
        x.remove(b)
    if c < 0:
        x.remove(c)
    return  min(x)

def f2(a, b, c):
    x = [a,b,c]
    if a > 0:
        x.remove(a)
    if b > 0:
        x.remove(b)
    if c > 0:
        x.remove(c)
    return  max(x)
    
def f3(a, b, c):
    return  int(str(abs(a+b+c))[0])
    
def f4(a, b, c):
    return  int(str(abs(a+b+c))[-1])
    
def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

exec(input())

# 1640807, 2022-09-24 10:07:37, ----[PP][PPPP] (33%)

# 2565_1_Quiz_1_2.py

def f1(a, b, c):
    x = [a,b,c]
    if a < 0:
        x.remove(a)
    if b < 0:
        x.remove(b)
    if c < 0:
        x.remove(c)
    return  min(x)

def f2(a, b, c):
    x = [a,b,c]
    if a > 0:
        x.remove(a)
    if b > 0:
        x.remove(b)
    if c > 0:
        x.remove(c)
    return  max(x)
    
def f3(a, b, c):
    return  str(abs(a+b+c))[0]
    
def f4(a, b, c):
    return  str(abs(a+b+c))[-1]
    
def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

exec(input())

# 1640831, 2022-09-24 10:08:05, --PP[P-][PPPP] (50%)

# 2565_1_Quiz_1_2.py

def f1(a, b, c):
    x = [a,b,c]
    if a < 0:
        x.remove(a)
    if b < 0:
        x.remove(b)
    if c < 0:
        x.remove(c)
    return  int(min(x))

def f2(a, b, c):
    x = [a,b,c]
    if a > 0:
        x.remove(a)
    if b > 0:
        x.remove(b)
    if c > 0:
        x.remove(c)
    return  int(min(x))
    
def f3(a, b, c):
    return  int(str(abs(a+b+c))[0])
    
def f4(a, b, c):
    return  int(str(abs(a+b+c))[-1])
    
def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

exec(input())

# 1640857, 2022-09-24 10:08:42, --PP[PP][PPPP] (67%)

# 2565_1_Quiz_1_2.py

def f1(a, b, c):
    x = [a,b,c]
    if a < 0:
        x.remove(a)
    if b < 0:
        x.remove(b)
    if c < 0:
        x.remove(c)
    return  int(min(x))

def f2(a, b, c):
    x = [a,b,c]
    if a > 0:
        x.remove(a)
    if b > 0:
        x.remove(b)
    if c > 0:
        x.remove(c)
    return  int(max(x))
    
def f3(a, b, c):
    return  int(str(abs(a+b+c))[0])
    
def f4(a, b, c):
    return  int(str(abs(a+b+c))[-1])
    
def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

exec(input())


# 1640961, 2022-09-24 10:11:30, --PP[PP][PPPP] (67%)

# 2565_1_Quiz_1_2.py

def f1(a, b, c):
    x = [a,b,c]
    if a < 0:
        x.remove(a)
    if b < 0:
        x.remove(b)
    if c < 0:
        x.remove(c)
    return  int(min(x))

def f2(a, b, c):
    x = [a,b,c]
    if a > 0:
        x.remove(a)
    if b > 0:
        x.remove(b)
    if c > 0:
        x.remove(c)
    return  int(max(x))
    
def f3(a, b, c):
    return  int(str(abs(a+b+c))[0])
    
def f4(a, b, c):
    return  int(str(abs(a+b+c))[-1])
    
def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

exec(input().strip())


# 1641362, 2022-09-24 10:20:45, xxPP[xx][PPPP] (50%)

# 2565_1_Quiz_1_2.py
def f3(a, b, c):
    return  int(str(abs(a+b+c))[0])
    
def f4(a, b, c):
    return  int(str(abs(a+b+c))[-1])
    
def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

exec(input().strip())
# 1641381, 2022-09-24 10:21:02, --PP[PP][PPPP] (67%)

# 2565_1_Quiz_1_2.py

def f1(a, b, c):
    x = [a,b,c]
    if a < 0:
        x.remove(a)
    if b < 0:
        x.remove(b)
    if c < 0:
        x.remove(c)
    return  int(min(x))

def f2(a, b, c):
    x = [a,b,c]
    if a > 0:
        x.remove(a)
    if b > 0:
        x.remove(b)
    if c > 0:
        x.remove(c)
    return  int(max(x))
    
def f3(a, b, c):
    return  int(str(abs(a+b+c))[0])
    
def f4(a, b, c):
    return  int(str(abs(a+b+c))[-1])
    
def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

exec(input().strip())
# 1641425, 2022-09-24 10:22:02, PPPP[PP][PPPP] (100%)

# 2565_1_Quiz_1_2.py

def f1(a, b, c):
    x = [a,b,c]
    if a <= 0:
        x.remove(a)
    if b <= 0:
        x.remove(b)
    if c <= 0:
        x.remove(c)
    return  int(min(x))

def f2(a, b, c):
    x = [a,b,c]
    if a >= 0:
        x.remove(a)
    if b >= 0:
        x.remove(b)
    if c >= 0:
        x.remove(c)
    return  int(max(x))
    
def f3(a, b, c):
    return  int(str(abs(a+b+c))[0])
    
def f4(a, b, c):
    return  int(str(abs(a+b+c))[-1])
    
def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

exec(input().strip())



6530176421
# 1639834, 2022-09-24 09:40:44, xx--[-P][PPPP] (17%)

def f1(a, b, c):
    g=[]
    if a>0:
        g.append(a)   
    if b>0:
        g.append(b)
    if c>0:
        g.append
    return min(g)
#------------------------------
def f2(a, b, c):
    w=[]
    if a<0:
        w.append(a)   
    if b<0:
        w.append(b)
    if c<0:
        w.append
    return max(w)
#------------------------------
def f3(a, b, c):
    return (str(abs(a+b+c)))[0]
#------------------------------
def f4(a, b, c):
    return (str(abs(a+b+c)))[-1]
#------------------------------
def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]

    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c)
)
    else :
        print('Error')
#------------------------------
exec(input().strip()) 
# 1640225, 2022-09-24 09:51:29, xx--[-P][PPPP] (17%)

def f1(a, b, c):
    g=[]
    if a>0:
        g.append(a)   
    if b>0:
        g.append(b)
    if c>0:
        g.append
    return min(g)
#------------------------------
def f2(a, b, c):
    w=[]
    if a<0:
        w.append(a)   
    if b<0:
        w.append(b)
    if c<0:
        w.append
    return max(w)
#------------------------------
def f3(a, b, c):
    return (str(abs(a+b+c)))[0]
#------------------------------
def f4(a, b, c):
    return (str(a+b+c))[-1]
#------------------------------
def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]

    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else :
        print('Error')
#------------------------------
exec(input().strip())
# 1640233, 2022-09-24 09:51:46, xx--[-P][-P-P] (0%)

def f1(a, b, c):
    g=[]
    if a>0:
        g.append(a)   
    if b>0:
        g.append(b)
    if c>0:
        g.append
    return min(g)
#------------------------------
def f2(a, b, c):
    w=[]
    if a<0:
        w.append(a)   
    if b<0:
        w.append(b)
    if c<0:
        w.append
    return max(w)
#------------------------------
def f3(a, b, c):
    return (str(abs(a+b+c)))[0]
#------------------------------
def f4(a, b, c):
    return (str(a+b+c))[-1]
#------------------------------
def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]

    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
#------------------------------
exec(input().strip())
# 1640243, 2022-09-24 09:51:57, xx--[-P][PPPP] (17%)

def f1(a, b, c):
    g=[]
    if a>0:
        g.append(a)   
    if b>0:
        g.append(b)
    if c>0:
        g.append
    return min(g)
#------------------------------
def f2(a, b, c):
    w=[]
    if a<0:
        w.append(a)   
    if b<0:
        w.append(b)
    if c<0:
        w.append
    return max(w)
#------------------------------
def f3(a, b, c):
    return (str(abs(a+b+c)))[0]
#------------------------------
def f4(a, b, c):
    return (str(a+b+c))[-1]
#------------------------------
def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]

    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else :
        print('Error')
#------------------------------
exec(input().strip())
# 1640515, 2022-09-24 09:59:35, xx--[-P][PPPP] (17%)

def f1(a, b, c):
    g=[]
    if a>0:
        g.append(a)   
    if b>0:
        g.append(b)
    if c>0:
        g.append
    return min(g)
def f2(a, b, c):
    w=[]
    if a<0:
        w.append(a)   
    if b<0:
        w.append(b)
    if c<0:
        w.append
    return max(w)
def f3(a, b, c):
    return (str(abs(a+b+c)))[0]
def f4(a, b, c):
    return (str(a+b+c))[-1]
def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else :
        print('Error')
exec(input().strip())
# 1640563, 2022-09-24 10:01:03, Px--[PP][PPPP] (50%)

def f1(a, b, c):
    g=[]
    if a>0:
        g.append(a)   
    if b>0:
        g.append(b)
    if c>0:
        g.append(c)
    return min(g)
def f2(a, b, c):
    w=[]
    if a<0:
        w.append(a)   
    if b<0:
        w.append(b)
    if c<0:
        w.append
    return max(w)
def f3(a, b, c):
    return (str(abs(a+b+c)))[0]
def f4(a, b, c):
    return (str(a+b+c))[-1]
def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else :
        print('Error')
exec(input().strip())
# 1640734, 2022-09-24 10:05:47, Px--[PP][PPPP] (50%)

def f1(a, b, c):
    g=[]
    if a>0:
        g.append(a)   
    if b>0:
        g.append(b)
    if c>0:
        g.append(c)
    return min(g)
def f2(a, b, c):
    w=[]
    if a<0:
        w.append(a)   
    if b<0:
        w.append(b)
    if c<0:
        w.append
    return max(w)
def f3(a, b, c):
    return (str(abs(a+b+c)))[0]
def f4(a, b, c):
    return (str(a+b+c))[-1]
def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else :
        print('Error')
exec(input().strip())
# 1640778, 2022-09-24 10:06:45, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    g=[]
    if a>0:
        g.append(a)   
    if b>0:
        g.append(b)
    if c>0:
        g.append(c)
    return min(g)
def f2(a, b, c):
    w=[]
    if a<0:
        w.append(a)   
    if b<0:
        w.append(b)
    if c<0:
        w.append(c)
    return max(w)
def f3(a, b, c):
    return (str(abs(a+b+c)))[0]
def f4(a, b, c):
    return (str(a+b+c))[-1]
def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else :
        print('Error')
exec(input().strip())
# 1640827, 2022-09-24 10:08:03, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    g=[]
    if a>0:
        g.append(a)   
    if b>0:
        g.append(b)
    if c>0:
        g.append(c)
    return min(g)
def f2(a, b, c):
    w=[]
    if a<0:
        w.append(a)   
    if b<0:
        w.append(b)
    if c<0:
        w.append(c)
    return max(w)
def f3(a, b, c):
    return int((str(abs(a+b+c)))[0])
def f4(a, b, c):
    return int((str(abs(a+b+c)))[-1])
def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else :
        print('Error')
exec(input().strip())

6532084721
# 1639015, 2022-09-24 09:20:14, PP--[xx][xxxx] (33%)

def f1(a, b, c):
    mn = 2e9
    if a<mn and a>0: mn=a
    if b<mn and b>0: mn=b
    if c<mn and c>0: mn=c
    return mn

def f2(a, b, c):
    mx = -2e9
    if a>mx and a<0: mx=a
    if b>mx and b<0: mx=b
    if c>mx and c<0: mx=c
    return mx

def f3(a, b, c):
    ans = a+b+c
    strans = len(str(ans))
    return ans//(10**(strans-1))

def f4(a, b, c):
    ans = a+b+c
    return ans%10

def main():
    s1,s2,a,b,c = int(input().split())
    if s1 == 0 and s2 == 0: print(f1(a,b,c))
    elif s1 == 0 and s2 == 1: print(f2(a,b,c))
    elif s1 == 1 and s2 == 0: print(f3(a,b,c))
    elif s1 == 1 and s2 == 1: print(f4(a,b,c))
    else: print("Eror")

exec(input().strip()) 

# 1639089, 2022-09-24 09:21:52, PPP-[xx][xxxx] (50%)

def f1(a, b, c):
    mn = 2e9
    if a<mn and a>0: mn=a
    if b<mn and b>0: mn=b
    if c<mn and c>0: mn=c
    return mn

def f2(a, b, c):
    mx = -2e9
    if a>mx and a<0: mx=a
    if b>mx and b<0: mx=b
    if c>mx and c<0: mx=c
    return mx

def f3(a, b, c):
    ans = a+b+c
    strans = len(str(ans))
    return abs(ans//(10**(strans-1)))

def f4(a, b, c):
    ans = a+b+c
    return abs(ans%10)

def main():
    s1,s2,a,b,c = int(input().split())
    if s1 == 0 and s2 == 0: print(f1(a,b,c))
    elif s1 == 0 and s2 == 1: print(f2(a,b,c))
    elif s1 == 1 and s2 == 0: print(f3(a,b,c))
    elif s1 == 1 and s2 == 1: print(f4(a,b,c))
    else: print("Eror")

exec(input().strip()) 

# 1639254, 2022-09-24 09:25:47, PPP-[PP][-P--] (67%)

def f1(a, b, c):
    mn = 2e9
    if a<mn and a>0: mn=a
    if b<mn and b>0: mn=b
    if c<mn and c>0: mn=c
    return mn

def f2(a, b, c):
    mx = -2e9
    if a>mx and a<0: mx=a
    if b>mx and b<0: mx=b
    if c>mx and c<0: mx=c
    return mx

def f3(a, b, c):
    ans = a+b+c
    strans = len(str(ans))
    return abs(ans//(10**(strans-1)))

def f4(a, b, c):
    ans = a+b+c
    print(ans)
    return abs(ans)%10

def main():
    tmp = [int(e) for e in input().split()]
    s1 = tmp[0];s2 = tmp[1];a = tmp[2];b = tmp[3];c = tmp[4]
    if s1 == 0 and s2 == 0: print(f1(a,b,c))
    elif s1 == 0 and s2 == 1: print(f2(a,b,c))
    elif s1 == 1 and s2 == 0: print(f3(a,b,c))
    elif s1 == 1 and s2 == 1: print(f4(a,b,c))
    else: print("Eror")

exec(input().strip()) 

# 1639302, 2022-09-24 09:26:59, PPP-[PP][PPP-] (67%)

def f1(a, b, c):
    mn = 2e9
    if a<mn and a>0: mn=a
    if b<mn and b>0: mn=b
    if c<mn and c>0: mn=c
    return mn

def f2(a, b, c):
    mx = -2e9
    if a>mx and a<0: mx=a
    if b>mx and b<0: mx=b
    if c>mx and c<0: mx=c
    return mx

def f3(a, b, c):
    ans = a+b+c
    strans = len(str(ans))
    return abs(ans//(10**(strans-1)))

def f4(a, b, c):
    ans = a+b+c
    print(ans)
    return abs(ans)%10

def main():
    tmp = [int(e) for e in input().split()]
    s1 = tmp[0];s2 = tmp[1];a = tmp[2];b = tmp[3];c = tmp[4]
    if s1 == 0 and s2 == 0: print(f1(a,b,c))
    elif s1 == 0 and s2 == 1: print(f2(a,b,c))
    elif s1 == 1 and s2 == 0: print(f3(a,b,c))
    elif s1 == 1 and s2 == 1: print(f4(a,b,c))
    else: print("Error")

exec(input().strip())
# 1639358, 2022-09-24 09:28:26, PPPP[PP][PPP-] (83%)

def f1(a, b, c):
    mn = 2e9
    if a<mn and a>0: mn=a
    if b<mn and b>0: mn=b
    if c<mn and c>0: mn=c
    return mn

def f2(a, b, c):
    mx = -2e9
    if a>mx and a<0: mx=a
    if b>mx and b<0: mx=b
    if c>mx and c<0: mx=c
    return mx

def f3(a, b, c):
    ans = a+b+c
    strans = len(str(ans))
    return abs(ans//(10**(strans-1)))

def f4(a, b, c):
    ans = a+b+c
    return abs(ans)%10

def main():
    tmp = [int(e) for e in input().split()]
    s1 = tmp[0];s2 = tmp[1];a = tmp[2];b = tmp[3];c = tmp[4]
    if s1 == 0 and s2 == 0: print(f1(a,b,c))
    elif s1 == 0 and s2 == 1: print(f2(a,b,c))
    elif s1 == 1 and s2 == 0: print(f3(a,b,c))
    elif s1 == 1 and s2 == 1: print(f4(a,b,c))
    else: print("Error")

exec(input().strip())
# 1639587, 2022-09-24 09:34:08, PPPP[PP][PPP-] (83%)

def f1(a, b, c):
    mn = 2e9
    if a<mn and a>0: mn=a
    if b<mn and b>0: mn=b
    if c<mn and c>0: mn=c
    return mn

def f2(a, b, c):
    mx = -2e9
    if a>mx and a<0: mx=a
    if b>mx and b<0: mx=b
    if c>mx and c<0: mx=c
    return mx

def f3(a, b, c):
    ans = a+b+c
    strans = len(str(ans))
    return abs(ans//(10**(strans-1)))

def f4(a, b, c):
    ans = a+b+c
    return abs(ans)%10

def main():
    tmp = [int(e) for e in input().split()]
    s1 = tmp[0];s2 = tmp[1];a = tmp[2];b = tmp[3];c = tmp[4]
    if s1 == 0 and s2 == 0:   print(f1(a,b,c))
    elif s1 == 0 and s2 == 1: print(f2(a,b,c))
    elif s1 == 1 and s2 == 0: print(f3(a,b,c))
    elif s1 == 1 and s2 == 1: print(f4(a,b,c))
    else: print("Error")

exec(input().strip()) 

# 1639750, 2022-09-24 09:38:33, PPPP[PP][PPP-] (83%)

def f1(a, b, c):
    mn = 2e9
    if a<mn and a>0: mn=a
    if b<mn and b>0: mn=b
    if c<mn and c>0: mn=c
    
    if mn == 2e9: mn = 0
    return mn

def f2(a, b, c):
    mx = -2e9
    if a>mx and a<0: mx=a
    if b>mx and b<0: mx=b
    if c>mx and c<0: mx=c

    if mx == -2e9: mx=0
    return mx

def f3(a, b, c):
    ans = a+b+c
    strans = len(str(ans))
    return abs(ans//(10**(strans-1)))

def f4(a, b, c):
    ans = a+b+c
    return abs(ans)%10

def main():
    tmp = [int(e) for e in input().split()]
    s1 = tmp[0];s2 = tmp[1];a = tmp[2];b = tmp[3];c = tmp[4]
    if s1 == 0 and s2 == 0:   print(f1(a,b,c))
    elif s1 == 0 and s2 == 1: print(f2(a,b,c))
    elif s1 == 1 and s2 == 0: print(f3(a,b,c))
    elif s1 == 1 and s2 == 1: print(f4(a,b,c))
    else: print("Error")

exec(input().strip()) 

# 1640744, 2022-09-24 10:06:01, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    mn = 2e9
    if a<mn and a>0: mn=a
    if b<mn and b>0: mn=b
    if c<mn and c>0: mn=c
    
    if mn == 2e9: mn = 0
    return mn

def f2(a, b, c):
    mx = -2e9
    if a>mx and a<0: mx=a
    if b>mx and b<0: mx=b
    if c>mx and c<0: mx=c

    if mx == -2e9: mx=0
    return mx

def f3(a, b, c):
    ans = abs(a+b+c)
    strans = len(str(ans))
    return ans//(10**(strans-1))

def f4(a, b, c):
    ans = abs(a+b+c)
    return ans%10

def main():
    tmp = [int(e) for e in input().split()]
    s1 = tmp[0];s2 = tmp[1];a = tmp[2];b = tmp[3];c = tmp[4]
    if s1 == 0 and s2 == 0:   print(f1(a,b,c))
    elif s1 == 0 and s2 == 1: print(f2(a,b,c))
    elif s1 == 1 and s2 == 0: print(f3(a,b,c))
    elif s1 == 1 and s2 == 1: print(f4(a,b,c))
    else: print("Error")

exec(input().strip())
# 1640752, 2022-09-24 10:06:12, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    mn = 2e9
    if a<mn and a>0: mn=a
    if b<mn and b>0: mn=b
    if c<mn and c>0: mn=c
    
    return mn

def f2(a, b, c):
    mx = -2e9
    if a>mx and a<0: mx=a
    if b>mx and b<0: mx=b
    if c>mx and c<0: mx=c

    return mx

def f3(a, b, c):
    ans = abs(a+b+c)
    strans = len(str(ans))
    return ans//(10**(strans-1))

def f4(a, b, c):
    ans = abs(a+b+c)
    return ans%10

def main():
    tmp = [int(e) for e in input().split()]
    s1 = tmp[0];s2 = tmp[1];a = tmp[2];b = tmp[3];c = tmp[4]
    if s1 == 0 and s2 == 0:   print(f1(a,b,c))
    elif s1 == 0 and s2 == 1: print(f2(a,b,c))
    elif s1 == 1 and s2 == 0: print(f3(a,b,c))
    elif s1 == 1 and s2 == 1: print(f4(a,b,c))
    else: print("Error")

exec(input().strip())

6230083421
# 1638786, 2022-09-24 09:15:04, Pxxx[xx][xxxx] (17%)

def f1(a, b, c):
    out = [] ; res =[]
    out.append(a)
    out.append(b)
    out.append(c)
    for i in out:
        if i > 0:
            res.append(i)
    return(min(res))

exec(input().strip())
# 1638836, 2022-09-24 09:16:16, PPxx[xx][xxxx] (33%)

def f1(a, b, c):
    out = [] ; res =[]
    out.append(a)
    out.append(b)
    out.append(c)
    for i in out:
        if i > 0:
            res.append(i)
    return(min(res))
  
def f2(a, b, c):
    out = [] ; res =[]
    out.append(a)
    out.append(b)
    out.append(c)
    for i in out:
        if i < 0:
            res.append(i)
    return(max(res))
    

exec(input().strip())
# 1638988, 2022-09-24 09:19:37, PP-x[xx][xxxx] (33%)

def f1(a, b, c):
    out = [] ; res =[]
    out.append(a)
    out.append(b)
    out.append(c)
    for i in out:
        if i > 0:
            res.append(i)
    return(min(res))
  
def f2(a, b, c):
    out = [] ; res =[]
    out.append(a)
    out.append(b)
    out.append(c)
    for i in out:
        if i < 0:
            res.append(i)
    return(max(res))
    
def f3(a, b, c):
    out = [] ; res =[]
    out.append(a)
    out.append(b)
    out.append(c)
    res = sum(out)
    if res < 0:
        return str(-res)[0]
    else:
        return str(res)[0]
        
exec(input().strip())
# 1639035, 2022-09-24 09:20:45, PP--[xx][xxxx] (33%)

def f1(a, b, c):
    out = [] ; res =[]
    out.append(a)
    out.append(b)
    out.append(c)
    for i in out:
        if i > 0:
            res.append(i)
    return(min(res))
  
def f2(a, b, c):
    out = [] ; res =[]
    out.append(a)
    out.append(b)
    out.append(c)
    for i in out:
        if i < 0:
            res.append(i)
    return(max(res))
    
def f3(a, b, c):
    out = [] ; res =[]
    out.append(a)
    out.append(b)
    out.append(c)
    res = sum(out)
    if res < 0:
        return str(-res)[0]
    else:
        return str(res)[0]
        
def f4(a, b, c):
    out = [] ; res =[]
    out.append(a)
    out.append(b)
    out.append(c)
    res = sum(out)
    if res < 0:
        return str(-res)[-1]
    else:
        return str(res)[-1]
        
exec(input().strip())
# 1639075, 2022-09-24 09:21:36, PP-P[xx][xxxx] (50%)

def f1(a, b, c):
    out = [] ; res =[]
    out.append(a)
    out.append(b)
    out.append(c)
    for i in out:
        if i > 0:
            res.append(i)
    return(min(res))

def f2(a, b, c):
    out = [] ; res =[]
    out.append(a)
    out.append(b)
    out.append(c)
    for i in out:
        if i < 0:
            res.append(i)
    return(max(res))
    
def f3(a, b, c):
    out = [] ; res =[]
    out.append(a)
    out.append(b)
    out.append(c)
    res = sum(out)
    if res < 0:
        return str(-res)[0]
    else:
        return str(res)[0]
            
def f4(a, b, c):
    out = [] ; res =[]
    out.append(a)
    out.append(b)
    out.append(c)
    res = sum(out)
    if res < 0:
        return int(str(-res)[-1])
    else:
        return int(str(res)[-1])
        
exec(input().strip())
# 1639212, 2022-09-24 09:24:40, PP-P[PP][-P-P] (67%)

def f1(a, b, c):
    out = [] ; res =[]
    out.append(a)
    out.append(b)
    out.append(c)
    for i in out:
        if i > 0:
            res.append(i)
    return(min(res))

def f2(a, b, c):
    out = [] ; res =[]
    out.append(a)
    out.append(b)
    out.append(c)
    for i in out:
        if i < 0:
            res.append(i)
    return(max(res))
    
def f3(a, b, c):
    out = [] ; res =[]
    out.append(a)
    out.append(b)
    out.append(c)
    res = sum(out)
    if res < 0:
        return str(-res)[0]
    else:
        return str(res)[0]
            
def f4(a, b, c):
    out = [] ; res =[]
    out.append(a)
    out.append(b)
    out.append(c)
    res = sum(out)
    if res < 0:
        return int(str(-res)[-1])
    else:
        return int(str(res)[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0: print(f1(a, b, c))
    elif s1 == 0 and s2 == 1: print(f2(a, b, c)) 
    elif s1 == 1 and s2 == 0: print(f3(a, b, c))
    elif s1 == 1 and s2 == 1: print(f4(a, b, c))
    else: print('ERROR')
exec(input().strip()) # DON'T remove this line

# 1639230, 2022-09-24 09:25:09, PP-P[PP][PPPP] (83%)

def f1(a, b, c):
    out = [] ; res =[]
    out.append(a)
    out.append(b)
    out.append(c)
    for i in out:
        if i > 0:
            res.append(i)
    return(min(res))

def f2(a, b, c):
    out = [] ; res =[]
    out.append(a)
    out.append(b)
    out.append(c)
    for i in out:
        if i < 0:
            res.append(i)
    return(max(res))
    
def f3(a, b, c):
    out = [] ; res =[]
    out.append(a)
    out.append(b)
    out.append(c)
    res = sum(out)
    if res < 0:
        return str(-res)[0]
    else:
        return str(res)[0]
            
def f4(a, b, c):
    out = [] ; res =[]
    out.append(a)
    out.append(b)
    out.append(c)
    res = sum(out)
    if res < 0:
        return int(str(-res)[-1])
    else:
        return int(str(res)[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0: print(f1(a, b, c))
    elif s1 == 0 and s2 == 1: print(f2(a, b, c)) 
    elif s1 == 1 and s2 == 0: print(f3(a, b, c))
    elif s1 == 1 and s2 == 1: print(f4(a, b, c))
    else: print('Error')
exec(input().strip()) # DON'T remove this line

# 1639259, 2022-09-24 09:25:50, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    out = [] ; res =[]
    out.append(a)
    out.append(b)
    out.append(c)
    for i in out:
        if i > 0:
            res.append(i)
    return(min(res))

def f2(a, b, c):
    out = [] ; res =[]
    out.append(a)
    out.append(b)
    out.append(c)
    for i in out:
        if i < 0:
            res.append(i)
    return(max(res))
    
def f3(a, b, c):
    out = [] ; res =[]
    out.append(a)
    out.append(b)
    out.append(c)
    res = sum(out)
    if res < 0:
        return int(str(-res)[0])
    else:
        return int(str(res)[0])
            
def f4(a, b, c):
    out = [] ; res =[]
    out.append(a)
    out.append(b)
    out.append(c)
    res = sum(out)
    if res < 0:
        return int(str(-res)[-1])
    else:
        return int(str(res)[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0: print(f1(a, b, c))
    elif s1 == 0 and s2 == 1: print(f2(a, b, c)) 
    elif s1 == 1 and s2 == 0: print(f3(a, b, c))
    elif s1 == 1 and s2 == 1: print(f4(a, b, c))
    else: print('Error')
exec(input().strip()) # DON'T remove this line


6231720721
# 1638848, 2022-09-24 09:16:45, -xxx[xx][xxxx] (0%)

def f1(a,b,c):
    if a>0 and b>0 and c>0:
        return min(a,b,c)
    
exec(input().strip()) # DON'T remove this line

# 1638939, 2022-09-24 09:18:28, -xxx[xx][xxxx] (0%)

def f1(a,b,c):
    if int(a)>0 and int(b)>0 and int(c)>0:
        return min(int(a),int(b),int(c))
    
exec(input().strip()) # DON'T remove this line

# 1639124, 2022-09-24 09:22:36, Pxxx[xx][xxxx] (17%)

def f1(a,b,c):
    l = []
    a=int(a)
    b=int(b)
    c=int(c)
    if a>0:  
        l.append(a)
    if b>0:
        l.append(b)
    if c>0:
        l.append(c)
    return min(l)
    
exec(input().strip()) # DON'T remove this line
# 1639175, 2022-09-24 09:23:56, PPxx[xx][xxxx] (33%)

def f1(a,b,c):
    l = []
    a=int(a)
    b=int(b)
    c=int(c)
    if a>0:  
        l.append(a)
    if b>0:
        l.append(b)
    if c>0:
        l.append(c)
    return min(l)

def f2(a,b,c):
    l = []
    a=int(a)
    b=int(b)
    c=int(c)
    if a<0:  
        l.append(a)
    if b<0:
        l.append(b)
    if c<0:
        l.append(c)
    return max(l)
    
exec(input().strip()) # DON'T remove this line
# 1639320, 2022-09-24 09:27:23, PP-x[xx][xxxx] (33%)

def f1(a,b,c):
    l = []
    a=int(a)
    b=int(b)
    c=int(c)
    if a>0:  
        l.append(a)
    if b>0:
        l.append(b)
    if c>0:
        l.append(c)
    return min(l)

def f2(a,b,c):
    l = []
    a=int(a)
    b=int(b)
    c=int(c)
    if a<0:  
        l.append(a)
    if b<0:
        l.append(b)
    if c<0:
        l.append(c)
    return max(l)

def f3(a,b,c):
    a=int(a)
    b=int(b)
    c=int(c)
    r = abs(a+b+c)
    r = str(r)
    return r[0]
    


exec(input().strip()) # DON'T remove this line
# 1639386, 2022-09-24 09:29:08, PPPx[xx][xxxx] (50%)

def f1(a,b,c):
    l = []
    a=int(a)
    b=int(b)
    c=int(c)
    if a>0:  
        l.append(a)
    if b>0:
        l.append(b)
    if c>0:
        l.append(c)
    return min(l)

def f2(a,b,c):
    l = []
    a=int(a)
    b=int(b)
    c=int(c)
    if a<0:  
        l.append(a)
    if b<0:
        l.append(b)
    if c<0:
        l.append(c)
    return max(l)

def f3(a,b,c):
    a=int(a)
    b=int(b)
    c=int(c)
    r = abs(a+b+c)
    r = str(r)
    return int(r[0])
    
# exec(input().strip()) 

    


exec(input().strip()) # DON'T remove this line
# 1639437, 2022-09-24 09:30:24, PPPP[xx][xxxx] (67%)

def f1(a,b,c):
    l = []
    a=int(a)
    b=int(b)
    c=int(c)
    if a>0:  
        l.append(a)
    if b>0:
        l.append(b)
    if c>0:
        l.append(c)
    return min(l)

def f2(a,b,c):
    l = []
    a=int(a)
    b=int(b)
    c=int(c)
    if a<0:  
        l.append(a)
    if b<0:
        l.append(b)
    if c<0:
        l.append(c)
    return max(l)

def f3(a,b,c):
    a=int(a)
    b=int(b)
    c=int(c)
    r = abs(a+b+c)
    r = str(r)
    return int(r[0])

def f4(a,b,c):
    a=int(a)
    b=int(b)
    c=int(c)
    r = abs(a+b+c)
    r = str(r)
    return int(r[-1])
# exec(input().strip()) 


    


exec(input().strip()) # DON'T remove this line
# 1639627, 2022-09-24 09:34:59, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    l = []
    a=int(a)
    b=int(b)
    c=int(c)
    if a>0:  
        l.append(a)
    if b>0:
        l.append(b)
    if c>0:
        l.append(c)
    return min(l)

def f2(a,b,c):
    l = []
    a=int(a)
    b=int(b)
    c=int(c)
    if a<0:  
        l.append(a)
    if b<0:
        l.append(b)
    if c<0:
        l.append(c)
    return max(l)

def f3(a,b,c):
    a=int(a)
    b=int(b)
    c=int(c)
    r = abs(a+b+c)
    r = str(r)
    return int(r[0])

def f4(a,b,c):
    a=int(a)
    b=int(b)
    c=int(c)
    r = abs(a+b+c)
    r = str(r)
    return int(r[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

# exec(input().strip()) 



    


exec(input().strip()) # DON'T remove this line

6231422721
# 1639140, 2022-09-24 09:23:05, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    if a <= 0 :
        return min(b,c)
    if b <= 0 :
        return min(a,c)
    if c <= 0 :
        return min(a,b)
    

def f2(a, b, c):
    if a >= 0 :
        return max(b,c)
    if b >= 0 :
        return max(a,c)
    if c >= 0 :
        return max(a,b)

def f3(a, b, c):
    return int(str(abs(a+b+c))[0])

def f4(a, b, c):
    return int(str(abs(a+b+c))[-1])

def main() :
    s1,s2,a,b,c = [int(e) for e in input().strip().split()]
    if s1 ==0 and s2 ==0 :
        print(f1(a, b, c))
    elif s1 ==0 and s2 ==1 :
        print(f2(a, b, c))
    elif s1 ==1 and s2 ==0 :
        print(f3(a, b, c))
    elif s1 ==1 and s2 ==1 :
        print(f4(a, b, c))
    else :
        print("Error")

exec(input().strip()) # DON'T remove this line

# 1640478, 2022-09-24 09:58:56, compilation error (0%)

def f1(a, b, c):
    if a <= 0 and min(a,b,c) == min(b,c):
        return min(b,c)
    if b <= 0 and min(a,b,c) == min(a,c):
        return min(a,c)
    if c <= and min(a,b,c) == min(a,b): :
        return min(a,b)
    

def f2(a, b, c):
    if a >= 0 :
        return max(b,c)
    if b >= 0 :
        return max(a,c)
    if c >= 0 :
        return max(a,b)

def f3(a, b, c):
    return int(str(abs(a+b+c))[0])

def f4(a, b, c):
    return int(str(abs(a+b+c))[-1])

def main() :
    s1,s2,a,b,c = [int(e) for e in input().strip().split()]
    if s1 ==0 and s2 ==0 :
        print(f1(a, b, c))
    elif s1 ==0 and s2 ==1 :
        print(f2(a, b, c))
    elif s1 ==1 and s2 ==0 :
        print(f3(a, b, c))
    elif s1 ==1 and s2 ==1 :
        print(f4(a, b, c))
    else :
        print("Error")

exec(input().strip()) # DON'T remove this line

# 1640497, 2022-09-24 09:59:18, compilation error (0%)

def f1(a, b, c):
    if a <= 0 and min(a,b,c) == min(b,c):
        return min(b,c)
    if b <= 0 and min(a,b,c) == min(a,c):
        return min(a,c)
    if c <= 0 and min(a,b,c) == min(a,b): :
        return min(a,b)
    

def f2(a, b, c):
    if a >= 0 :
        return max(b,c)
    if b >= 0 :
        return max(a,c)
    if c >= 0 :
        return max(a,b)

def f3(a, b, c):
    return int(str(abs(a+b+c))[0])

def f4(a, b, c):
    return int(str(abs(a+b+c))[-1])

def main() :
    s1,s2,a,b,c = [int(e) for e in input().strip().split()]
    if s1 ==0 and s2 ==0 :
        print(f1(a, b, c))
    elif s1 ==0 and s2 ==1 :
        print(f2(a, b, c))
    elif s1 ==1 and s2 ==0 :
        print(f3(a, b, c))
    elif s1 ==1 and s2 ==1 :
        print(f4(a, b, c))
    else :
        print("Error")

exec(input().strip()) # DON'T remove this line
# 1640512, 2022-09-24 09:59:33, --PP[-P][PPPP] (50%)

def f1(a, b, c):
    if a <= 0 and min(a,b,c) == min(b,c):
        return min(b,c)
    if b <= 0 and min(a,b,c) == min(a,c):
        return min(a,c)
    if c <= 0 and min(a,b,c) == min(a,b): 
        return min(a,b)
    

def f2(a, b, c):
    if a >= 0 :
        return max(b,c)
    if b >= 0 :
        return max(a,c)
    if c >= 0 :
        return max(a,b)

def f3(a, b, c):
    return int(str(abs(a+b+c))[0])

def f4(a, b, c):
    return int(str(abs(a+b+c))[-1])

def main() :
    s1,s2,a,b,c = [int(e) for e in input().strip().split()]
    if s1 ==0 and s2 ==0 :
        print(f1(a, b, c))
    elif s1 ==0 and s2 ==1 :
        print(f2(a, b, c))
    elif s1 ==1 and s2 ==0 :
        print(f3(a, b, c))
    elif s1 ==1 and s2 ==1 :
        print(f4(a, b, c))
    else :
        print("Error")

exec(input().strip()) # DON'T remove this line
# 1640527, 2022-09-24 09:59:56, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    if a <= 0 :
        return min(b,c)
    if b <= 0 :
        return min(a,c)
    if c <= 0 :
        return min(a,b)
    

def f2(a, b, c):
    if a >= 0 :
        return max(b,c)
    if b >= 0 :
        return max(a,c)
    if c >= 0 :
        return max(a,b)

def f3(a, b, c):
    return int(str(abs(a+b+c))[0])

def f4(a, b, c):
    return int(str(abs(a+b+c))[-1])

def main() :
    s1,s2,a,b,c = [int(e) for e in input().strip().split()]
    if s1 ==0 and s2 ==0 :
        print(f1(a, b, c))
    elif s1 ==0 and s2 ==1 :
        print(f2(a, b, c))
    elif s1 ==1 and s2 ==0 :
        print(f3(a, b, c))
    elif s1 ==1 and s2 ==1 :
        print(f4(a, b, c))
    else :
        print("Error")

exec(input().strip()) # DON'T remove this line
# 1640590, 2022-09-24 10:01:57, compilation error (0%)

def f1(a, b, c):
    result = [a,b,c]
    report = []
    for i in result :
        if i > 0 :
            report.append(i)
    return min(report)
    

def f2(a, b, c):
    if a >= 0 :
        return max(b,c)
    if b >= 0 :
        return max(a,c)
    if c >= 0 :
        return max(a,b)

def f3(a, b, c):
    return int(str(abs(a+b+c))[0])

def f4(a, b, c):
    return int(str(abs(a+b+c))[-1])

def main() :
    s1,s2,a,b,c = [int(e) for e in input().strip().split()]
    if s1 ==0 and s2 ==0 :
        print(f1(a, b, c))
    elif s1 ==0 and s2 ==1 :
        print(f2(a, b, c))
    elif s1 ==1 and s2 ==0 :
        print(f3(a, b, c))
    elif s1 ==1 and s2 ==1 :
        print(f4(a, b, c))
    else :
        print("Error")

exec(input().strip()) # DON'T remove this line

    else :
        print("Error")

exec(input().strip()) # DON'T remove this line
# 1640619, 2022-09-24 10:02:38, P-PP[PP][PPPP] (83%)

def f1(a, b, c):
    result = [a,b,c]
    report = []
    for i in result :
        if i > 0 :
            report.append(i)
    return min(report)
    

def f2(a, b, c):
    if a >= 0 :
        return max(b,c)
    if b >= 0 :
        return max(a,c)
    if c >= 0 :
        return max(a,b)

def f3(a, b, c):
    return int(str(abs(a+b+c))[0])

def f4(a, b, c):
    return int(str(abs(a+b+c))[-1])

def main() :
    s1,s2,a,b,c = [int(e) for e in input().strip().split()]
    if s1 ==0 and s2 ==0 :
        print(f1(a, b, c))
    elif s1 ==0 and s2 ==1 :
        print(f2(a, b, c))
    elif s1 ==1 and s2 ==0 :
        print(f3(a, b, c))
    elif s1 ==1 and s2 ==1 :
        print(f4(a, b, c))
    else :
        print("Error")



exec(input().strip()) # DON'T remove this line
# 1640634, 2022-09-24 10:03:12, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    result = [a,b,c]
    report = []
    for i in result :
        if i > 0 :
            report.append(i)
    return min(report)
    

def f2(a, b, c):
    result = [a,b,c]
    report = []
    for i in result :
        if i < 0 :
            report.append(i)
    return max(report)

def f3(a, b, c):
    return int(str(abs(a+b+c))[0])

def f4(a, b, c):
    return int(str(abs(a+b+c))[-1])

def main() :
    s1,s2,a,b,c = [int(e) for e in input().strip().split()]
    if s1 ==0 and s2 ==0 :
        print(f1(a, b, c))
    elif s1 ==0 and s2 ==1 :
        print(f2(a, b, c))
    elif s1 ==1 and s2 ==0 :
        print(f3(a, b, c))
    elif s1 ==1 and s2 ==1 :
        print(f4(a, b, c))
    else :
        print("Error")



exec(input().strip()) # DON'T remove this line

6431112321
# 1639490, 2022-09-24 09:31:37, Pxxx[xx][xxxx] (17%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for i in range(len(x)):
        x[i] = int(x[i])
        if x[i] > 0 :
            y.append(x[i])
    y.sort()
    return y[0]
exec(input().strip()) # DON'T remove this line
# 1639586, 2022-09-24 09:34:03, PPxx[xx][xxxx] (33%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for i in range(len(x)):
        x[i] = int(x[i])
        if x[i] > 0 :
            y.append(x[i])
    y.sort()
    return y[0]
def f2(a, b, c):
    x = [a,b,c]
    y = []
    for i in range(len(x)):
        x[i] = int(x[i])
        if x[i] < 0 :
            y.append(x[i])
    y.sort()
    y = y[::-1]
    return y[0]
exec(input().strip()) # DON'T remove this line
# 1639819, 2022-09-24 09:40:23, PP-x[xx][xxxx] (33%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for i in range(len(x)):
        x[i] = int(x[i])
        if x[i] > 0 :
            y.append(x[i])
    y.sort()
    return y[0]
def f2(a, b, c):
    x = [a,b,c]
    y = []
    for i in range(len(x)):
        x[i] = int(x[i])
        if x[i] < 0 :
            y.append(x[i])
    y.sort()
    y = y[::-1]
    return y[0]
def f3(a, b, c):
    x = a+b+c
    if x < 0 :
        x = x*-1
    x = str(x)
    y = x[0]
    return y
exec(input().strip()) # DON'T remove this line
# 1639843, 2022-09-24 09:40:50, PP-x[xx][xxxx] (33%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for i in range(len(x)):
        x[i] = int(x[i])
        if x[i] > 0 :
            y.append(x[i])
    y.sort()
    return y[0]
def f2(a, b, c):
    x = [a,b,c]
    y = []
    for i in range(len(x)):
        x[i] = int(x[i])
        if x[i] < 0 :
            y.append(x[i])
    y.sort()
    y = y[::-1]
    return y[0]
def f3(a, b, c):
    x = a+b+c
    if x < 0 :
        x = x*-1
    x = str(x)
    y = x[0]
    return y
exec(input().strip()) # DON'T remove this line
# 1639950, 2022-09-24 09:43:51, PPPx[xx][xxxx] (50%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for i in range(len(x)):
        x[i] = int(x[i])
        if x[i] > 0 :
            y.append(x[i])
    y.sort()
    return y[0]
def f2(a, b, c):
    x = [a,b,c]
    y = []
    for i in range(len(x)):
        x[i] = int(x[i])
        if x[i] < 0 :
            y.append(x[i])
    y.sort()
    y = y[::-1]
    return y[0]
def f3(a, b, c):
    x = int(a)+int(b)+int(c)
    if x < 0 :
        x = x*-1
    x = str(x)
    y = x[0]
    y = int(y)
    return y
exec(input().strip()) # DON'T remove this line
# 1640023, 2022-09-24 09:46:11, PPPP[xx][xxxx] (67%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for i in range(len(x)):
        x[i] = int(x[i])
        if x[i] > 0 :
            y.append(x[i])
    y.sort()
    return y[0]
def f2(a, b, c):
    x = [a,b,c]
    y = []
    for i in range(len(x)):
        x[i] = int(x[i])
        if x[i] < 0 :
            y.append(x[i])
    y.sort()
    y = y[::-1]
    return y[0]
def f3(a, b, c):
    x = int(a)+int(b)+int(c)
    if x < 0 :
        x = x*-1
    x = str(x)
    y = x[0]
    y = int(y)
    return y
def f4(a, b, c):
    x = int(a)+int(b)+int(c)
    if x < 0 :
        x = x*-1
    x = str(x)
    y = x[-1]
    y = int(y)
    return y
exec(input().strip()) # DON'T remove this line
# 1641548, 2022-09-24 10:24:33, PPPP[PP][-P-P] (83%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for i in range(len(x)):
        x[i] = int(x[i])
        if x[i] > 0 :
            y.append(x[i])
    y.sort()
    return y[0]
def f2(a, b, c):
    x = [a,b,c]
    y = []
    for i in range(len(x)):
        x[i] = int(x[i])
        if x[i] < 0 :
            y.append(x[i])
    y.sort()
    y = y[::-1]
    return y[0]
def f3(a, b, c):
    x = int(a)+int(b)+int(c)
    if x < 0 :
        x = x*-1
    x = str(x)
    y = x[0]
    y = int(y)
    return y
def f4(a, b, c):
    x = int(a)+int(b)+int(c)
    if x < 0 :
        x = x*-1
    x = str(x)
    y = x[-1]
    y = int(y)
    return y
def main():
    s1,s2,a,b,c = [e for e in input().split()]
    y = [s1,s2,a,b,c]
    m = 0
    if int(y[0]) == 0 and int(y[1]) == 0 :
        m += (f1(int(a),int(b),int(c)))
    if int(y[0]) == 0 and int(y[1]) == 1 :
        m += (f2(int(a),int(b),int(c)))
    if int(y[0]) == 1 and int(y[1]) == 0 :
        m += (f3(int(a),int(b),int(c)))
    if int(y[0]) == 1 and int(y[1]) == 1 :
        m += (f4(int(a),int(b),int(c)))
    return print(m)
exec(input().strip()) # DON'T remove this line
# 1641695, 2022-09-24 10:27:10, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for i in range(len(x)):
        x[i] = int(x[i])
        if x[i] > 0 :
            y.append(x[i])
    y.sort()
    return y[0]
def f2(a, b, c):
    x = [a,b,c]
    y = []
    for i in range(len(x)):
        x[i] = int(x[i])
        if x[i] < 0 :
            y.append(x[i])
    y.sort()
    y = y[::-1]
    return y[0]
def f3(a, b, c):
    x = int(a)+int(b)+int(c)
    if x < 0 :
        x = x*-1
    x = str(x)
    y = x[0]
    y = int(y)
    return y
def f4(a, b, c):
    x = int(a)+int(b)+int(c)
    if x < 0 :
        x = x*-1
    x = str(x)
    y = x[-1]
    y = int(y)
    return y
def main():
    s1,s2,a,b,c = [e for e in input().split()]
    y = [s1,s2,a,b,c]
    m = 0
    if int(y[0]) == 0 and int(y[1]) == 0 :
        m += (f1(int(a),int(b),int(c)))
    elif int(y[0]) == 0 and int(y[1]) == 1 :
        m += (f2(int(a),int(b),int(c)))
    elif int(y[0]) == 1 and int(y[1]) == 0 :
        m += (f3(int(a),int(b),int(c)))
    elif int(y[0]) == 1 and int(y[1]) == 1 :
        m += (f4(int(a),int(b),int(c)))
    else :
        m = 'Error'
    return print(m)
exec(input().strip()) # DON'T remove this line

6530005821
# 1639828, 2022-09-24 09:40:39, PPx-[PP][PxPP] (50%)

def f1(a, b, c):
    t = [a,b,c]
    t.sort()
    if t[0]>0:
        return t[0]
    else:
        if t[1]>0:
            return t[1]
        else:
            return t[2]
        
def f2(a,b,c):
    t = [a,b,c]
    t.sort()
    if t[1]<0:
        return t[1]
    else:
        return t[0]

def f3(a,b,c):
    total = a+b+c
    if total < 0:
        total = str(total)
        return total[1]
    else:
        return total[0]

def f4(a, b, c):
    total2 = a+b+c
    total2 = str(total2)
    return total2[len(total2)-1]

def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1 == 0 and s2==0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print (f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')


exec(input().strip())
# 1641310, 2022-09-24 10:19:41, PPx-[PP][PxPP] (50%)

def f1(a, b, c):
  t = [a,b,c]
  t.sort()
  if t[1]>0:
      return t[1]
  else:
      return t[2]
def f2(a,b,c):
    t = [a,b,c]
    t.sort()
    if t[1]<0:
        return t[1]
    else:
        return t[0]

def f3(a,b,c):
    total = a+b+c
    if total < 0:
        total = str(total)
        return total[1]
    else:
        return total[0]

def f4(a, b, c):
    total2 = a+b+c
    total2 = str(total2)
    return total2[len(total2)-1]

def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1 == 0 and s2==0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print (f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')


exec(input().strip())
# 1641405, 2022-09-24 10:21:34, PPx-[PP][PxPP] (50%)

def f1(a, b, c):
  t = [a,b,c]
  t.sort()
  if t[1]>0:
      return t[1]
  else:
      return t[2]

def f2(a,b,c):
    t = [a,b,c]
    t.sort()
    if t[1]<0:
        return t[1]
    else:
        return t[0]

def f3(a,b,c):
    total = a+b+c
    if total < 0:
        total = total*-1
        total = str(total)
        return total[0]
    else:
        return total[0]

def f4(a, b, c):
    total2 = a+b+c
    total2 = str(total2)
    return total2[len(total2)-1]

def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1 == 0 and s2==0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print (f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')


exec(input().strip())
# 1641458, 2022-09-24 10:22:41, PPxP[PP][PxPP] (67%)

def f1(a, b, c):
  t = [a,b,c]
  t.sort()
  if t[1]>0:
      return t[1]
  else:
      return t[2]

def f2(a,b,c):
    t = [a,b,c]
    t.sort()
    if t[1]<0:
        return t[1]
    else:
        return t[0]

def f3(a,b,c):
    total = a+b+c
    if total < 0:
        total = total*-1
        total = str(total)
        return int(total[0])
    else:
        return int(total[0])

def f4(a, b, c):
    total2 = a+b+c
    total2 = str(total2)
    return int(total2[len(total2)-1])

def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1 == 0 and s2==0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print (f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')


exec(input().strip())
# 1641496, 2022-09-24 10:23:37, PPxP[PP][PxPP] (67%)

def f1(a, b, c):
  t = [a,b,c]
  t.sort()
  if t[1]>0:
      return int(t[1])
  else:
      return int(t[2])

def f2(a,b,c):
    t = [a,b,c]
    t.sort()
    if t[1]<0:
        return int(t[1])
    else:
        return int(t[0])

def f3(a,b,c):
    total = a+b+c
    if total < 0:
        total = total*-1
        total = str(total)
        return int(total[0])
    else:
        return int(total[0])

def f4(a, b, c):
    total2 = a+b+c
    total2 = str(total2)
    return int(total2[len(total2)-1])

def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1 == 0 and s2==0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print (f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')


exec(input().strip())
# 1641674, 2022-09-24 10:26:45, PPxP[PP][PxPP] (67%)

def f1(a, b, c):
  t = [a,b,c]
  t.sort()
  if t[1]>0:
      return int(t[1])
  else:
      return int(t[2])

def f2(a,b,c):
    t = [a,b,c]
    t.sort()
    if t[1]<0:
        return int(t[1])
    else:
        return int(t[0])

def f3(a,b,c):
    total = a+b+c
    if total < 0:
        total = total*-1
        total = str(total)
        return int(total[0])
    else:
        return int(total[0])

def f4(a, b, c):
    total2 = a+b+c
    total2 = str(total2)
    return int(total2[-1])

def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1 == 0 and s2==0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print (f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')


exec(input().strip())
# 1641919, 2022-09-24 10:31:02, compilation error (0%)

def f1(a, b, c):
  t = [a,b,c]
  t.sort()
  if t[1]>0:
      return int(t[1])
  else:
      return int(t[2])

def f2(a,b,c):
    t = [a,b,c]
    t.sort()
    if t[1]<0:
        return int(t[1])
    else:
        return int(t[0])

def f3(a,b,c):
    total = a+b+c
    if total < 0:
        total = total*-1
        total = str(total)
        return int(total[0])
    elif:
        total = str(total)
        return int(total[0])

def f4(a, b, c):
    total2 = a+b+c
    total2 = str(total2)
    return int(total2[-1])

def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1 == 0 and s2==0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print (f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')


exec(input().strip())
# 1641947, 2022-09-24 10:31:34, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
  t = [a,b,c]
  t.sort()
  if t[1]>0:
      return int(t[1])
  else:
      return int(t[2])

def f2(a,b,c):
    t = [a,b,c]
    t.sort()
    if t[1]<0:
        return int(t[1])
    else:
        return int(t[0])

def f3(a,b,c):
    total = a+b+c
    if total < 0:
        total = total*-1
        total = str(total)
        return int(total[0])
    else:
        total = str(total)
        return int(total[0])

def f4(a, b, c):
    total2 = a+b+c
    total2 = str(total2)
    return int(total2[-1])

def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1 == 0 and s2==0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print (f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')


exec(input().strip())

6530112221
# 1639059, 2022-09-24 09:21:20, --x-[-P][PxPx] (0%)

def f1(a, b, c):
    list_a = [a, b, c]
    for i in list_a:
        if i < 0:
            list_a.remove(i)
            
    return max(list_a)

def f2(a, b, c):
    list_a = [a, b, c]
    for i in list_a:
        if i > 0:
            list_a.remove(i)
            
    return max(list_a)

def f3(a, b, c):
    suma = a + b + c
    abs(suma)
    ans = int(str(suma[0]))
    
    return ans

def f4(a, b, c):
    suma = a + b + c
    abs(suma)
    ans = suma%10
    
    return ans

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
        
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
        
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
        
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
        
    else:
        print('Error')
        
exec(input().strip())

# 1639063, 2022-09-24 09:21:28, --x-[-P][PxPx] (0%)

def f1(a, b, c):
    list_a = [a, b, c]
    for i in list_a:
        if i < 0:
            list_a.remove(i)
            
    return max(list_a)

def f2(a, b, c):
    list_a = [a, b, c]
    for i in list_a:
        if i > 0:
            list_a.remove(i)
            
    return max(list_a)

def f3(a, b, c):
    suma = a + b + c
    abs(suma)
    ans = int(str(suma[0]))
    
    return ans

def f4(a, b, c):
    suma = a + b + c
    abs(suma)
    ans = suma%10
    
    return ans

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
        
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
        
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
        
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
        
    else:
        print('Error')
        
exec(input().strip())
# 1639107, 2022-09-24 09:22:16, --x-[PP][PxPx] (17%)

def f1(a, b, c):
    list_a = [a, b, c]
    for i in list_a:
        if i < 0:
            list_a.remove(i)
            
    return min(list_a)

def f2(a, b, c):
    list_a = [a, b, c]
    for i in list_a:
        if i > 0:
            list_a.remove(i)
            
    return max(list_a)

def f3(a, b, c):
    suma = a + b + c
    abs(suma)
    ans = int(str(suma[0]))
    
    return ans

def f4(a, b, c):
    suma = a + b + c
    abs(suma)
    ans = suma%10
    
    return ans

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
        
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
        
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
        
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
        
    else:
        print('Error')
        
exec(input().strip())

# 1639185, 2022-09-24 09:24:10, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    list_a = [a, b, c]
    for i in list_a:
        if i < 0:
            list_a.remove(i)
            
    return min(list_a)

def f2(a, b, c):
    list_a = [a, b, c]
    for i in list_a:
        if i > 0:
            list_a.remove(i)
            
    return max(list_a)

def f3(a, b, c):
    suma = a + b + c
    suma = abs(suma)
    ans = int(str(suma)[0])
    
    return ans

def f4(a, b, c):
    suma = a + b + c
    suma = abs(suma)
    ans = suma%10
    
    return ans

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
        
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
        
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
        
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
        
    else:
        print('Error')
        
exec(input().strip())

# 1639935, 2022-09-24 09:43:35, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    list_a = [a, b, c]
    for i in list_a:
        if i <= 0:
            list_a.remove(i)
            
    return min(list_a)

def f2(a, b, c):
    list_a = [a, b, c]
    for i in list_a:
        if i >= 0:
            list_a.remove(i)
            
    return max(list_a)

def f3(a, b, c):
    suma = a + b + c
    suma = abs(suma)
    ans = int(str(suma)[0])
    
    return ans

def f4(a, b, c):
    suma = a + b + c
    suma = abs(suma)
    ans = suma%10
    
    return ans

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
        
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
        
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
        
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
        
    else:
        print('Error')
        
exec(input().strip())

# 1640530, 2022-09-24 10:00:02, PxPP[PP][PPPP] (83%)

def f1(a, b, c):
    list_a = [a, b, c]
    new = []
    for i in range(len(list_a)):
        if list_a[i] > 0:
            new.append(list_a[i])
            
    return min(new)

def f2(a, b, c):
    list_a = [a, b, c]
    new = []
    for i in list_a:
        if i < 0:
            new.append(list_a[i])
            
    return max(new)

def f3(a, b, c):
    suma = a + b + c
    suma = abs(suma)
    ans = int(str(suma)[0])
    
    return ans

def f4(a, b, c):
    suma = a + b + c
    suma = abs(suma)
    ans = suma%10
    
    return ans

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
        
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
        
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
        
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
        
    else:
        print('Error')
        
exec(input().strip())

# 1640571, 2022-09-24 10:01:16, P-PP[P-][PPPP] (67%)

def f1(a, b, c):
    list_a = [a, b, c]
    new = []
    for i in range(len(list_a)):
        if list_a[i] > 0:
            new.append(list_a[i])
            
    return min(new)

def f2(a, b, c):
    list_a = [a, b, c]
    new = []
    for i in list_a:
        if i < 0:
            new.append(list_a)
            
    return max(new)

def f3(a, b, c):
    suma = a + b + c
    suma = abs(suma)
    ans = int(str(suma)[0])
    
    return ans

def f4(a, b, c):
    suma = a + b + c
    suma = abs(suma)
    ans = suma%10
    
    return ans

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
        
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
        
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
        
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
        
    else:
        print('Error')
        
exec(input().strip())

# 1640588, 2022-09-24 10:01:54, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    list_a = [a, b, c]
    new = []
    for i in range(len(list_a)):
        if list_a[i] > 0:
            new.append(list_a[i])
            
    return min(new)

def f2(a, b, c):
    list_a = [a, b, c]
    new = []
    for i in list_a:
        if i < 0:
            new.append(i)
            
    return max(new)

def f3(a, b, c):
    suma = a + b + c
    suma = abs(suma)
    ans = int(str(suma)[0])
    
    return ans

def f4(a, b, c):
    suma = a + b + c
    suma = abs(suma)
    ans = suma%10
    
    return ans

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
        
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
        
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
        
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
        
    else:
        print('Error')
        
exec(input().strip())


6530174121
# 1638792, 2022-09-24 09:15:05, ----[--][----] (0%)

def f1(a, b, c):

    order_list = []
    if a > 0:
        order_list.append(a)
    if b > 0:
        order_list.append(b)
    if c > 0:
        order_list.append(c)
    order_list.sort()
    return order_list[0]
# 1638825, 2022-09-24 09:16:04, ----[--][----] (0%)

def f1(a, b, c):

    order_list = []
    if a > 0:
        order_list.append(a)
    if b > 0:
        order_list.append(b)
    if c > 0:
        order_list.append(c)
    order_list.sort()
    return order_list[0]
def f2(a, b, c):

    order_list = []
    if a < 0:
        order_list.append(a)
    if b < 0:
        order_list.append(b)
    if c < 0:
        order_list.append(c)
    order_list.sort()
    return order_list[-1]
# 1639093, 2022-09-24 09:21:59, PPx-[PP][PxPP] (50%)

def f1(a, b, c):

    order_list = []
    if a > 0:
        order_list.append(a)
    if b > 0:
        order_list.append(b)
    if c > 0:
        order_list.append(c)
    order_list.sort()
    return order_list[0]

def f2(a, b, c):

    order_list = []
    if a < 0:
        order_list.append(a)
    if b < 0:
        order_list.append(b)
    if c < 0:
        order_list.append(c)
    order_list.sort()
    return order_list[-1]

def f3(a, b, c):
    sum = a+b+c
    if sum < 0:
        sum =str(sum)
        return sum[1]
    return sum[0]

def f4(a, b, c):

    sum = a+b+c
    sum =str(sum)
    return sum[-1]

def main():
    s1,s2,a,b,c = [int (x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip())
# 1639183, 2022-09-24 09:24:07, PPxP[PP][PxPP] (67%)

def f1(a, b, c):

    order_list = []
    if a > 0:
        order_list.append(a)
    if b > 0:
        order_list.append(b)
    if c > 0:
        order_list.append(c)
    order_list.sort()
    return order_list[0]

def f2(a, b, c):

    order_list = []
    if a < 0:
        order_list.append(a)
    if b < 0:
        order_list.append(b)
    if c < 0:
        order_list.append(c)
    order_list.sort()
    return order_list[-1]

def f3(a, b, c):
    sum = a+b+c
    if sum < 0:
        sum =str(sum)
        return int(sum[1])
    return int(sum[0])

def f4(a, b, c):

    sum = a+b+c
    sum = str(sum)
    return int(sum[-1])

def main():
    s1,s2,a,b,c = [int (x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip())
# 1639288, 2022-09-24 09:26:29, PPxP[PP][PxPP] (67%)

def f1(a, b, c):

    order_list = []
    if a > 0:
        order_list.append(a)
    if b > 0:
        order_list.append(b)
    if c > 0:
        order_list.append(c)
    order_list.sort()
    return int(order_list[0])

def f2(a, b, c):

    order_list = []
    if a < 0:
        order_list.append(a)
    if b < 0:
        order_list.append(b)
    if c < 0:
        order_list.append(c)
    order_list.sort()
    return int(order_list[-1])

def f3(a, b, c):
    sum = a+b+c
    if sum < 0:
        sum =str(sum)
        return int(sum[1])
    return int(sum[0])

def f4(a, b, c):

    sum = a+b+c
    sum = str(sum)
    return int(sum[-1])

def main():
    s1,s2,a,b,c = [int (x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip())
# 1640520, 2022-09-24 09:59:41, PPxP[PP][PxPP] (67%)

def f1(a, b, c):
    order_list = []
    if a > 0:
        order_list.append(a)
    if b > 0:
        order_list.append(b)
    if c > 0:
        order_list.append(c)
    order_list.sort()
    return int(order_list[0])

def f2(a, b, c):
    order_list = []
    if a < 0:
        order_list.append(a)
    if b < 0:
        order_list.append(b)
    if c < 0:
        order_list.append(c)
    order_list.sort()
    return int(order_list[-1])

def f3(a, b, c):
    sum = a+b+c
    if sum < 0:
        sum =str(sum)
        return int(sum[1])
    return int(sum[0])

def f4(a, b, c):
    sum = a+b+c
    sum = str(sum)
    return int(sum[-1])

def main():
    s1,s2,a,b,c = [int (x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip())
# 1640629, 2022-09-24 10:03:04, PPPP[PP][PPPP] (100%)

def f1(a, b, c):

    order_list = []
    if a > 0:
        order_list.append(a)
    if b > 0:
        order_list.append(b)
    if c > 0:
        order_list.append(c)
    order_list.sort()
    return int(order_list[0])

def f2(a, b, c):

    order_list = []
    if a < 0:
        order_list.append(a)
    if b < 0:
        order_list.append(b)
    if c < 0:
        order_list.append(c)
    order_list.sort()
    return int(order_list[-1])

def f3(a, b, c):
    sum = a+b+c
    if sum < 0:
        sum =str(sum)
        return int(sum[1])
    sum =str(sum)
    return int(sum[0])

def f4(a, b, c):

    sum = a+b+c
    sum = str(sum)
    return int(sum[-1])

def main():
    s1,s2,a,b,c = [int (x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip())
# 1640904, 2022-09-24 10:10:05, PPPP[PP][PPPP] (100%)

def f1(a, b, c):

    order_list = []
    if a > 0:
        order_list.append(a)
    if b > 0:
        order_list.append(b)
    if c > 0:
        order_list.append(c)
    order_list.sort()
    return order_list[0]

def f2(a, b, c):

    order_list = []
    if a < 0:
        order_list.append(a)
    if b < 0:
        order_list.append(b)
    if c < 0:
        order_list.append(c)
    order_list.sort()
    return order_list[-1]

def f3(a, b, c):
    sum = a+b+c
    if sum < 0:
        sum =str(sum)
        return int(sum[1])
    sum =str(sum)
    return int(sum[0])

def f4(a, b, c):

    sum = a+b+c
    sum = str(sum)
    return int(sum[-1])

def main():
    s1,s2,a,b,c = [int (x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip())

6532136721
# 1638870, 2022-09-24 09:17:05, ----[--][PPPP] (17%)

def f1(a, b, c):
    if a<0: a=0
    if b<0: b=0
    if c<0: c=0
    return min(a, b, c)

def f2(a, b, c):
    if a>0: a=0
    if b>0: b=0
    if c>0: c=0
    return max(a, b, c, 0)

def f3(a, b, c):
    return str(abs(a+b+c))[0]

def f4(a, b, c):
    return str(abs(a+b+c))[-1]

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1==s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip())

# 1638929, 2022-09-24 09:18:18, ----[--][PPPP] (17%)

def f1(a, b, c):
    if a<0: a=0
    if b<0: b=0
    if c<0: c=0
    return min(a, b, c)

def f2(a, b, c):
    if a>0: a=-1000000000000
    if b>0: b=-1000000000000
    if c>0: c=-1000000000000
    return max(a, b, c, 0)

def f3(a, b, c):
    return str(abs(a+b+c))[0]

def f4(a, b, c):
    return str(abs(a+b+c))[-1]

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1==s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip())

# 1638965, 2022-09-24 09:19:06, ----[-P][PPPP] (17%)

def f1(a, b, c):
    if a<0: a=0
    if b<0: b=0
    if c<0: c=0
    return min(a, b, c)

def f2(a, b, c):
    if a>0: a=-1000000000000
    if b>0: b=-1000000000000
    if c>0: c=-1000000000000
    return max(a, b, c)

def f3(a, b, c):
    return str(abs(a+b+c))[0]

def f4(a, b, c):
    return str(abs(a+b+c))[-1]

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1==s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip())

# 1639067, 2022-09-24 09:21:30, ----[-P][PPPP] (17%)

def f1(a, b, c):
    l = []
    if a>0:
        l.append(a)
    if b>0:
        l.append(b)
    if c>0:
        l.append(c)
    return l[0]

def f2(a, b, c):
    l = []
    if a<0:
        l.append(a)
    if b<0:
        l.append(b)
    if c<0:
        l.append(c)
    return l[-1]

def f3(a, b, c):
    return str(abs(a+b+c))[0]

def f4(a, b, c):
    return str(abs(a+b+c))[-1]

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1==s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip())

# 1639220, 2022-09-24 09:24:53, -P--[-P][PPPP] (33%)

def f1(a, b, c):
    if a<=0: a=0
    if b<=0: b=0
    if c<=0: c=0
    return min(a, b, c)

def f2(a, b, c):
    if a>=0: a=-1000000000000
    if b>=0: b=-1000000000000
    if c>=0: c=-1000000000000
    return max(a, b, c)

def f3(a, b, c):
    return str(abs(a+b+c))[0]

def f4(a, b, c):
    return str(abs(a+b+c))[-1]

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1==s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip())

# 1639638, 2022-09-24 09:35:22, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    if a<=0: a=10000
    if b<=0: b=10000
    if c<=0: c=10000
    return min(a, b, c)

def f2(a, b, c):
    if a>=0: a=-1000000000000
    if b>=0: b=-1000000000000
    if c>=0: c=-1000000000000
    return max(a, b, c)

def f3(a, b, c):
    return str(abs(a+b+c))[0]

def f4(a, b, c):
    return str(abs(a+b+c))[-1]

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1==s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip())

# 1639925, 2022-09-24 09:43:14, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    if a<=0: a=1000000
    if b<=0: b=1000000
    if c<=0: c=1000000
    return min(a, b, c)

def f2(a, b, c):
    if a>=0: a=-1000000
    if b>=0: b=-1000000
    if c>=0: c=-1000000
    return max(a, b, c)

def f3(a, b, c):
    return str(abs(a+b+c))[0]

def f4(a, b, c):
    return str(abs(a+b+c))[-1]

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip())

# 1639962, 2022-09-24 09:44:10, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    if a<=0: a=1000000
    if b<=0: b=1000000
    if c<=0: c=1000000
    return min(a, b, c)

def f2(a, b, c):
    if a>=0: a=-1000000
    if b>=0: b=-1000000
    if c>=0: c=-1000000
    return max(a, b, c)

def f3(a, b, c):
    return int(str(abs(a+b+c))[0])

def f4(a, b, c):
    return int(str(abs(a+b+c))[-1])

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip())


6331119721
# 1640874, 2022-09-24 10:09:05, --P-[--][----] (17%)

def f1(a, b, c):
    if -1000 < a and b and c < 1000:
        zz = []
        if a > 0:
            zz += [a]
        if b > 0:
            zz += [b]
        if c > 0:
            zz += [c]
        bb = min(zz)
        return bb
        
            
        
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่าน้อยท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
def f2(a, b, c):
    if -1000 < a and b and c < 1000:
        ss = []
        if a < 0:
            ss += [a]
        if b < 0:
            ss += [b]
        if c < 0:
            ss += [c]
        cc = max(ss)
        return cc
        
    
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
def f3(a, b, c):
    if -1000 < a and b and c < 1000:
        ww = []
        ww += [a]
        ww += [b]
        ww += [c]
        ee = sum(ww)
        ee = str(ee)
        if ee[0] == '-':
            bbb = int(ee[1])
            return bbb
        else:
             if ee[0] != '-':
                 ccc = int(ee[0])
                 return ccc
            
        
    
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเคร่ืองหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
def f4(a, b, c):
    pass
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
def main():
    pass
# รับข้อมูลจากคีย์บอร์ดเป็นจํานวนเต็ม 5 จํานวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกําหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c) # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c) # ถ้าs1 หรือs2 เป็นค่าอ่ืนให้แสดงคําว่าError
exec(input().strip()) # DON'T remove this line
# 1640965, 2022-09-24 10:11:35, --P-[--][----] (17%)

def f1(a, b, c):
    if -1000 < a and b and c < 1000:
        zz = []
        if a > 0:
            zz += [a]
        if b > 0:
            zz += [b]
        if c > 0:
            zz += [c]
        bb = min(zz)
        return bb
        
            
        
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่าน้อยท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
def f2(a, b, c):
    if -1000 < a and b and c < 1000:
        ss = []
        if a < 0:
            ss += [a]
        if b < 0:
            ss += [b]
        if c < 0:
            ss += [c]
        cc = max(ss)
        return cc
        
    
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
def f3(a, b, c):
    if -1000 < a and b and c < 1000:
        ww = []
        ww += [a]
        ww += [b]
        ww += [c]
        ee = sum(ww)
        ee = str(ee)
        if ee[0] == '-':
            bbb = int(ee[1])
            return bbb
        else:
             if ee[0] != '-':
                 ccc = int(ee[0])
                 return ccc
            
        
    
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเคร่ืองหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
def f4(a, b, c):
    if -1000 < a and b and c < 1000:
        ww = []
        ww += [a]
        ww += [b]
        ww += [c]
        ee = sum(ww)
        ee = str(ee)
        if ee[-1] == '-':
            bbb = int(ee[1])
            return bbb
        else:
             if ee[-1] != '-':
                 ccc = int(ee[-1])
                 return ccc
    
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
def main():
    pass
# รับข้อมูลจากคีย์บอร์ดเป็นจํานวนเต็ม 5 จํานวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกําหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c) # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c) # ถ้าs1 หรือs2 เป็นค่าอ่ืนให้แสดงคําว่าError
exec(input().strip()) # DON'T remove this line
# 1641468, 2022-09-24 10:23:03, --P-[--][----] (17%)

def f1(a, b, c):
    if -1000 < a and b and c < 1000:
        if a or b or c > 0:
            if a or b or c < 0:
                zz = []
                if a > 0:
                    zz += [a]
                if b > 0:
                    zz += [b]
                if c > 0:
                    zz += [c]
                bb = min(zz)
                return bb
        
        
            
        
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่าน้อยท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
def f2(a, b, c):
    if -1000 < a and b and c < 1000:
        if a or b or c > 0:
            if a or b or c < 0:
                ss = []
                if a < 0:
                    ss += [a]
                if b < 0:
                    ss += [b]
                if c < 0:
                    ss += [c]
                cc = max(ss)
                return cc
        
    
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
def f3(a, b, c):
    if -1000 < a and b and c < 1000:
         if a or b or c > 0:
            if a or b or c < 0:
                ww = []
                ww += [a]
                ww += [b]
                ww += [c]
                ee = sum(ww)
                ee = str(ee)
                if ee[0] == '-':
                    bbb = int(ee[1])
                    return bbb
                else:
                    if ee[0] != '-':
                         ccc = int(ee[0])
                         return ccc
            
        
    
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเคร่ืองหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
def f4(a, b, c):
    if -1000 < a and b and c < 1000:
        if a or b or c > 0:
            if a or b or c < 0:
                ww = []
                ww += [a]
                ww += [b]
                ww += [c]
                ee = sum(ww)
                ee = str(ee)
                if ee[-1] == '-':
                    bbb = int(ee[1])
                    return bbb
                else:
                    if ee[-1] != '-':
                         ccc = int(ee[-1])
                         return ccc
    
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
def main():
    pass
# รับข้อมูลจากคีย์บอร์ดเป็นจํานวนเต็ม 5 จํานวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกําหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c) # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c) # ถ้าs1 หรือs2 เป็นค่าอ่ืนให้แสดงคําว่าError
exec(input().strip()) # DON'T remove this line
# 1641597, 2022-09-24 10:25:28, P-P-[--][----] (33%)

def f1(a, b, c):
    zz = []
    if a > 0:
        zz += [a]
    if b > 0:
        zz += [b]
    if c > 0:
        zz += [c]
    bb = min(zz)
    return bb
    
                
        
        
            
        
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่าน้อยท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
def f2(a, b, c):
    if -1000 < a and b and c < 1000:
        if a or b or c > 0:
            if a or b or c < 0:
                ss = []
                if a < 0:
                    ss += [a]
                if b < 0:
                    ss += [b]
                if c < 0:
                    ss += [c]
                cc = max(ss)
                return cc
        
    
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
def f3(a, b, c):
    if -1000 < a and b and c < 1000:
         if a or b or c > 0:
            if a or b or c < 0:
                ww = []
                ww += [a]
                ww += [b]
                ww += [c]
                ee = sum(ww)
                ee = str(ee)
                if ee[0] == '-':
                    bbb = int(ee[1])
                    return bbb
                else:
                    if ee[0] != '-':
                         ccc = int(ee[0])
                         return ccc
            
        
    
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเคร่ืองหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
def f4(a, b, c):
    if -1000 < a and b and c < 1000:
        if a or b or c > 0:
            if a or b or c < 0:
                ww = []
                ww += [a]
                ww += [b]
                ww += [c]
                ee = sum(ww)
                ee = str(ee)
                if ee[-1] == '-':
                    bbb = int(ee[1])
                    return bbb
                else:
                    if ee[-1] != '-':
                         ccc = int(ee[-1])
                         return ccc
    
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
def main():
    pass
# รับข้อมูลจากคีย์บอร์ดเป็นจํานวนเต็ม 5 จํานวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกําหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c) # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c) # ถ้าs1 หรือs2 เป็นค่าอ่ืนให้แสดงคําว่าError
exec(input().strip()) # DON'T remove this line
# 1641756, 2022-09-24 10:28:23, PPPP[--][----] (67%)

def f1(a, b, c):
    zz = []
    if a > 0:
        zz += [a]
    if b > 0:
        zz += [b]
    if c > 0:
        zz += [c]
    bb = min(zz)
    return bb
    
                
        
        
            
        
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่าน้อยท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
def f2(a, b, c):
    
    ss = []
    if a < 0:
        ss += [a]
    if b < 0:
        ss += [b]
    if c < 0:
        ss += [c]
    cc = max(ss)
    return cc
        
    
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
def f3(a, b, c):
    
    ww = []
    ww += [a]
    ww += [b]
    ww += [c]
    ee = sum(ww)
    ee = str(ee)
    if ee[0] == '-':
        bbb = int(ee[1])
        return bbb
    else:
        if ee[0] != '-':
            
            
            ccc = int(ee[0])
            return ccc
            
        
    
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเคร่ืองหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
def f4(a, b, c):
    
    ww = []
    ww += [a]
    ww += [b]
    ww += [c]
    ee = sum(ww)
    ee = str(ee)
    if ee[-1] == '-':
        bbb = int(ee[1])
        return bbb
    else:
        if ee[-1] != '-':
            ccc = int(ee[-1])
            return ccc
    
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
def main():
    pass
# รับข้อมูลจากคีย์บอร์ดเป็นจํานวนเต็ม 5 จํานวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกําหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c) # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c) # ถ้าs1 หรือs2 เป็นค่าอ่ืนให้แสดงคําว่าError
exec(input().strip()) # DON'T remove this line
# 1642068, 2022-09-24 10:33:57, compilation error (0%)

def f1(a, b, c):
    zz = []
    if a > 0:
        zz += [a]
    if b > 0:
        zz += [b]
    if c > 0:
        zz += [c]
    bb = min(zz)
    return bb
    
                
        
        
            
        
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่าน้อยท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
def f2(a, b, c):
    
    ss = []
    if a < 0:
        ss += [a]
    if b < 0:
        ss += [b]
    if c < 0:
        ss += [c]
    cc = max(ss)
    return cc
        
    
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
def f3(a, b, c):
    
    ww = []
    ww += [a]
    ww += [b]
    ww += [c]
    ee = sum(ww)
    ee = str(ee)
    if ee[0] == '-':
        bbb = int(ee[1])
        return bbb
    else:
        if ee[0] != '-':
            
            
            ccc = int(ee[0])
            return ccc
            
        
    
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเคร่ืองหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
def f4(a, b, c):
    
    ww = []
    ww += [a]
    ww += [b]
    ww += [c]
    ee = sum(ww)
    ee = str(ee)
    if ee[-1] == '-':
        bbb = int(ee[1])
        return bbb
    else:
        if ee[-1] != '-':
            ccc = int(ee[-1])
            return ccc
    
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
def main():
    s1 s2 a b c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
    
    
# รับข้อมูลจากคีย์บอร์ดเป็นจํานวนเต็ม 5 จํานวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกําหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c) # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c) # ถ้าs1 หรือs2 เป็นค่าอ่ืนให้แสดงคําว่าError
exec(input().strip()) # DON'T remove this line
# 1642117, 2022-09-24 10:34:34, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    zz = []
    if a > 0:
        zz += [a]
    if b > 0:
        zz += [b]
    if c > 0:
        zz += [c]
    bb = min(zz)
    return bb
    
                
        
        
            
        
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่าน้อยท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
def f2(a, b, c):
    
    ss = []
    if a < 0:
        ss += [a]
    if b < 0:
        ss += [b]
    if c < 0:
        ss += [c]
    cc = max(ss)
    return cc
        
    
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
def f3(a, b, c):
    
    ww = []
    ww += [a]
    ww += [b]
    ww += [c]
    ee = sum(ww)
    ee = str(ee)
    if ee[0] == '-':
        bbb = int(ee[1])
        return bbb
    else:
        if ee[0] != '-':
            
            
            ccc = int(ee[0])
            return ccc
            
        
    
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเคร่ืองหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
def f4(a, b, c):
    
    ww = []
    ww += [a]
    ww += [b]
    ww += [c]
    ee = sum(ww)
    ee = str(ee)
    if ee[-1] == '-':
        bbb = int(ee[1])
        return bbb
    else:
        if ee[-1] != '-':
            ccc = int(ee[-1])
            return ccc
    
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
def main():
    s1, s2, a, b ,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
    
    
# รับข้อมูลจากคีย์บอร์ดเป็นจํานวนเต็ม 5 จํานวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกําหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c) # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c) # ถ้าs1 หรือs2 เป็นค่าอ่ืนให้แสดงคําว่าError
exec(input().strip()) # DON'T remove this line

6430206521
# 1639752, 2022-09-24 09:38:34, PP--[--][----] (33%)

def f1(a, b, c):
    l=[]
    if a >0:
        l.append(a)
    if b>0 :
        l.append(b)
    if c>0:
        l.append(c)
        
    return min(l)

def f2(a, b, c):
    l=[]
    if a <0:
        l.append(a)
    if b<0 :
        l.append(b)
    if c<0:
        l.append(c)
        
    return max(l)

def f3(a, b, c):
    sum_f3 = a+b+c
    asum_f3 = abs(sum_f3)
    f3 = str(asum_f3)
    return f3[0]

def f4(a, b, c):
    sum_f3 = a+b+c
    asum_f3 = abs(sum_f3)
    f3 = str(asum_f3)
    return f3[-1]

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        return f1(a, b, c)
    elif s1 == 0 and s2 == 1:
        return f2(a, b, c)
    elif s1 == 1 and s2 == 0:
        return f3(a, b, c)
    elif s1 == 1 and s2 == 1:
        return f4(a, b, c)
    else:
        return 'Error'
    
exec(input().strip()) # DON'T remove this line
    
    
# 1639844, 2022-09-24 09:40:50, PP--[--][----] (33%)

def f1(a, b, c):
    l=[]
    if a >0:
        l.append(a)
    if b>0 :
        l.append(b)
    if c>0:
        l.append(c)
        
    return min(l)

def f2(a, b, c):
    l=[]
    if a <0:
        l.append(a)
    if b<0 :
        l.append(b)
    if c<0:
        l.append(c)
        
    return max(l)

def f3(a, b, c):
    sum_f3 = a+b+c
    asum_f3 = abs(sum_f3)
    f3 = str(asum_f3)
    return f3[0]

def f4(a, b, c):
    sum_f3 = a+b+c
    asum_f3 = abs(sum_f3)
    f3 = str(asum_f3)
    return f3[-1]

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        return f1(a, b, c)
    elif s1 == 0 and s2 == 1:
        return f2(a, b, c)
    elif s1 == 1 and s2 == 0:
        return f3(a, b, c)
    elif s1 == 1 and s2 == 1:
        return f4(a, b, c)
    else:
        return 'Error'
    
exec(input().strip()) # DON'T remove this line
# 1639875, 2022-09-24 09:41:42, PP--[--][----] (33%)

def f1(a, b, c):
    l=[]
    if a >0:
        l.append(a)
    if b>0 :
        l.append(b)
    if c>0:
        l.append(c)
        
    return min(l)

def f2(a, b, c):
    l=[]
    if a <0:
        l.append(a)
    if b<0 :
        l.append(b)
    if c<0:
        l.append(c)
        
    return max(l)

def f3(a, b, c):
    sum_f3 = a+b+c
    asum_f3 = abs(sum_f3)
    f3 = str(asum_f3)
    return f3[0]

def f4(a, b, c):
    sum_f3 = a+b+c
    asum_f3 = abs(sum_f3)
    f3 = str(asum_f3)
    return f3[-1]

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        return f1(a, b, c)
    if s1 == 0 and s2 == 1:
        return f2(a, b, c)
    if s1 == 1 and s2 == 0:
        return f3(a, b, c)
    if s1 == 1 and s2 == 1:
        return f4(a, b, c)
    else:
        return 'Error'
    
exec(input().strip()) # DON'T remove this line
# 1639922, 2022-09-24 09:43:06, PPPP[--][----] (67%)

def f1(a, b, c):
    l=[]
    if a >0:
        l.append(a)
    if b>0 :
        l.append(b)
    if c>0:
        l.append(c)
        
    return min(l)

def f2(a, b, c):
    l=[]
    if a <0:
        l.append(a)
    if b<0 :
        l.append(b)
    if c<0:
        l.append(c)
        
    return max(l)

def f3(a, b, c):
    sum_f3 = a+b+c
    asum_f3 = abs(sum_f3)
    f3 = str(asum_f3)
    return int(f3[0])

def f4(a, b, c):
    sum_f3 = a+b+c
    asum_f3 = abs(sum_f3)
    f3 = str(asum_f3)
    return int(f3[-1])

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        return f1(a, b, c)
    elif s1 == 0 and s2 == 1:
        return f2(a, b, c)
    elif s1 == 1 and s2 == 0:
        return f3(a, b, c)
    elif s1 == 1 and s2 == 1:
        return f4(a, b, c)
    else:
        return 'Error'
    
exec(input().strip()) # DON'T remove this line
# 1640007, 2022-09-24 09:45:37, PPPP[--][----] (67%)

def f1(a, b, c):
    l=[]
    if a >0:
        l.append(a)
    if b>0 :
        l.append(b)
    if c>0:
        l.append(c)
        
    return min(l)

def f2(a, b, c):
    l=[]
    if a <0:
        l.append(a)
    if b<0 :
        l.append(b)
    if c<0:
        l.append(c)
        
    return max(l)

def f3(a, b, c):
    sum_f3 = a+b+c
    asum_f3 = abs(sum_f3)
    f3 = str(asum_f3)
    return int(f3[0])

def f4(a, b, c):
    sum_f3 = a+b+c
    asum_f3 = abs(sum_f3)
    f3 = str(asum_f3)
    return int(f3[-1])

def main() :
    s1,s2,a,b,c = input().split()
    s1=int(s1)
    s2=int(s2)
    a=int(a)
    b=int(b)
    c=int(c)
    if s1 == 0 and s2 == 0:
        return f1(a, b, c)
    elif s1 == 0 and s2 == 1:
        return f2(a, b, c)
    elif s1 == 1 and s2 == 0:
        return f3(a, b, c)
    elif s1 == 1 and s2 == 1:
        return f4(a, b, c)
    else:
        return 'Error'
    
exec(input().strip()) # DON'T remove this line
# 1640092, 2022-09-24 09:47:59, PPPP[--][----] (67%)

def f1(a, b, c):
    l=[]
    if a >0:
        l.append(a)
    if b>0 :
        l.append(b)
    if c>0:
        l.append(c)
        
    return min(l)

def f2(a, b, c):
    l=[]
    if a <0:
        l.append(a)
    if b<0 :
        l.append(b)
    if c<0:
        l.append(c)
        
    return max(l)

def f3(a, b, c):
    sum_f3 = a+b+c
    asum_f3 = abs(sum_f3)
    f3 = str(asum_f3)
    return int(f3[0])

def f4(a, b, c):
    sum_f3 = a+b+c
    asum_f3 = abs(sum_f3)
    f3 = str(asum_f3)
    return int(f3[-1])

def main() :
    s1,s2,a,b,c = input().split()
    s1=int(s1)
    s2=int(s2)
    a=int(a)
    b=int(b)
    c=int(c)
    if s1 == 0 and s2 == 0:
        return f1(a, b, c)
    elif s1 == 0 and s2 == 1:
        return f2(a, b, c)
    elif s1 == 1 and s2 == 0:
        return f3(a, b, c)
    elif s1 == 1 and s2 == 1:
        return f4(a, b, c)
    elif s1 != 0 or s1 != 1 or s2 != 0 or s2 != 1:
        return 'Error'
    
exec(input().strip()) # DON'T remove this line
# 1640132, 2022-09-24 09:49:13, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    l=[]
    if a >0:
        l.append(a)
    if b>0 :
        l.append(b)
    if c>0:
        l.append(c)
        
    return min(l)

def f2(a, b, c):
    l=[]
    if a <0:
        l.append(a)
    if b<0 :
        l.append(b)
    if c<0:
        l.append(c)
        
    return max(l)

def f3(a, b, c):
    sum_f3 = a+b+c
    asum_f3 = abs(sum_f3)
    f3 = str(asum_f3)
    return int(f3[0])

def f4(a, b, c):
    sum_f3 = a+b+c
    asum_f3 = abs(sum_f3)
    f3 = str(asum_f3)
    return int(f3[-1])

def main() :
    s1,s2,a,b,c = input().split()
    s1=int(s1)
    s2=int(s2)
    a=int(a)
    b=int(b)
    c=int(c)
    if s1 == 0 and s2 == 0:
        return print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        return print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        return print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        return print(f4(a, b, c))
    else:
        return print('Error')
    
exec(input().strip()) # DON'T remove this line

6530154621
# 1639211, 2022-09-24 09:24:39, PP-P[PP][PPPP] (83%)

def f1(a,b,c):
    l=[]
    if a>0:
        l+=[a]
    if b>0:
        l+=[b]
    if c>0:
        l+=[c]
    l.sort()
    return l[0]
def f2(a,b,c):
    l=[]
    if a<0:
        l+=[a]
    if b<0:
        l+=[b]
    if c<0:
        l+=[c]
    l.sort(reverse=True)
    return l[0]
def f3(a,b,c):
    x=0;x=a+b+c
    x=abs(x)
    while x>10:
        x//=10
    return x
def f4(a,b,c):
    x=0;x=a+b+c
    x=abs(x)
    return x%10
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())
# 1639395, 2022-09-24 09:29:22, PP-P[PP][PPPP] (83%)

def f1(a,b,c):
    l=[]
    if a>0:
        l+=[a]
    if b>0:
        l+=[b]
    if c>0:
        l+=[c]
    l.sort()
    return l[0]
def f2(a,b,c):
    l=[]
    if a<0:
        l+=[a]
    if b<0:
        l+=[b]
    if c<0:
        l+=[c]
    l.sort(reverse=True)
    return l[0]
def f3(a,b,c):
    a=int(a);b=int(b);c=int(c)
    x=0;x=a+b+c
    x=abs(x)
    while x>10:
        x//=10
    return x
def f4(a,b,c):
    x=0;x=a+b+c
    x=abs(x)
    return x%10
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())
# 1639821, 2022-09-24 09:40:26, PP-P[PP][PPPP] (83%)

def f1(a,b,c):
    l=[]
    if a>0:
        l+=[a]
    if b>0:
        l+=[b]
    if c>0:
        l+=[c]
    l.sort()
    return l[0]
def f2(a,b,c):
    l=[]
    if a<0:
        l+=[a]
    if b<0:
        l+=[b]
    if c<0:
        l+=[c]
    l.sort(reverse=True)
    return l[0]
def f3(a,b,c):
    a=int(a);b=int(b);c=int(c)
    x=0;x=a+b+c
    x=abs(x)
    while x>10:
        x//=10
    return x
def f4(a,b,c):
    x=0;x=a+b+c
    x=abs(x)
    return x%10
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())
# 1639903, 2022-09-24 09:42:33, PP-P[PP][PPPP] (83%)

def f1(a,b,c):
    l=[]
    if a>0:
        l+=[a]
    if b>0:
        l+=[b]
    if c>0:
        l+=[c]
    l.sort()
    return l[0]
def f2(a,b,c):
    l=[]
    if a<0:
        l+=[a]
    if b<0:
        l+=[b]
    if c<0:
        l+=[c]
    l.sort(reverse=True)
    return l[0]
def f3(a,b,c):
    a=int(a);b=int(b);c=int(c)
    x=0;x=a+b+c
    x=abs(x)
    while x>10:
        x//=10
    return int(x)
def f4(a,b,c):
    a=int(a);b=int(b);c=int(c)
    x=0;x=a+b+c
    x=abs(x)
    return int(x%10)
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())
# 1639927, 2022-09-24 09:43:18, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    l=[]
    if a>0:
        l+=[a]
    if b>0:
        l+=[b]
    if c>0:
        l+=[c]
    l.sort()
    return l[0]
def f2(a,b,c):
    l=[]
    if a<0:
        l+=[a]
    if b<0:
        l+=[b]
    if c<0:
        l+=[c]
    l.sort(reverse=True)
    return l[0]
def f3(a,b,c):
    a=int(a);b=int(b);c=int(c)
    x=0;x=a+b+c
    x=abs(x)
    while x>=10:
        x//=10
    return int(x)
def f4(a,b,c):
    a=int(a);b=int(b);c=int(c)
    x=0;x=a+b+c
    x=abs(x)
    return int(x%10)
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())
# 1640035, 2022-09-24 09:46:24, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    l=[]
    if a>0:
        l+=[a]
    if b>0:
        l+=[b]
    if c>0:
        l+=[c]
    l.sort()
    return l[0]
def f2(a,b,c):
    l=[]
    if a<0:
        l+=[a]
    if b<0:
        l+=[b]
    if c<0:
        l+=[c]
    l.sort(reverse=True)
    return l[0]
def f3(a,b,c):
    x=0;x=a+b+c
    x=abs(x)
    while x>=10:
        x//=10
    return x
def f4(a,b,c):
    x=0;x=a+b+c
    x=abs(x)
    return x%10
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())
# 1640079, 2022-09-24 09:47:38, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    l=[]
    if a>0: l+=[a]
    if b>0: l+=[b]
    if c>0: l+=[c]
    l.sort()
    return l[0]
def f2(a,b,c):
    l=[]
    if a<0: l+=[a]
    if b<0: l+=[b]
    if c<0: l+=[c]
    l.sort(reverse=True)
    return l[0]
def f3(a,b,c):
    x=0;x=a+b+c
    x=abs(x)
    while x>=10:
        x//=10
    return x
def f4(a,b,c):
    x=0;x=a+b+c
    x=abs(x)
    return x%10
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0: print(f1(a,b,c))
    elif s1==0 and s2==1: print(f2(a,b,c))
    elif s1==1 and s2==0: print(f3(a,b,c))
    elif s1==1 and s2==1: print(f4(a,b,c))
    else: print('Error')
exec(input().strip())

6530156921
# 1640288, 2022-09-24 09:53:23, PPx-[PP][P-PP] (50%)

def f1(a, b, c):
    x=[a,b,c]
    lstmax=[]
    for i in x:
        if i>0 :
            lstmax.append(i)
    return int(min(lstmax))
def f2(a, b, c):

    x=[a,b,c]
    lstmin=[]
    for i in x:
        if i<0 :
            lstmin.append(i)
    return int(max(lstmin))
def f3(a, b, c):
    sume=a+b+c
    sume=str(sume)
    if sume[0]:
        return sume[1]
    return sume[0]
def f4(a, b, c):
    sume=a+b+c
    sume=str(sume)
    
    return sume[-1]
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    
    if s1 == 0 and s2 ==0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 ==1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 ==0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 ==1:
        print(f4(a, b, c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1640334, 2022-09-24 09:54:44, PPxP[PP][P-PP] (67%)

def f1(a, b, c):
    x=[a,b,c]
    lstmax=[]
    for i in x:
        if i>0 :
            lstmax.append(i)
    return int(min(lstmax))
def f2(a, b, c):

    x=[a,b,c]
    lstmin=[]
    for i in x:
        if i<0 :
            lstmin.append(i)
    return int(max(lstmin))
def f3(a, b, c):
    sume=a+b+c
    sume=str(sume)
    if sume[0]:
        return int(sume[1])
    return sume[0]
def f4(a, b, c):
    sume=a+b+c
    sume=str(sume)
    
    return int(sume[-1])
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    
    if s1 == 0 and s2 ==0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 ==1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 ==0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 ==1:
        print(f4(a, b, c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line
        
        
    
    
    
    


    
            

# 1640451, 2022-09-24 09:58:20, --xP[PP][P-PP] (33%)

def f1(a, b, c):
    x=[a,b,c]
    
    lstmax=[]
    for i in x:
        if i>=0 :
            lstmax.append(i)
    return int(min(lstmax))
def f2(a, b, c):

    x=[a,b,c]
    lstmin=[]
    for i in x:
        if i<=0 :
            lstmin.append(i)
    return int(max(lstmin))
def f3(a, b, c):
    sume=a+b+c
    sume=str(sume)
    if sume[0]:
        return int(sume[1])
    return sume[0]
def f4(a, b, c):
    sume=a+b+c
    sume=str(sume)
    
    return int(sume[-1])
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    
    if s1 == 0 and s2 ==0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 ==1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 ==0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 ==1:
        print(f4(a, b, c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1640463, 2022-09-24 09:58:38, PPxP[PP][P-PP] (67%)

def f1(a, b, c):
    x=[a,b,c]
    
    lstmax=[]
    for i in x:
        if i>0 :
            lstmax.append(i)
    return int(min(lstmax))
def f2(a, b, c):

    x=[a,b,c]
    lstmin=[]
    for i in x:
        if i<0 :
            lstmin.append(i)
    return int(max(lstmin))
def f3(a, b, c):
    sume=a+b+c
    sume=str(sume)
    if sume[0]:
        return int(sume[1])
    return sume[0]
def f4(a, b, c):
    sume=a+b+c
    sume=str(sume)
    
    return int(sume[-1])
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    
    if s1 == 0 and s2 ==0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 ==1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 ==0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 ==1:
        print(f4(a, b, c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line
        
        
    
    
    
    


    
            

# 1640561, 2022-09-24 10:00:55, PPxP[PP][P-PP] (67%)

def f1(a, b, c):
    x=[a,b,c]
    
    lstmax=[]
    for i in x:
        if i>0 :
            lstmax.append(i)
    return int(min(lstmax))
def f2(a, b, c):

    x=[a,b,c]
    lstmin=[]
    for i in x:
        if i<0 :
            lstmin.append(i)
    return int(max(lstmin))
def f3(a, b, c):
    sume=a+b+c
    sume=str(sume)
    if sume[0]:
        return int(sume[1])
    else:
        return sume[0]

def f4(a, b, c):
    sume=a+b+c
    sume=str(sume)
    
    return int(sume[-1])
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    
    if s1 == 0 and s2 ==0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 ==1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 ==0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 ==1:
        print(f4(a, b, c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line
        
        
    
    
    
    


    
            

# 1640570, 2022-09-24 10:01:16, PPxP[PP][P-PP] (67%)

def f1(a, b, c):
    x=[a,b,c]
    
    lstmax=[]
    for i in x:
        if i>0 :
            lstmax.append(i)
    return int(min(lstmax))
def f2(a, b, c):

    x=[a,b,c]
    lstmin=[]
    for i in x:
        if i<0 :
            lstmin.append(i)
    return int(max(lstmin))
def f3(a, b, c):
    sume=a+b+c
    sume=str(sume)
    if sume[0]:
        return int(sume[1])
    else:
        return int(sume[0])

def f4(a, b, c):
    sume=a+b+c
    sume=str(sume)
    
    return int(sume[-1])
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    
    if s1 == 0 and s2 ==0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 ==1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 ==0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 ==1:
        print(f4(a, b, c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line
        
        
    
    
    
    


    
            

# 1640595, 2022-09-24 10:02:04, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    x=[a,b,c]
    
    lstmax=[]
    for i in x:
        if i>0 :
            lstmax.append(i)
    return int(min(lstmax))
def f2(a, b, c):

    x=[a,b,c]
    lstmin=[]
    for i in x:
        if i<0 :
            lstmin.append(i)
    return int(max(lstmin))
def f3(a, b, c):
    sume=a+b+c
    sume=str(sume)
    if sume[0]=='-':
        return int(sume[1])
    else:
        return int(sume[0])

def f4(a, b, c):
    sume=a+b+c
    sume=str(sume)
    
    return int(sume[-1])
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    
    if s1 == 0 and s2 ==0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 ==1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 ==0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 ==1:
        print(f4(a, b, c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line
        
        
    
    
    
    


    
            


6530206621
# 1639313, 2022-09-24 09:27:18, xx--[xx][-PPP] (0%)

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0

    ans = []
    ans.append(a)
    ans.append(b)
    ans.append(c)
    for i in range(len(ans)):
        if ans[i] < 0:
            ans[i] = max(ans+1)
    return int(min(ans))
def f2(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    ans = []
    ans.append(a)
    ans.append(b)
    ans.append(c)
    for i in range(len(ans)):
        if ans[i] > 0:
            ans[i] = min(ans-1)
    return int(max(ans))
def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    sumabc = a+b+c
    if sumabc < 0:
        sumabc *= -1
    return str(sumabc)[0]
def f4(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    sumabc = a+b+c
    if sumabc < 0:
        sumabc *= -1
    return str(sumabc)[-1]
def main():
    s1,s2,a,b,c = input().split()
    if s1 == "0":
        if s2 == "0":
            print(f1(a, b, c))
        if s2 == "1":
            print(f2(a, b, c))
    elif s1 == "1":
        if s2 == "0":
            print(f3(a, b, c))
        if s2 == "1":
            print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line







# 1639466, 2022-09-24 09:31:06, PP--[PP][-PPP] (50%)

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0

    a = int(a)
    b = int(b)
    c = int(c)
    if a > 0:
        ans = a
    elif b > 0:
        ans = b
    else:
        return c
    if b > 0 and b < ans:
        ans = b
    if c > 0 and c < ans:
        ans = c
    return ans
def f2(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    a = int(a)
    b = int(b)
    c = int(c)
    if a < 0:
        ans = a
    elif b < 0:
        ans = b
    else:
        return c
    if b < 0 and b > ans:
        ans = b
    if c < 0 and c > ans:
        ans = c
    return ans
def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    sumabc = a+b+c
    if sumabc < 0:
        sumabc *= -1
    return str(sumabc)[0]
def f4(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    sumabc = a+b+c
    if sumabc < 0:
        sumabc *= -1
    return str(sumabc)[-1]
def main():
    s1,s2,a,b,c = input().split()
    if s1 == "0":
        if s2 == "0":
            print(f1(a, b, c))
        if s2 == "1":
            print(f2(a, b, c))
    elif s1 == "1":
        if s2 == "0":
            print(f3(a, b, c))
        if s2 == "1":
            print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line







# 1639640, 2022-09-24 09:35:28, PP--[PP][-PPP] (50%)

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0

    a = int(a)
    b = int(b)
    c = int(c)
    if a > 0:
        ans = a
    elif b > 0:
        ans = b
    else:
        return c
    if b > 0 and b < ans:
        ans = b
    if c > 0 and c < ans:
        ans = c
    return ans
def f2(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    a = int(a)
    b = int(b)
    c = int(c)
    if a < 0:
        ans = a
    elif b < 0:
        ans = b
    else:
        return c
    if b < 0 and b > ans:
        ans = b
    if c < 0 and c > ans:
        ans = c
    return ans
def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    sumabc = a+b+c
    if sumabc < 0:
        sumabc *= -1
    return str(sumabc)[0]
def f4(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    sumabc = a+b+c
    if sumabc < 0:
        sumabc *= -1
    return str(sumabc)[-1]
def main():
    s1,s2,a,b,c = input().split()
    if s1 == "0":
        if s2 == "0":
            print(f1(a, b, c))
        if s2 == "1":
            print(f2(a, b, c))
    elif s1 == "1":
        if s2 == "0":
            print(f3(a, b, c))
        if s2 == "1":
            print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line







# 1639817, 2022-09-24 09:40:18, ----[--][-PPP] (0%)

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0

    a = int(a)
    b = int(b)
    c = int(c)
    ans = []
    if a > 0:
        ans.append(a)
    if c > 0:
        ans.append(c)
    if b > 0:
        ans.append(b)
    return (max(ans))
def f2(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    a = int(a)
    b = int(b)
    c = int(c)
    ans = []
    if a < 0:
        ans.append(a)
    if c < 0:
        ans.append(c)
    if b < 0:
        ans.append(b)
    return (min(ans))
def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    sumabc = a+b+c
    if sumabc < 0:
        sumabc *= -1
    return str(sumabc)[0]
def f4(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    sumabc = a+b+c
    return str(sumabc)[-1]
def main():
    s1,s2,a,b,c = input().split()
    if s1 == "0":
        if s2 == "0":
            print(f1(a, b, c))
        if s2 == "1":
            print(f2(a, b, c))
    elif s1 == "1":
        if s2 == "0":
            print(f3(a, b, c))
        if s2 == "1":
            print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line








# 1639854, 2022-09-24 09:41:05, PP--[PP][-PPP] (50%)

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0

    a = int(a)
    b = int(b)
    c = int(c)
    ans = []
    if a > 0:
        ans.append(a)
    if c > 0:
        ans.append(c)
    if b > 0:
        ans.append(b)
    return (min(ans))
def f2(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    a = int(a)
    b = int(b)
    c = int(c)
    ans = []
    if a < 0:
        ans.append(a)
    if c < 0:
        ans.append(c)
    if b < 0:
        ans.append(b)
    return (max(ans))
def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    sumabc = a+b+c
    if sumabc < 0:
        sumabc *= -1
    return str(sumabc)[0]
def f4(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    sumabc = a+b+c
    return str(sumabc)[-1]
def main():
    s1,s2,a,b,c = input().split()
    if s1 == "0":
        if s2 == "0":
            print(f1(a, b, c))
        if s2 == "1":
            print(f2(a, b, c))
    elif s1 == "1":
        if s2 == "0":
            print(f3(a, b, c))
        if s2 == "1":
            print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line








# 1640864, 2022-09-24 10:08:53, PPPP[PP][-PPP] (83%)

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0

    a = int(a)
    b = int(b)
    c = int(c)
    ans = []
    if a > 0:
        ans.append(a)
    if c > 0:
        ans.append(c)
    if b > 0:
        ans.append(b)
    return int((min(ans)))
def f2(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    a = int(a)
    b = int(b)
    c = int(c)
    ans = []
    if a < 0:
        ans.append(a)
    if c < 0:
        ans.append(c)
    if b < 0:
        ans.append(b)
    return int((max(ans)))
def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    sumabc = a+b+c
    if sumabc < 0:
        sumabc *= -1
    return int(str(sumabc)[0])
def f4(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    sumabc = a+b+c
    return int(str(sumabc)[-1])
def main():
    s1,s2,a,b,c = input().split()
    if s1 == "0":
        if s2 == "0":
            print(f1(a, b, c))
        if s2 == "1":
            print(f2(a, b, c))
    elif s1 == "1":
        if s2 == "0":
            print(f3(a, b, c))
        if s2 == "1":
            print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

# 1641166, 2022-09-24 10:16:50, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0

    a = int(a)
    b = int(b)
    c = int(c)
    ans = []
    if a > 0:
        ans.append(a)
    if c > 0:
        ans.append(c)
    if b > 0:
        ans.append(b)
    return int((min(ans)))
def f2(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    a = int(a)
    b = int(b)
    c = int(c)
    ans = []
    if a < 0:
        ans.append(a)
    if c < 0:
        ans.append(c)
    if b < 0:
        ans.append(b)
    return int((max(ans)))
def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    sumabc = a+b+c
    if sumabc < 0:
        sumabc *= -1
    return int(str(sumabc)[0])
def f4(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    sumabc = a+b+c
    return int(str(sumabc)[-1])
def main():
    s1,s2,a,b,c = input().split()
    if s1 == "0" and s2 == "0":
        print(f1(a, b, c))
    elif s1 == "0" and s2 == "1":
        print(f2(a, b, c))
    elif s1 == "1" and s2 == "0":
        print(f3(a, b, c))
    elif s1 == "1" and s2 == "1":
        print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line


6531308121
# 1639001, 2022-09-24 09:19:54, xx-P[-P][PPPP] (33%)

def f1(a, b, c):
    k = []
    if a == int(a) and a > 0 :
        k.append(a)
    if b == int(b) and b > 0 :
        k.append(b)
    if a == int(c) and c > 0 :
        k.append(c)
    return (min(k))
def f2(a, b, c):
    k = []
    if a == int(a) and a < 0 :
        k.append(a)
    if b == int(b) and b < 0 :
        k.append(b)
    if a == int(c) and c < 0 :
        k.append(c)
    return max(k)
def f3(a, b, c):
    k = abs(a+b+c)
    return str(k)[0]
def f4(a, b, c):

    k = abs(a+b+c)
    return k%10
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
exec(input().strip())
# 1639707, 2022-09-24 09:37:18, xx-P[-P][PPPP] (33%)

def f1(a, b, c):
    k = []
    if a == int(a) and a > 0 :
        k.append(a)
    if b == int(b) and b > 0 :
        k.append(b)
    if a == int(c) and c > 0 :
        k.append(c)
    return (min(k))
def f2(a, b, c):
    k = []
    if a == int(a) and a < 0 :
        k.append(a)
    if b == int(b) and b < 0 :
        k.append(b)
    if a == int(c) and c < 0 :
        k.append(c)
    return max(k)
def f3(a, b, c):
    k = abs(a+b+c)
    return str(k)[0]
def f4(a, b, c):
    k = abs(a+b+c)
    return k%10
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
exec(input().strip())
# 1639841, 2022-09-24 09:40:47, PP-P[PP][PPPP] (83%)

def f1(a, b, c):
    k = []
    if a == int(a) and a > 0 :
        k.append(a)
    if b == int(b) and b > 0 :
        k.append(b)
    if c == int(c) and c > 0 :
        k.append(c)
    return (min(k))
def f2(a, b, c):
    k = []
    if a == int(a) and a < 0 :
        k.append(a)
    if b == int(b) and b < 0 :
        k.append(b)
    if c == int(c) and c < 0 :
        k.append(c)
    return max(k)
def f3(a, b, c):
    k = abs(a+b+c)
    return str(k)[0]
def f4(a, b, c):
    k = abs(a+b+c)
    return k%10
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
exec(input().strip())
# 1640256, 2022-09-24 09:52:15, PP-P[PP][PPPP] (83%)

def f1(a, b, c):
    k = []
    if a == int(a) and a > 0 :
        k.append(a)
    if b == int(b) and b > 0 :
        k.append(b)
    if c == int(c) and c > 0 :
        k.append(c)
    return min(k)
def f2(a, b, c):
    k = []
    if a == int(a) and a < 0 :
        k.append(a)
    if b == int(b) and b < 0 :
        k.append(b)
    if c == int(c) and c < 0 :
        k.append(c)
    return max(k)
def f3(a, b, c):
    k = abs(a+b+c)
    return str(k)[0]
def f4(a, b, c):
    k = abs(a+b+c)
    return k%10
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
exec(input().strip())
# 1640442, 2022-09-24 09:57:56, PPxP[PP][PxPx] (67%)

def f1(a, b, c):
    k = []
    if a == int(a) and a > 0 :
        k.append(a)
    if b == int(b) and b > 0 :
        k.append(b)
    if c == int(c) and c > 0 :
        k.append(c)
    return min(k)
def f2(a, b, c):
    k = []
    if a == int(a) and a < 0 :
        k.append(a)
    if b == int(b) and b < 0 :
        k.append(b)
    if c == int(c) and c < 0 :
        k.append(c)
    return max(k)
#def f3(a, b, c):
#    k = abs(a+b+c)
#    return str(k)[0]
def f4(a, b, c):
    k = abs(a+b+c)
    return k%10
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
exec(input().strip())
# 1640448, 2022-09-24 09:58:14, PP-P[PP][PPPP] (83%)

def f1(a, b, c):
    k = []
    if a == int(a) and a > 0 :
        k.append(a)
    if b == int(b) and b > 0 :
        k.append(b)
    if c == int(c) and c > 0 :
        k.append(c)
    return min(k)
def f2(a, b, c):
    k = []
    if a == int(a) and a < 0 :
        k.append(a)
    if b == int(b) and b < 0 :
        k.append(b)
    if c == int(c) and c < 0 :
        k.append(c)
    return max(k)
def f3(a, b, c):
    k = abs(a+b+c)
    return str(k)[0]
def f4(a, b, c):
    k = abs(a+b+c)
    return k%10
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
exec(input().strip())
# 1640466, 2022-09-24 09:58:39, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    k = []
    if a == int(a) and a > 0 :
        k.append(a)
    if b == int(b) and b > 0 :
        k.append(b)
    if c == int(c) and c > 0 :
        k.append(c)
    return min(k)
def f2(a, b, c):
    k = []
    if a == int(a) and a < 0 :
        k.append(a)
    if b == int(b) and b < 0 :
        k.append(b)
    if c == int(c) and c < 0 :
        k.append(c)
    return max(k)
def f3(a, b, c):
    k = abs(a+b+c)
    return int(str(k)[0])
def f4(a, b, c):
    k = abs(a+b+c)
    return k%10
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
exec(input().strip())

6531322921
# 1639774, 2022-09-24 09:39:04, ----[--][----] (0%)

def f1(a,b,c):
    l = [a,b,c]
    for d in l:
        if d == 0:
            l.remove(d)
    return min(l)
def f2(a,b,c):
    l = [a,b,c]
    for d in l:
        if d == 0:
            l.remove(d)
    return max(l)
def f3(a,b,c):
    m = abs(a+b+c)
    return m//(10**len(str(m)-1))
def f4(a,b,c):
    m = abs(a+b+c)
    return m%10
def main():
    s1,s2,a,b,c = [int(x) for x in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print("Error")
# 1639952, 2022-09-24 09:43:56, --xP[--][PxPx] (17%)

def f1(a,b,c):
    l = [a,b,c]
    for d in l:
        if d == 0:
            l.remove(d)
    return min(l)
def f2(a,b,c):
    l = [a,b,c]
    for d in l:
        if d == 0:
            l.remove(d)
    return max(l)
def f3(a,b,c):
    m = abs(a+b+c)
    return m//(10**len(str(m)-1))
def f4(a,b,c):
    m = abs(a+b+c)
    return m%10
def main():
    s1,s2,a,b,c = [int(x) for x in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) 
# 1640051, 2022-09-24 09:46:55, --xP[PP][PxPx] (33%)

def f1(a,b,c):
    l = [a,b,c]
    for d in l:
        if d < 0:
            l.remove(d)
    return min(l)
def f2(a,b,c):
    l = [a,b,c]
    for d in l:
        if d > 0:
            l.remove(d)
    return max(l)
def f3(a,b,c):
    m = abs(a+b+c)
    return m//(10**len(str(m)-1))
def f4(a,b,c):
    m = abs(a+b+c)
    return m%10
def main():
    s1,s2,a,b,c = [int(x) for x in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) 
# 1641087, 2022-09-24 10:15:05, ---P[PP][P-P-] (33%)

def f1(a,b,c):
    l = [a,b,c]
    for d in l:
        if d < 0:
            l.remove(d)
    return min(l)
def f2(a,b,c):
    l = [a,b,c]
    for d in l:
        if d > 0:
            l.remove(d)
    return max(l)
def f3(a,b,c):
    m = abs(a+b+c)
    return m//(10**(len(str(m)))-1)
def f4(a,b,c):
    m = abs(a+b+c)
    return m%10
def main():
    s1,s2,a,b,c = [int(x) for x in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) 
# 1641150, 2022-09-24 10:16:30, --PP[PP][PPPP] (67%)

def f1(a,b,c):
    l = [a,b,c]
    for d in l:
        if d < 0:
            l.remove(d)
    return min(l)
def f2(a,b,c):
    l = [a,b,c]
    for d in l:
        if d > 0:
            l.remove(d)
    return max(l)
def f3(a,b,c):
    m = abs(a+b+c)
    return m//(10**(len(str(m))-1))
def f4(a,b,c):
    m = abs(a+b+c)
    return m%10
def main():
    s1,s2,a,b,c = [int(x) for x in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip())
# 1641462, 2022-09-24 10:22:50, --PP[PP][PPPP] (67%)

def f1(a,b,c):
    l = [a,b,c]
    for d in l:
        if d <= 0:
            l.remove(d)
    return min(l)
def f2(a,b,c):
    l = [a,b,c]
    for d in l:
        if d >= 0:
            l.remove(d)
    return max(l)
def f3(a,b,c):
    m = abs(a+b+c)
    return m//(10**(len(str(m))-1))
def f4(a,b,c):
    m = abs(a+b+c)
    return m%10
def main():
    s1,s2,a,b,c = [int(x) for x in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip())
# 1641951, 2022-09-24 10:31:36, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    l = [a,b,c]
    l.sort()
    k = l[0]
    for a in range(1,3):
        if k<=0:
            k = l[a]
    return k
def f2(a,b,c):
    l = [a,b,c]
    l.sort()
    k = l[-1]
    for a in range(2,4):
        if k>=0:
            k = l[-a]
    return k
def f3(a,b,c):
    m = abs(a+b+c)
    return m//(10**(len(str(m))-1))
def f4(a,b,c):
    m = abs(a+b+c)
    return m%10
def main():
    s1,s2,a,b,c = [int(x) for x in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip())

6531335021
# 1640524, 2022-09-24 09:59:52, PPxx[--][P-P-] (33%)

def f1(a,b,c) :
    free = []
    if a > 0 :
        free.append(a)
    if b > 0 :
        free.append(b)
    if c > 0 :
        free.append(c)
    return min(free)
def f2(a,b,c) :
    free = []
    if a < 0 :
        free.append(a)
    if b < 0 :
        free.append(b)
    if c < 0 :
        free.append(c)
    return max(free)
    
def f3(a,b,c) :
    x = int(a) + int(b) + int(c)
    return int(x[0])
def f4(a,b,c) :
    x = int(a) + int(b) + int(c)
    return int(x[-1])
def main() :
    s1,s2,a,b,c = input().split()
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print("Error")
exec(input().strip()) # DON'T remove this line
# 1640647, 2022-09-24 10:03:29, PPxx[--][P-P-] (33%)

def f1(a,b,c) :
    free = []
    if a > 0 :
        free.append(a)
    if b > 0 :
        free.append(b)
    if c > 0 :
        free.append(c)
    return min(free)
def f2(a,b,c) :
    free = []
    if a < 0 :
        free.append(a)
    if b < 0 :
        free.append(b)
    if c < 0 :
        free.append(c)
    return max(free)
    
def f3(a,b,c) :
    a,b,c = int(a),int(b),int(c)
    x = a + b + c
    x = abs(x)
    y = x[0]
    return y
def f4(a,b,c) :
    a,b,c = int(a),int(b),int(c)
    x = a + b + c
    x = abs(x)
    y = x[-1]
    return y
def main() :
    s1,s2,a,b,c = input().split()
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print("Error")
exec(input().strip()) # DON'T remove this line
# 1640678, 2022-09-24 10:04:14, PP--[--][P-P-] (33%)

def f1(a,b,c) :
    free = []
    if a > 0 :
        free.append(a)
    if b > 0 :
        free.append(b)
    if c > 0 :
        free.append(c)
    return min(free)
def f2(a,b,c) :
    free = []
    if a < 0 :
        free.append(a)
    if b < 0 :
        free.append(b)
    if c < 0 :
        free.append(c)
    return max(free)
    
def f3(a,b,c) :
    a,b,c = int(a),int(b),int(c)
    x = a + b + c
    x = abs(x)
    y = str(x)[0]
    return y
def f4(a,b,c) :
    a,b,c = int(a),int(b),int(c)
    x = a + b + c
    x = abs(x)
    y = str(x)[-1]
    return y
def main() :
    s1,s2,a,b,c = input().split()
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print("Error")
exec(input().strip()) # DON'T remove this line
# 1640725, 2022-09-24 10:05:35, PP--[--][P-P-] (33%)

def f1(a,b,c) :
    free = []
    if a > 0 :
        free.append(a)
    if b > 0 :
        free.append(b)
    if c > 0 :
        free.append(c)
    return min(free)
def f2(a,b,c) :
    free = []
    if a < 0 :
        free.append(a)
    if b < 0 :
        free.append(b)
    if c < 0 :
        free.append(c)
    return max(free)
    
def f3(a,b,c) :
    a,b,c = int(a),int(b),int(c)
    x = a + b + c
    x = abs(x)
    y = str(x)[0]
    return y
def f4(a,b,c) :
    a,b,c = int(a),int(b),int(c)
    x = a + b + c
    x = abs(x)
    y = str(x)[-1]
    return y
def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print("Error")
exec(input().strip()) # DON'T remove this line
# 1640770, 2022-09-24 10:06:35, PP--[--][P-P-] (33%)

def f1(a,b,c) :
    free = []
    if a > 0 :
        free.append(a)
    if b > 0 :
        free.append(b)
    if c > 0 :
        free.append(c)
    return min(free)
def f2(a,b,c) :
    free = []
    if a < 0 :
        free.append(a)
    if b < 0 :
        free.append(b)
    if c < 0 :
        free.append(c)
    return max(free)
    
def f3(a,b,c) :
    a,b,c = int(a),int(b),int(c)
    x = a + b + c
    x = abs(x)
    y = str(x)[0]
    return y
def f4(a,b,c) :
    a,b,c = int(a),int(b),int(c)
    x = a + b + c
    x = abs(x)
    y = str(x)[-1]
    return y
def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print("Error")
exec(input().strip()) # DON'T remove this line
# 1640822, 2022-09-24 10:07:55, PPPP[--][P-P-] (67%)

def f1(a,b,c) :
    free = []
    if a > 0 :
        free.append(a)
    if b > 0 :
        free.append(b)
    if c > 0 :
        free.append(c)
    return int(min(free))
def f2(a,b,c) :
    free = []
    if a < 0 :
        free.append(a)
    if b < 0 :
        free.append(b)
    if c < 0 :
        free.append(c)
    return int(max(free))
    
def f3(a,b,c) :
    a,b,c = int(a),int(b),int(c)
    x = a + b + c
    x = abs(x)
    y = str(x)[0]
    return int(y)
def f4(a,b,c) :
    a,b,c = int(a),int(b),int(c)
    x = a + b + c
    x = abs(x)
    y = str(x)[-1]
    return int(y)
def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print("Error")
exec(input().strip()) # DON'T remove this line
# 1641046, 2022-09-24 10:13:47, PPPP[PP][PPPP] (100%)

def f1(a,b,c) :
    free = []
    if a > 0 :
        free.append(a)
    if b > 0 :
        free.append(b)
    if c > 0 :
        free.append(c)
    return int(min(free))
def f2(a,b,c) :
    free = []
    if a < 0 :
        free.append(a)
    if b < 0 :
        free.append(b)
    if c < 0 :
        free.append(c)
    return int(max(free))
    
def f3(a,b,c) :
    a,b,c = int(a),int(b),int(c)
    x = a + b + c
    x = abs(x)
    y = str(x)[0]
    return int(y)
def f4(a,b,c) :
    a,b,c = int(a),int(b),int(c)
    x = a + b + c
    x = abs(x)
    y = str(x)[-1]
    return int(y)
def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print("Error")
exec(input().strip()) # DON'T remove this line

6531342421
# 1639256, 2022-09-24 09:25:48, ----[PP][PPPP] (33%)

def f1(a, b, c):
    if a < 0 :
        a = 2e9
    if b < 0 :
        b = 2e9
    if c < 0 :
        c = 2e9
    return min(a,b,c)
def f2(a, b, c):
    if a > 0 :
        a = -2e9
    if b > 0 :
        b = -2e9
    if c > 0 :
        c = -2e9
    return max(a,b,c)

def f3(a, b, c):
    sum = a+b+c
    strr = str(sum)
    if sum >= 0:
        return strr[0]
    else:
        return strr[1]
def f4(a, b, c):
    sum = a+b+c
    strr = str(sum)
    return(strr[-1])
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) 
# 1639411, 2022-09-24 09:29:44, ----[PP][PPPP] (33%)

def f1(a, b, c):
    if a < 0 :
        a = 1005
    if b < 0 :
        b = 1005
    if c < 0 :
        c = 1005
    return min(a,b,c)
def f2(a, b, c):
    if a > 0 :
        a = -1005
    if b > 0 :
        b = -1005
    if c > 0 :
        c = -1005
    return max(a,b,c)

def f3(a, b, c):
    sum = a+b+c
    strr = str(sum)
    if sum >= 0:
        return strr[0]
    else:
        return strr[1]
def f4(a, b, c):
    sum = a+b+c
    strr = str(sum)
    return(strr[-1])
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) 
# 1640517, 2022-09-24 09:59:41, ----[PP][PPPP] (33%)

def f1(a, b, c):
    if a < 0 :
        a = 1005
    if b < 0 :
        b = 1005
    if c < 0 :
        c = 1005
    return min(a,b,c)
def f2(a, b, c):
    if a > 0 :
        a = -1005
    if b > 0 :
        b = -1005
    if c > 0 :
        c = -1005
    return max(a,b,c)

def f3(a, b, c):
    sum = a+b+c
    strr = str(sum)
    if sum >= 0:
        return strr[0]
    else:
        return strr[1]
def f4(a, b, c):
    sum = a+b+c
    strr = str(sum)
    if len(strr) == 1:
        return sum
    return(strr[-1])
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) 
# 1640632, 2022-09-24 10:03:07, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    if a < 0 :
        a = 1005
    if b < 0 :
        b = 1005
    if c < 0 :
        c = 1005
    return min(a,b,c)
def f2(a, b, c):
    if a > 0 :
        a = -1005
    if b > 0 :
        b = -1005
    if c > 0 :
        c = -1005
    return max(a,b,c)

def f3(a, b, c):
    sum = a+b+c
    strr = str(sum)
    if sum >= 0:
        return int(strr[0])
    else:
        return int(strr[1])
def f4(a, b, c):
    sum = a+b+c
    strr = str(sum)
    return(int(strr[-1]))
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) 
# 1640675, 2022-09-24 10:04:10, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    if a < 0 :
        a = 1005
    if b < 0 :
        b = 1005
    if c < 0 :
        c = 1005
    return int(min(a,b,c))
def f2(a, b, c):
    if a > 0 :
        a = -1005
    if b > 0 :
        b = -1005
    if c > 0 :
        c = -1005
    return int(max(a,b,c))

def f3(a, b, c):
    sum = a+b+c
    strr = str(sum)
    if sum >= 0:
        return int(strr[0])
    else:
        return int(strr[1])
def f4(a, b, c):
    sum = a+b+c
    strr = str(sum)
    return(int(strr[-1]))
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) 
# 1640974, 2022-09-24 10:11:50, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    if a < 0 :
        a = 2e9
    if b < 0 :
        b = 2e9
    if c < 0 :
        c = 2e9
    return int(min(a,b,c))
def f2(a, b, c):
    if a > 0 :
        a = -2e9
    if b > 0 :
        b = -2e9
    if c > 0 :
        c = -2e9
    return int(max(a,b,c))

def f3(a, b, c):
    sum = a+b+c
    strr = str(sum)
    if strr[0] == '-':
        return int(strr[1])
    return int(strr[0])
def f4(a, b, c):
    sum = a+b+c
    strr = str(sum)
    return(int(strr[-1]))
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) 
# 1641037, 2022-09-24 10:13:27, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    if a <= 0 :
        a = 2e9
    if b <= 0 :
        b = 2e9
    if c <= 0 :
        c = 2e9
    return int(min(a,b,c))
def f2(a, b, c):
    if a >= 0 :
        a = -2e9
    if b >= 0 :
        b = -2e9
    if c >= 0 :
        c = -2e9
    return int(max(a,b,c))

def f3(a, b, c):
    sum = a+b+c
    strr = str(sum)
    if strr[0] == '-':
        return int(strr[1])
    return int(strr[0])
def f4(a, b, c):
    sum = a+b+c
    strr = str(sum)
    return(int(strr[-1]))
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) 

6532026321
# 1638820, 2022-09-24 09:15:55, PPx-[PP][PPPx] (50%)

def f1(a, b, c):
  mi = 1005
  if 0 < a < mi: mi = a
  if 0 < b < mi: mi = b
  if 0 < c < mi: mi = c
  return mi
def f2(a, b, c):
  ma = -1005
  if 0 > a > ma: ma = a
  if 0 > b > ma: ma = b
  if 0 > c > ma: ma = c
  return ma
def f3(a, b, c):
  return int(str(a+b+c)[0])
def f4(a, b, c):
  return (a+b+c)/10
def main():
  s1, s2, a, b, c = [int(i) for i in input().split()]
  if s1 == s2 == 0: print(f1(a, b, c))
  elif s1 == 0 and s2 == 1: print(f2(a, b, c))
  elif s1 == 1 and s2 == 0: print(f3(a, b, c))
  elif s1 == s2 == 1: print(f4(a, b, c))
  else: print("Error")

exec(input().strip())
# 1639041, 2022-09-24 09:20:53, PPP-[PP][PPPP] (83%)

def f1(a, b, c):
  mi = 1005
  if 0 < a < mi: mi = a
  if 0 < b < mi: mi = b
  if 0 < c < mi: mi = c
  return mi
def f2(a, b, c):
  ma = -1005
  if 0 > a > ma: ma = a
  if 0 > b > ma: ma = b
  if 0 > c > ma: ma = c
  return ma
def f3(a, b, c):
  s = a+b+c
  c = str(s)[0]
  if c == '-':
    c = str(s)[1]
  return int(c)
def f4(a, b, c):
  s = a+b+c
  if s < 0: return 10-s%10
  return s%10
def main():
  s1, s2, a, b, c = [int(i) for i in input().split()]
  if s1 == s2 == 0: print(f1(a, b, c))
  elif s1 == 0 and s2 == 1: print(f2(a, b, c))
  elif s1 == 1 and s2 == 0: print(f3(a, b, c))
  elif s1 == s2 == 1: print(f4(a, b, c))
  else: print("Error")

exec(input().strip())
# 1639292, 2022-09-24 09:26:38, PPP-[PP][PPPP] (83%)

def f1(a, b, c):
  mi = 1005
  if 0 < a < mi: mi = a
  if 0 < b < mi: mi = b
  if 0 < c < mi: mi = c
  return mi

def f2(a, b, c):
  ma = -1005
  if 0 > a > ma: ma = a
  if 0 > b > ma: ma = b
  if 0 > c > ma: ma = c
  return ma

def f3(a, b, c):
  s = a+b+c
  c = str(s)[0]
  if c == '-':
    c = str(s)[1]
  return int(c)

def f4(a, b, c):
  # s = a+b+c
  # if s < 0: return 10-s%10
  s = a+b+c
  return str(s)[-1]

def main():
  s1, s2, a, b, c = [int(i) for i in input().split()]
  if s1 == s2 == 0: print(f1(a, b, c))
  elif s1 == 0 and s2 == 1: print(f2(a, b, c))
  elif s1 == 1 and s2 == 0: print(f3(a, b, c))
  elif s1 == s2 == 1: print(f4(a, b, c))
  else: print("Error")

exec(input().strip())
# 1639305, 2022-09-24 09:27:06, PPP-[PP][PPPP] (83%)

def f1(a, b, c):
  mi = 3005
  if 0 < a < mi: mi = a
  if 0 < b < mi: mi = b
  if 0 < c < mi: mi = c
  return mi

def f2(a, b, c):
  ma = -3005
  if 0 > a > ma: ma = a
  if 0 > b > ma: ma = b
  if 0 > c > ma: ma = c
  return ma

def f3(a, b, c):
  s = a+b+c
  c = str(s)[0]
  if c == '-':
    c = str(s)[1]
  return int(c)

def f4(a, b, c):
  s = a+b+c
  return str(s)[-1]

def main():
  s1, s2, a, b, c = [int(i) for i in input().split()]
  if s1 == s2 == 0: print(f1(a, b, c))
  elif s1 == 0 and s2 == 1: print(f2(a, b, c))
  elif s1 == 1 and s2 == 0: print(f3(a, b, c))
  elif s1 == s2 == 1: print(f4(a, b, c))
  else: print("Error")

exec(input().strip())
# 1639692, 2022-09-24 09:36:47, --P-[PP][PPPP] (50%)

def f1(a, b, c):
  mi = 3005
  if 0 <= a < mi: mi = a
  if 0 <= b < mi: mi = b
  if 0 <= c < mi: mi = c
  return mi

def f2(a, b, c):
  ma = -3005
  if 0 >= a > ma: ma = a
  if 0 >= b > ma: ma = b
  if 0 >= c > ma: ma = c
  return ma

def f3(a, b, c):
  s = a+b+c
  c = str(s)[0]
  if c == '-':
    c = str(s)[1]
  return int(c)

def f4(a, b, c):
  s = a+b+c
  return str(s)[-1]

def main():
  s1, s2, a, b, c = [int(i) for i in input().split()]
  if s1 == s2 == 0: print(f1(a, b, c))
  elif s1 == 0 and s2 == 1: print(f2(a, b, c))
  elif s1 == 1 and s2 == 0: print(f3(a, b, c))
  elif s1 == s2 == 1: print(f4(a, b, c))
  else: print("Error")

exec(input().strip())
# 1639716, 2022-09-24 09:37:30, PPP-[PP][PPPP] (83%)

def f1(a, b, c):
  mi = 3005
  if 0 < a < mi: mi = a
  if 0 < b < mi: mi = b
  if 0 < c < mi: mi = c
  return mi

def f2(a, b, c):
  ma = -3005
  if 0 > a > ma: ma = a
  if 0 > b > ma: ma = b
  if 0 > c > ma: ma = c
  return ma

def f3(a, b, c):
  s = a+b+c
  c = str(s)[0]
  if c == '-':
    c = str(s)[1]
  return int(c)

def f4(a, b, c):
  s = a+b+c
  return s
  return str(s)[-1]

def main():
  s1, s2, a, b, c = [int(i) for i in input().split()]
  if s1 == s2 == 0: print(f1(a, b, c))
  elif s1 == 0 and s2 == 1: print(f2(a, b, c))
  elif s1 == 1 and s2 == 0: print(f3(a, b, c))
  elif s1 == s2 == 1: print(f4(a, b, c))
  else: print("Error")

exec(input().strip())
# 1639815, 2022-09-24 09:40:10, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
  mi = 3005
  if 0 < a < mi: mi = a
  if 0 < b < mi: mi = b
  if 0 < c < mi: mi = c
  return mi

def f2(a, b, c):
  ma = -3005
  if 0 > a > ma: ma = a
  if 0 > b > ma: ma = b
  if 0 > c > ma: ma = c
  return ma

def f3(a, b, c):
  s = a+b+c
  c = str(s)[0]
  if c == '-':
    c = str(s)[1]
  return int(c)

def f4(a, b, c):
  s = a+b+c
  return int(str(s)[-1])

def main():
  s1, s2, a, b, c = [int(i) for i in input().split()]
  if s1 == s2 == 0: print(f1(a, b, c))
  elif s1 == 0 and s2 == 1: print(f2(a, b, c))
  elif s1 == 1 and s2 == 0: print(f3(a, b, c))
  elif s1 == s2 == 1: print(f4(a, b, c))
  else: print("Error")

exec(input().strip())

6532180221
# 1639506, 2022-09-24 09:31:58, PP--[--][P-P-] (33%)

#Sathana Laolugsanalerd
def f1(a,b,c):
 for i in sorted([a,b,c]):
  if(i>0):return i
def f2(a,b,c):
 r=sorted([a,b,c])
 if(r[1]<0):return r[1]
 return r[0]
def f3(a,b,c):
 s=0
 for i in[a,b,c]:
  while(i>9):i/=10
  s+=i
 return s
def f4(a,b,c):
 return a%10+b%10+c%10
def main():
 s,z,a,b,c = list(map(int,input().split()))
 try:print(exec("f"+str(s*2+z+1)+"(a,b,c)"))
 except:print("Error")
exec(input().strip())

# 1639626, 2022-09-24 09:34:57, PP--[--][P-P-] (33%)

#Sathana Laolugsanalerd
def f1(a,b,c):
 for i in sorted([a,b,c]):
  if(i>0):return i
def f2(a,b,c):
 r=sorted([a,b,c])
 if(r[1]<0):return r[1]
 return r[0]
def f3(a,b,c):
 s=-1
 for i in[a,b,c]:
  i=abs(i)
  while(i>9):i//=10
  s+=i
 if(sorted([a,b,c])[1]<0):s+=1
 return s
def f4(a,b,c):
 return a%10+b%10+c%10
def main():
 s,z,a,b,c = list(map(int,input().split()))
 try:print(exec("f"+str(s*2+z+1)+"(a,b,c)"))
 except:print("Error")
exec(input().strip())

# 1639746, 2022-09-24 09:38:29, PPx-[--][P-P-] (33%)

#Sathana Laolugsanalerd
def f1(a,b,c):
 for i in sorted([a,b,c]):
  if(i>0):return i
def f2(a,b,c):
 r=sorted([a,b,c])
 if(r[1]<0):return r[1]
 return r[0]
def f3(a,b,c):
 return int(str(a+b+c)[0])
def f4(a,b,c):
 return (a+b+c)%10
def main():
 s,z,a,b,c = list(map(int,input().split()))
 try:print(exec("f"+str(s*2+z+1)+"(a,b,c)"))
 except:print("Error")
exec(input().strip())

# 1639808, 2022-09-24 09:40:02, PPPP[--][P-P-] (67%)

#Sathana Laolugsanalerd
def f1(a,b,c):
 for i in sorted([a,b,c]):
  if(i>0):return i
def f2(a,b,c):
 r=sorted([a,b,c])
 if(r[1]<0):return r[1]
 return r[0]
def f3(a,b,c):
 return int(str(abs(a+b+c))[0])
def f4(a,b,c):
 return abs(a+b+c)%10
def main():
 s,z,a,b,c = list(map(int,input().split()))
 try:print(exec("f"+str(s*2+z+1)+"(a,b,c)"))
 except:print("Error")
exec(input().strip())

# 1639889, 2022-09-24 09:41:54, PPPP[--][P-P-] (67%)

#Sathana Laolugsanalerd
def f1(a,b,c):
 for i in sorted([a,b,c]):
  if(i>0):return i
def f2(a,b,c):
 r=sorted([a,b,c])
 if(r[1]<0):return r[1]
 return r[0]
def f3(a,b,c):
 return int(str(abs(a+b+c))[0])
def f4(a,b,c):
 return abs(a+b+c)%10
def main():
 s,z,a,b,c = list(map(int,input().split()))
 try:print(exec("f{}({},{},{})".format(str(s*2+z+1),a,b,c)))
 except:print("Error")
exec(input().strip())

# 1640025, 2022-09-24 09:46:12, PPPP[--][P-P-] (67%)

#Sathana Laolugsanalerd
def f1(a,b,c):
 for i in sorted([a,b,c]):
  if(i>0):return i
def f2(a,b,c):
 r=sorted([a,b,c])
 if(r[1]<0):return r[1]
 return r[0]
def f3(a,b,c):
 return int(str(abs(a+b+c))[0])
def f4(a,b,c):
 return abs(a+b+c)%10
def main():
 y,z,a,b,c = list(map(int,input().split()))
 try:exec(exec("print(f{}({},{},{}))".format(str(y*2+z+1),a,b,c)))
 except:print("Error")
exec(input().strip())

# 1640056, 2022-09-24 09:47:02, PPPP[PP][PPPP] (100%)

#Sathana Laolugsanalerd
def f1(a,b,c):
 for i in sorted([a,b,c]):
  if(i>0):return i
def f2(a,b,c):
 r=sorted([a,b,c])
 if(r[1]<0):return r[1]
 return r[0]
def f3(a,b,c):
 return int(str(abs(a+b+c))[0])
def f4(a,b,c):
 return abs(a+b+c)%10
def main():
 y,z,a,b,c = list(map(int,input().split()))
 try:exec("print(f{}({},{},{}))".format(str(y*2+z+1),a,b,c))
 except:print("Error")
exec(input().strip())


6130394021
# 1639368, 2022-09-24 09:28:41, -xxx[xx][xxxx] (0%)

def f1(a, b, c):
    min_value_morethan_zero = a
    if b < min_value_morethan_zero and b > 0:
        min_value_morethan_zero = b
    if c < min_value_morethan_zero and c > 0:
        min_value_morethan_zero = c
    return min_value_morethan_zero
exec(input().strip())
# 1639571, 2022-09-24 09:33:44, Pxxx[xx][xxxx] (17%)

def f1(a, b, c):
    min_value_morethan_zero = []
    if a > 0:
        min_value_morethan_zero += [a]
    if b > 0:
        min_value_morethan_zero += [b]
    if c > 0:
        min_value_morethan_zero += [c]
    return min(min_value_morethan_zero)
exec(input().strip())
# 1639702, 2022-09-24 09:37:12, PPxx[xx][xxxx] (33%)

def f1(a, b, c):
    min_value_morethan_zero = []
    if a > 0:
        min_value_morethan_zero += [a]
    if b > 0:
        min_value_morethan_zero += [b]
    if c > 0:
        min_value_morethan_zero += [c]
    return min(min_value_morethan_zero)
def f2(a, b, c):
    max_value_lessthan_zero = []
    if a < 0:
        max_value_lessthan_zero += [a]
    if b < 0:
        max_value_lessthan_zero += [b]
    if c < 0:
        max_value_lessthan_zero += [c]
    return max(max_value_lessthan_zero)
exec(input().strip())

# 1639996, 2022-09-24 09:45:08, PPPx[xx][xxxx] (50%)

def f1(a, b, c):
    min_value_morethan_zero = []
    if a > 0:
        min_value_morethan_zero += [a]
    if b > 0:
        min_value_morethan_zero += [b]
    if c > 0:
        min_value_morethan_zero += [c]
    return min(min_value_morethan_zero)
def f2(a, b, c):
    max_value_lessthan_zero = []
    if a < 0:
        max_value_lessthan_zero += [a]
    if b < 0:
        max_value_lessthan_zero += [b]
    if c < 0:
        max_value_lessthan_zero += [c]
    return max(max_value_lessthan_zero)
def f3(a, b, c):
    x = [a, b, c]
    y = sum(x)
    if y < 0:
        return int(str(y*(-1))[0])
    else:
        return int(str(y)[0])
exec(input().strip())
# 1640090, 2022-09-24 09:47:53, PPPP[xx][xxxx] (67%)

def f1(a, b, c):
    min_value_morethan_zero = []
    if a > 0:
        min_value_morethan_zero += [a]
    if b > 0:
        min_value_morethan_zero += [b]
    if c > 0:
        min_value_morethan_zero += [c]
    return min(min_value_morethan_zero)
def f2(a, b, c):
    max_value_lessthan_zero = []
    if a < 0:
        max_value_lessthan_zero += [a]
    if b < 0:
        max_value_lessthan_zero += [b]
    if c < 0:
        max_value_lessthan_zero += [c]
    return max(max_value_lessthan_zero)
def f3(a, b, c):
    x = [a, b, c]
    y = sum(x)
    if y < 0:
        return int(str(y*(-1))[0])
    else:
        return int(str(y)[0])
def f4(a, b, c):
    x = [a, b, c]
    y = sum(x)
    return int(str(y)[-1])
exec(input().strip())
# 1640426, 2022-09-24 09:57:31, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    min_value_morethan_zero = []
    if a > 0:
        min_value_morethan_zero += [a]
    if b > 0:
        min_value_morethan_zero += [b]
    if c > 0:
        min_value_morethan_zero += [c]
    return min(min_value_morethan_zero)
def f2(a, b, c):
    max_value_lessthan_zero = []
    if a < 0:
        max_value_lessthan_zero += [a]
    if b < 0:
        max_value_lessthan_zero += [b]
    if c < 0:
        max_value_lessthan_zero += [c]
    return max(max_value_lessthan_zero)
def f3(a, b, c):
    x = [a, b, c]
    y = sum(x)
    if y < 0:
        return int(str(y*(-1))[0])
    else:
        return int(str(y)[0])
def f4(a, b, c):
    x = [a, b, c]
    y = sum(x)
    return int(str(y)[-1])
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip())

6230071921
# 1639594, 2022-09-24 09:34:18, --P-[--][P-P-] (17%)

def f1(a, b, c):
    a=int(a);b=int(b);c=int(c)
    if a<0:
        a=1001
    if b<0:
        b=1001
    if c<0:
        c=1001
    ans =min(a,b,c)
    return ans
def f2(a, b, c):
    a=int(a);b=int(b);c=int(c)
    if a>0:
        a=-1001
    if b>0:
        b=-1001
    if c>0:
        c=-1001
    ans2 = max(a,b,c)
    return ans2
def f3(a, b, c):
    total = int(a)+int(b)+int(c)
    long = len(str(total))
    ans3 = abs(total//(10**(long-1)))
    return ans3
def f4(a, b, c):
    total1 = int(a)+int(b)+int(c)
    ans4 = abs(total1)
    ans4 = str(ans4)
    return ans4[-1]
def main():
    s1,s2,a,b,c = input().split()
    if s1 =='0' and s2 =='0':
        print(f1(a,b,c))
    if s1=='0' and s2=='1':
        print(f2(a,b,c))
    if s1=='1' and s2=='0':
        print(f3(a,b,c))
    if s1=='1' and s2=='1':
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) 

# 1639619, 2022-09-24 09:34:50, --P-[xx][P-P-] (17%)

def f1(a, b, c):
    #a=int(a);b=int(b);c=int(c)
    if a<0:
        a=1001
    if b<0:
        b=1001
    if c<0:
        c=1001
    ans =min(a,b,c)
    return ans
def f2(a, b, c):
    #a=int(a);b=int(b);c=int(c)
    if a>0:
        a=-1001
    if b>0:
        b=-1001
    if c>0:
        c=-1001
    ans2 = max(a,b,c)
    return ans2
def f3(a, b, c):
    total = int(a)+int(b)+int(c)
    long = len(str(total))
    ans3 = abs(total//(10**(long-1)))
    return ans3
def f4(a, b, c):
    total1 = int(a)+int(b)+int(c)
    ans4 = abs(total1)
    ans4 = str(ans4)
    return ans4[-1]
def main():
    s1,s2,a,b,c = input().split()
    if s1 =='0' and s2 =='0':
        print(f1(a,b,c))
    if s1=='0' and s2=='1':
        print(f2(a,b,c))
    if s1=='1' and s2=='0':
        print(f3(a,b,c))
    if s1=='1' and s2=='1':
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())
# 1639725, 2022-09-24 09:37:48, ----[--][P-P-] (0%)

def f1(a, b, c):
    a=int(a);b=int(b);c=int(c)
    if a<0:
        a=1001
    if b<0:
        b=1001
    if c<0:
        c=1001
    ans =min(a,b,c)
    return ans
def f2(a, b, c):
    a=int(a);b=int(b);c=int(c)
    if a>0:
        a=-1001
    if b>0:
        b=-1001
    if c>0:
        c=-1001
    ans2 = max(a,b,c)
    return ans2
def f3(a, b, c):
    total = int(a)+int(b)+int(c)
    ans3 = abs(total)
    ans3 = str(ans3)
    return ans3[0]
def f4(a, b, c):
    total1 = int(a)+int(b)+int(c)
    ans4 = abs(total1)
    ans4 = str(ans4)
    return ans4[-1]
def main():
    s1,s2,a,b,c = input().split()
    if s1 =='0' and s2 =='0':
        print(f1(a,b,c))
    if s1=='0' and s2=='1':
        print(f2(a,b,c))
    if s1=='1' and s2=='0':
        print(f3(a,b,c))
    if s1=='1' and s2=='1':
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) 

# 1640248, 2022-09-24 09:52:05, --PP[--][P-P-] (33%)

def f1(a, b, c):
    a=int(a);b=int(b);c=int(c)
    if a<0:
        a=1001
    if b<0:
        b=1001
    if c<0:
        c=1001
    ans =min(a,b,c)
    return ans
def f2(a, b, c):
    a=int(a);b=int(b);c=int(c)
    if a>0:
        a=-1001
    if b>0:
        b=-1001
    if c>0:
        c=-1001
    ans2 = max(a,b,c)
    return ans2
def f3(a, b, c):
    total = int(a)+int(b)+int(c)
    ans3 = abs(total)
    ans3 = str(ans3)
    return int(ans3[0])
def f4(a, b, c):
    total1 = int(a)+int(b)+int(c)
    ans4 = abs(total1)
    ans4 = str(ans4)
    return int(ans4[-1])
def main():
    s1,s2,a,b,c = input().split()
    if s1 =='0' and s2 =='0':
        print(f1(a,b,c))
    if s1=='0' and s2=='1':
        print(f2(a,b,c))
    if s1=='1' and s2=='0':
        print(f3(a,b,c))
    if s1=='1' and s2=='1':
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) 

# 1640341, 2022-09-24 09:55:02, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    a=int(a);b=int(b);c=int(c)
    if a<0:
        a=1001
    if b<0:
        b=1001
    if c<0:
        c=1001
    ans =min(a,b,c)
    return int(ans)
def f2(a, b, c):
    a=int(a);b=int(b);c=int(c)
    if a>0:
        a=-1001
    if b>0:
        b=-1001
    if c>0:
        c=-1001
    ans2 = max(a,b,c)
    return int(ans2)
def f3(a, b, c):
    total = int(a)+int(b)+int(c)
    ans3 = abs(total)
    ans3 = str(ans3)
    return int(ans3[0])
def f4(a, b, c):
    total1 = int(a)+int(b)+int(c)
    ans4 = abs(total1)
    ans4 = str(ans4)
    return int(ans4[-1])
def main():
    s1,s2,a,b,c = input().split()
    if s1 =='0' and s2 =='0':
        print(f1(a,b,c))
    elif s1=='0' and s2=='1':
        print(f2(a,b,c))
    elif s1=='1' and s2=='0':
        print(f3(a,b,c))
    elif s1=='1' and s2=='1':
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) 

# 1640761, 2022-09-24 10:06:22, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    a=int(a);b=int(b);c=int(c)
    ans=[]
    if a>0:
        ans.append(a)
    if b>0:
        ans.append(b)
    if c>0:
        ans.append(c)
    ans =min(ans)
    return int(ans)
def f2(a, b, c):
    a=int(a);b=int(b);c=int(c)
    ans2=[]
    if a<0:
        ans2.append(a)
    if b<0:
        ans2.append(b)
    if c<0:
        ans2.append(c)
    ans2 = max(ans2)
    return int(ans2)
def f3(a, b, c):
    total = int(a)+int(b)+int(c)
    ans3 = abs(total)
    ans3 = str(ans3)
    return int(ans3[0])
def f4(a, b, c):
    total1 = int(a)+int(b)+int(c)
    ans4 = abs(total1)
    ans4 = str(ans4)
    return int(ans4[-1])
def main():
    s1,s2,a,b,c = input().split()
    if s1 =='0' and s2 =='0':
        print(f1(a, b, c))
    elif s1=='0' and s2=='1':
        print(f2(a, b, c))
    elif s1=='1' and s2=='0':
        print(f3(a,b,c))
    elif s1=='1' and s2=='1':
        print(f4(a, b, c))
    else:
        print('Error')
exec(input().strip()) 

6431416121
# 1640060, 2022-09-24 09:47:07, PP--[--][P-P-] (33%)

def f4(a, b, c) :
    x = str(abs(a+b+c))
    p = x[-1]
    return p

def f3(a, b, c) :
    x = str(abs(a+b+c))
    p = x[0]
    return p

def f2(a, b, c) :
    x = [a, b, c]
    y = []
    for i in range(len(x)) :
        if x[i] < 0 :
            y.append(x[i])
    maxy = max(y)
    
    return maxy

def f1(a, b, c) :
    x = [a, b, c]
    y = []
    for i in range(len(x)) :
        if x[i] > 0 :
            y.append(x[i])
    miny = min(y)
    
    return miny
def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c)
)
    if s1 == 0 and s2 == 1 :
        print(f2(a, b, c)
)
    if s1 == 1 and s2 == 0 :
        print(f3(a, b, c)
)
    if s1 == 1 and s2 == 1 :
        print(f4(a, b, c)
)
    else :
        print('Error')

exec(input().strip()) # DON'T remove this line

        

# 1640075, 2022-09-24 09:47:36, compilation error (0%)

def f4(a, b, c) :
    x = str(abs(a+b+c))
    p = x[-1]
    return p

def f3(a, b, c) :
    x = str(abs(a+b+c))
    p = x[0]
    return p

def f2(a, b, c) :
    x = [a, b, c]
    y = []
    for i in range(len(x)) :
        if x[i] < 0 :
            y.append(x[i])
    maxy = max(y)
    
    return maxy

def f1(a, b, c) :
    x = [a, b, c]
    y = []
    for i in range(len(x)) :
        if x[i] > 0 :
            y.append(x[i])
    miny = min(y)
    
    return miny

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c)
        
    if s1 == 0 and s2 == 1 :
        print(f2(a, b, c)
        
    if s1 == 1 and s2 == 0 :
        print(f3(a, b, c)

    if s1 == 1 and s2 == 1 :
        print(f4(a, b, c)

    else :
        print('Error')

exec(input().strip()) # DON'T remove this line
# 1640089, 2022-09-24 09:47:52, PP--[--][P-P-] (33%)

def f4(a, b, c) :
    x = str(abs(a+b+c))
    p = x[-1]
    return p

def f3(a, b, c) :
    x = str(abs(a+b+c))
    p = x[0]
    return p

def f2(a, b, c) :
    x = [a, b, c]
    y = []
    for i in range(len(x)) :
        if x[i] < 0 :
            y.append(x[i])
    maxy = max(y)
    
    return maxy

def f1(a, b, c) :
    x = [a, b, c]
    y = []
    for i in range(len(x)) :
        if x[i] > 0 :
            y.append(x[i])
    miny = min(y)
    
    return miny

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
        
    if s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
        
    if s1 == 1 and s2 == 0 :
        print(f3(a, b, c))

    if s1 == 1 and s2 == 1 :
        print(f4(a, b, c))

    else :
        print('Error')

exec(input().strip()) # DON'T remove this line
# 1640215, 2022-09-24 09:51:17, PPPP[--][P-P-] (67%)

def f4(a, b, c) :
    x = str(abs(a+b+c))
    p = x[-1]
    return int(p)

def f3(a, b, c) :
    x = str(abs(a+b+c))
    p = x[0]
    return int(p)

def f2(a, b, c) :
    x = [a, b, c]
    y = []
    for i in range(len(x)) :
        if int(x[i]) < 0 :
            y.append(x[i])
    maxy = max(y)
    
    return maxy

def f1(a, b, c) :
    x = [a, b, c]
    y = []
    for i in range(len(x)) :
        if int(x[i]) > 0 :
            y.append(x[i])
    miny = min(y)
    
    return miny
def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c)
)
    if s1 == 0 and s2 == 1 :
        print(f2(a, b, c)
)
    if s1 == 1 and s2 == 0 :
        print(f3(a, b, c)
)
    if s1 == 1 and s2 == 1 :
        print(f4(a, b, c)
)
    else :
        print('Error')

exec(input().strip()) # DON'T remove this line

        

# 1640252, 2022-09-24 09:52:08, PPPP[--][P-P-] (67%)

def f1(a, b, c) :
    x = [a, b, c]
    y = []
    for i in range(len(x)) :
        if int(x[i]) > 0 :
            y.append(x[i])
    miny = min(y)
    
    return miny
    
def f2(a, b, c) :
    x = [a, b, c]
    y = []
    for i in range(len(x)) :
        if int(x[i]) < 0 :
            y.append(x[i])
    maxy = max(y)
    
    return maxy    
    

def f3(a, b, c) :
    x = str(abs(a+b+c))
    p = x[0]
    return int(p)

def f4(a, b, c) :
    x = str(abs(a+b+c))
    p = x[-1]
    return int(p)

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c)
)
    if s1 == 0 and s2 == 1 :
        print(f2(a, b, c)
)
    if s1 == 1 and s2 == 0 :
        print(f3(a, b, c)
)
    if s1 == 1 and s2 == 1 :
        print(f4(a, b, c)
)
    else :
        print('Error')

exec(input().strip()) # DON'T remove this line
# 1640284, 2022-09-24 09:53:08, PPPP[PP][PPPP] (100%)

def f1(a, b, c) :
    x = [a, b, c]
    y = []
    for i in range(len(x)) :
        if int(x[i]) > 0 :
            y.append(x[i])
    miny = min(y)
    
    return miny
    
def f2(a, b, c) :
    x = [a, b, c]
    y = []
    for i in range(len(x)) :
        if int(x[i]) < 0 :
            y.append(x[i])
    maxy = max(y)
    
    return maxy    
    

def f3(a, b, c) :
    x = str(abs(a+b+c))
    p = x[0]
    return int(p)

def f4(a, b, c) :
    x = str(abs(a+b+c))
    p = x[-1]
    return int(p)

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c)
)
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c)
)
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c)
)
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c)
)
    else :
        print('Error')

exec(input().strip()) # DON'T remove this line


6431510421
# 1639898, 2022-09-24 09:42:23, ----[--][----] (0%)

def f1(a, b, c):
    d = []
    s = [a] + [b] + [c]
    for i in range(len(s)):
        if int(s[i]) > 0:
            d += [s[i]]
        else:
            d += []
    r = min(d)
    return r

def f2(a, b, c):
    d = []
    s = [a] + [b] + [c]
    for i in range(len(s)):
        if int(s[i]) < 0:
            d += [s[i]]
        else:
            d += []
    r = max(d)
    return r

def f3(a, b, c):
    s = a+b+c
    s = abs(s)
    s = str(s)
    s = s[0]
    return s

def f4(a, b, c):
    s = a+b+c
    s = abs(s)
    s = str(s)
    s = s[-1]
    return s

def main():
    d = input().split()
    x = []
    for i in range(len(d)):
        x.append(int(d[i]))
    if x[0] == 0 and x[1] == 0:
        print(f1(x[2], x[3], x[4]))
    elif x[0] == 0 and x[1] == 1:
        print(f2(x[2], x[3], x[4]))
    elif x[0] == 1 and x[1] == 0:
        print(f3(x[2], x[3], x[4]))
    elif x[0] == 1 and x[1] == 1:
        print(f4(x[2], x[3], x[4]))
    elif x[0] != 0 and x[0] != 1 and x[1] != 0 and x[1] != 1:
        print('Error')
# 1639916, 2022-09-24 09:42:51, PP--[PP][-P-P] (50%)

def f1(a, b, c):
    d = []
    s = [a] + [b] + [c]
    for i in range(len(s)):
        if int(s[i]) > 0:
            d += [s[i]]
        else:
            d += []
    r = min(d)
    return r

def f2(a, b, c):
    d = []
    s = [a] + [b] + [c]
    for i in range(len(s)):
        if int(s[i]) < 0:
            d += [s[i]]
        else:
            d += []
    r = max(d)
    return r

def f3(a, b, c):
    s = a+b+c
    s = abs(s)
    s = str(s)
    s = s[0]
    return s

def f4(a, b, c):
    s = a+b+c
    s = abs(s)
    s = str(s)
    s = s[-1]
    return s

def main():
    d = input().split()
    x = []
    for i in range(len(d)):
        x.append(int(d[i]))
    if x[0] == 0 and x[1] == 0:
        print(f1(x[2], x[3], x[4]))
    elif x[0] == 0 and x[1] == 1:
        print(f2(x[2], x[3], x[4]))
    elif x[0] == 1 and x[1] == 0:
        print(f3(x[2], x[3], x[4]))
    elif x[0] == 1 and x[1] == 1:
        print(f4(x[2], x[3], x[4]))
    elif x[0] != 0 and x[0] != 1 and x[1] != 0 and x[1] != 1:
        print('Error')
exec(input().strip())
# 1640077, 2022-09-24 09:47:38, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    d = []
    s = [a] + [b] + [c]
    for i in range(len(s)):
        if int(s[i]) > 0:
            d += [s[i]]
        else:
            d += []
    r = min(d)
    return r

def f2(a, b, c):
    d = []
    s = [a] + [b] + [c]
    for i in range(len(s)):
        if int(s[i]) < 0:
            d += [s[i]]
        else:
            d += []
    r = max(d)
    return r

def f3(a, b, c):
    s = a+b+c
    s = abs(s)
    s = str(s)
    s = s[0]
    return s

def f4(a, b, c):
    s = a+b+c
    s = abs(s)
    s = str(s)
    s = s[-1]
    return s

def main():
    d = input().split()
    x = []
    for i in range(len(d)):
        x.append(int(d[i]))
    if x[0] == 0 and x[1] == 0:
        print(f1(x[2], x[3], x[4]))
    elif x[0] == 0 and x[1] == 1:
        print(f2(x[2], x[3], x[4]))
    elif x[0] == 1 and x[1] == 0:
        print(f3(x[2], x[3], x[4]))
    elif x[0] == 1 and x[1] == 1:
        print(f4(x[2], x[3], x[4]))
    else:
        print('Error')
exec(input().strip())
# 1640273, 2022-09-24 09:52:49, ----[--][----] (0%)

def f1(a, b, c):
    d = []
    s = [a] + [b] + [c]
    for i in range(len(s)):
        if int(s[i]) > 0:
            d += [s[i]]
        else:
            d += []
    r = min(d)
    return r

def f2(a, b, c):
    d = []
    s = [a] + [b] + [c]
    for i in range(len(s)):
        if int(s[i]) < 0:
            d += [s[i]]
        else:
            d += []
    r = max(d)
    return r

def f3(a, b, c):
    s = a+b+c
    s = abs(s)
    s = str(s)
    s = s[0]
    return s

def f4(a, b, c):
    s = a+b+c
    s = abs(s)
    s = str(s)
    s = s[-1]
    return s

def main():
    d = input().split()
    x = []
    for i in range(len(d)):
        x.append(int(d[i]))
    if x[0] == 0 and x[1] == 0:
        print(f1(x[2], x[3], x[4]))
    elif x[0] == 0 and x[1] == 1:
        print(f2(x[2], x[3], x[4]))
    elif x[0] == 1 and x[1] == 0:
        print(f3(x[2], x[3], x[4]))
    elif x[0] == 1 and x[1] == 1:
        print(f4(x[2], x[3], x[4]))
    else:
        print('Error')
# 1640285, 2022-09-24 09:53:11, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    d = []
    s = [a] + [b] + [c]
    for i in range(len(s)):
        if int(s[i]) > 0:
            d += [s[i]]
        else:
            d += []
    r = min(d)
    return r

def f2(a, b, c):
    d = []
    s = [a] + [b] + [c]
    for i in range(len(s)):
        if int(s[i]) < 0:
            d += [s[i]]
        else:
            d += []
    r = max(d)
    return r

def f3(a, b, c):
    s = a+b+c
    s = abs(s)
    s = str(s)
    s = s[0]
    return s

def f4(a, b, c):
    s = a+b+c
    s = abs(s)
    s = str(s)
    s = s[-1]
    return s

def main():
    d = input().split()
    x = []
    for i in range(len(d)):
        x.append(int(d[i]))
    if x[0] == 0 and x[1] == 0:
        print(f1(x[2], x[3], x[4]))
    elif x[0] == 0 and x[1] == 1:
        print(f2(x[2], x[3], x[4]))
    elif x[0] == 1 and x[1] == 0:
        print(f3(x[2], x[3], x[4]))
    elif x[0] == 1 and x[1] == 1:
        print(f4(x[2], x[3], x[4]))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1640774, 2022-09-24 10:06:39, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    d = []
    s = [a] + [b] + [c]
    for i in range(len(s)):
        if int(s[i]) > 0:
            d += [s[i]]
        else:
            d += []
    r = min(d)
    r = int(r)
    return r

def f2(a, b, c):
    d = []
    s = [a] + [b] + [c]
    for i in range(len(s)):
        if int(s[i]) < 0:
            d += [s[i]]
        else:
            d += []
    r = max(d)
    r = int(r)
    return r

def f3(a, b, c):
    s = a+b+c
    s = abs(s)
    s = str(s)
    s = s[0]
    s = int(s)
    return s

def f4(a, b, c):
    s = a+b+c
    s = abs(s)
    s = str(s)
    s = s[-1]
    s = int(s)
    return s

def main():
    d = input().split()
    x = []
    for i in range(len(d)):
        x.append(int(d[i]))
    if x[0] == 0 and x[1] == 0:
        print(f1(x[2], x[3], x[4]))
    elif x[0] == 0 and x[1] == 1:
        print(f2(x[2], x[3], x[4]))
    elif x[0] == 1 and x[1] == 0:
        print(f3(x[2], x[3], x[4]))
    elif x[0] == 1 and x[1] == 1:
        print(f4(x[2], x[3], x[4]))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line


6530104221
# 1639202, 2022-09-24 09:24:24, ----[--][----] (0%)

def f1(a,b,c):
   lol=a
   if b<lol and b>0:
       lol=b
   if c<lol and c>0:
       lol=c
   return lol
def f2(a,b,c):
    lol=a
    if b>lol and b<0:
        lol=b
    if c>lol and c<0:
        lol=c
    return lol
def f3(a,b,c):
    x=abs(a+b+c)
    y=len(str(x))
    z=x//(10**(y-1))
    return z
def f4(a,b,c):
    x=abs(a+b+c)
    y=x%10
    return y
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
# 1639265, 2022-09-24 09:25:58, --PP[PP][PPPP] (67%)

def f1(a,b,c):
   lol=a
   if b<lol and b>0:
       lol=b
   if c<lol and c>0:
       lol=c
   return lol
def f2(a,b,c):
    lol=a
    if b>lol and b<0:
        lol=b
    if c>lol and c<0:
        lol=c
    return lol
def f3(a,b,c):
    x=abs(a+b+c)
    y=len(str(x))
    z=x//(10**(y-1))
    return z
def f4(a,b,c):
    x=abs(a+b+c)
    y=x%10
    return y
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
        
exec(input().strip())
# 1639833, 2022-09-24 09:40:42, ----[-P][PPPP] (17%)

def f1(a,b,c):
   lol=a
   if b<lol and b>0:
       lol=b
   if c<lol and c>0:
       lol=c
   return lol,type(lol)
def f2(a,b,c):
    lol=a
    if b>lol and b<0:
        lol=b
    if c>lol and c<0:
        lol=c
    return lol
def f3(a,b,c):
    x=abs(a+b+c)
    y=str(x)
    z=y[0]
    return z
def f4(a,b,c):
    x=abs(a+b+c)
    y=str(x)
    z=y[-1]
    return z
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
        
exec(input().strip())
# 1639864, 2022-09-24 09:41:21, --PP[-P][PPPP] (50%)

def f1(a,b,c):
   lol=a
   if b<lol and b>0:
       lol=b
   if c<lol and c>0:
       lol=c
   return lol,type(lol)
def f2(a,b,c):
    lol=a
    if b>lol and b<0:
        lol=b
    if c>lol and c<0:
        lol=c
    return lol
def f3(a,b,c):
    x=abs(a+b+c)
    y=str(x)
    z=y[0]
    return int(z)
def f4(a,b,c):
    x=abs(a+b+c)
    y=str(x)
    z=y[-1]
    return int(z)
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
        
exec(input().strip())
# 1640218, 2022-09-24 09:51:21, --PP[PP][PPPP] (67%)

def f1(a,b,c):
   lol=a
   if b<=lol and b>0:
       lol=b
   if c<=lol and c>0:
       lol=c
   return lol
def f2(a,b,c):
    lol=a
    if b>=lol and b<0:
        lol=b
    if c>=lol and c<0:
        lol=c
    return lol
def f3(a,b,c):
    x=abs(a+b+c)
    y=len(str(x))
    z=x//(10**(y-1))
    return z
def f4(a,b,c):
    x=abs(a+b+c)
    y=x%10
    return y
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
        
exec(input().strip())
# 1640415, 2022-09-24 09:57:18, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    x=[a,b,c] ; y=[]
    for e in x:
        if e>0:
            y.append(e)
    return min(y)
def f2(a,b,c):
    x=[a,b,c] ; y=[]
    for e in x:
        if e<0:
            y.append(e)
    return max(y)
def f3(a,b,c):
    x=abs(a+b+c)
    y=len(str(x))
    z=x//(10**(y-1))
    return z
def f4(a,b,c):
    x=abs(a+b+c)
    y=x%10
    return y
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
        
exec(input().strip())

6530106521
# 1639130, 2022-09-24 09:22:56, ---x[--][PPPP] (17%)

def f1(a, b, c):
    for i in [a,b,c]:
        num = []
        if i > 0:
            num.append(i)
            return max(num)
    
def f2(a, b, c):
    for i in [a,b,c]:
        num = []
        if i < 0:
            num.append(i)
            return max(num)

def f3(a, b, c):
    x = a+b+c
    if x >= 0:
        x = str(x)
        return x[0]
    else:
        x = str(x)
        return x[1]
    
def f4(a, b, c):
    x = a+b+c
    return x[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 ==0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
    
exec(input().strip()) # DON'T remove this line

# 1639238, 2022-09-24 09:25:29, xx-x[Px][PPPP] (17%)

def f1(a, b, c):
    for i in [a,b,c]:
        num = []
        if i > 0:
            num.append(i)
    return max(num)
    
def f2(a, b, c):
    for i in [a,b,c]:
        num = []
        if i < 0:
            num.append(i)
    return max(num)

def f3(a, b, c):
    x = a+b+c
    if x >= 0:
        x = str(x)
        return x[0]
    else:
        x = str(x)
        return x[1]
    
def f4(a, b, c):
    x = a+b+c
    return x[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 ==0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
    
exec(input().strip()) # DON'T remove this line
# 1639382, 2022-09-24 09:29:01, xx--[--][PPPP] (17%)

def f1(a, b, c):
    for i in [a,b,c]:
        num = []
        if i > 0:
            num.append(i)
        return max(num)
    
def f2(a, b, c):
    for i in [a,b,c]:
        num = []
        if i < 0:
            num.append(i)
        return max(num)

def f3(a, b, c):
    x = a+b+c
    if x >= 0:
        x = str(x)
        return x[0]
    else:
        x = str(x)
        return x[1]
    
def f4(a, b, c):
    x = a+b+c
    x = str(x)
    return x[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 ==0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
    
exec(input().strip()) # DON'T remove this line

# 1639451, 2022-09-24 09:30:43, compilation error (0%)

def f1(a, b, c):
    for i in [a,b,c]:
        num = []
        if i > 0:
            num.append(i)
      return max(num)
    
def f2(a, b, c):
    for i in [a,b,c]:
        num = []
        if i < 0:
            num.append(i)
      return max(num)

def f3(a, b, c):
    x = a+b+c
    if x >= 0:
        x = str(x)
        return x[0]
    else:
        x = str(x)
        return x[1]
    
def f4(a, b, c):
    x = a+b+c
    x = str(x)
    return x[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 ==0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
    
exec(input().strip()) # DON'T remove this line
# 1639653, 2022-09-24 09:35:48, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    num = []
    for i in [a,b,c]:
        if i > 0:
            num.append(i)
    return min(num)
    
def f2(a, b, c):
    num = []
    for i in [a,b,c]:
        if i < 0:
            num.append(i)
    return max(num)

def f3(a, b, c):
    x = a+b+c
    if x >= 0:
        x = str(x)
        return x[0]
    else:
        x = str(x)
        return x[1]
    
def f4(a, b, c):
    x = a+b+c
    x = str(x)
    return x[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 ==0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
    
exec(input().strip()) # DON'T remove this line

# 1640407, 2022-09-24 09:57:05, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    num = []
    for i in [a,b,c]:
        if i > 0:
            num.append(i)
    return min(num)
    
def f2(a, b, c):
    num = []
    for i in [a,b,c]:
        if i < 0:
            num.append(i)
    return max(num)

def f3(a, b, c):
    x = a+b+c
    if x >= 0:
        x = str(x)
        return int(x[0])
    else:
        x = str(x)
        return int(x[1])
    
def f4(a, b, c):
    x = a+b+c
    x = str(x)
    return int(x[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 ==0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
    
exec(input().strip()) # DON'T remove this line


6530153021
# 1639786, 2022-09-24 09:39:13, PP-P[xx][xxxx] (50%)


def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    d = [a,b,c]
    x = []
    for e in d :
        if e > 0 :
            x.append(e)
    return min(x)
        
def f2(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    d = [a,b,c]
    x = []
    for e in d :
        if e < 0 :
            x.append(e)
    return max(x)
    

def f3(a, b, c):
    ruam = abs(a+b+c)
    return ruam//10
    
def f4(a, b, c):
    ruam = abs(a+b+c)
    return ruam%10

def main():
    if s1 == 1 and s2 == 1 :
        print(def_f1(a,b,c))
    


exec(input().strip()) 

# 1639954, 2022-09-24 09:43:59, PP--[xx][xxxx] (33%)


def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    d = [a,b,c]
    x = []
    for e in d :
        if e > 0 :
            x.append(e)
    return min(x)
        
def f2(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    d = [a,b,c]
    x = []
    for e in d :
        if e < 0 :
            x.append(e)
    return max(x)
    

def f3(a, b, c):
    ruam = abs(a+b+c)
    final = []
    for e in str(ruam) :
        final.append(e)
    
    return final[0]
    
def f4(a, b, c):
    ruam = abs(a+b+c)
    final = []
    for e in str(ruam) :
        final.append(e)
    return final[-1]

def main():
    if s1 == 1 and s2 == 1 :
        print(def_f1(a,b,c))
    


exec(input().strip()) 

# 1639990, 2022-09-24 09:44:48, PP-P[xx][xxxx] (50%)


def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    d = [a,b,c]
    x = []
    for e in d :
        if e > 0 :
            x.append(e)
    return min(x)
        
def f2(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    d = [a,b,c]
    x = []
    for e in d :
        if e < 0 :
            x.append(e)
    return max(x)
    

def f3(a, b, c):
    ruam = abs(a+b+c)
    
    return ruam//10
    
def f4(a, b, c):
    ruam = abs(a+b+c)
    return ruam%10

def main():
    if s1 == 1 and s2 == 1 :
        print(def_f1(a,b,c))
    


exec(input().strip()) 

# 1640602, 2022-09-24 10:02:13, PP-P[--][P-P-] (50%)

def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    d = [a,b,c]
    x = []
    for e in d :
        if e > 0 :
            x.append(e)
    return min(x)
        
def f2(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    d = [a,b,c]
    x = []
    for e in d :
        if e < 0 :
            x.append(e)
    return max(x)
    

def f3(a, b, c):
    ruam = abs(a+b+c)
    
    return ruam//10
    
def f4(a, b, c):
    ruam = abs(a+b+c)
    return ruam%10

def main():
    s1,s2,a,b,c = input().split()
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
    


exec(input().strip()) 

# 1641050, 2022-09-24 10:13:52, PP-P[PP][P-P-] (67%)

def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    d = [a,b,c]
    x = []
    for e in d :
        if e > 0 :
            x.append(e)
    return min(x)
        
def f2(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    d = [a,b,c]
    x = []
    for e in d :
        if e < 0 :
            x.append(e)
    return max(x)
    

def f3(a, b, c):
    ruam = abs(a+b+c)
    
    return ruam//10
    
def f4(a, b, c):
    ruam = abs(a+b+c)
    return ruam%10

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    
    
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
    


exec(input().strip()) 

# 1641188, 2022-09-24 10:17:18, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    d = [a,b,c]
    x = []
    for e in d :
        if e > 0 :
            x.append(e)
    return min(x)
        
def f2(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    d = [a,b,c]
    x = []
    for e in d :
        if e < 0 :
            x.append(e)
    return max(x)
    

def f3(a, b, c):
    ruam = abs(a+b+c)
    f = []
    for i in str(ruam):
        f.append(int(i))
    
    
    return f[0]
    
def f4(a, b, c):
    ruam = abs(a+b+c)
    f = []
    for i in str(ruam) :
        
        f.append(int(i))
        
    return f[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    
    
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
    


exec(input().strip()) 


6530186721
# 1638974, 2022-09-24 09:19:19, PPxx[xx][xxxx] (33%)

def f1(a,b,c):
    x = [int(a),int(b),int(c)]
    y = []
    for i in range(3):
        if x[i] > 0:
            y.append(x[i])
    y = min(y)
    return y
    
def f2(a,b,c):
    x = [int(a),int(b),int(c)]
    y = []
    for i in range(3):
        if x[i] < 0:
            y.append(x[i])
    y = max(y)
    return y    
    
def f3(a,b,c):
    x = abs(sum[int(a),int(b),int(c)])
    x = x[0]
    return x

def f4(a,b,c):
    x = abs(sum[int(a),int(b),int(c)])
    x = x[-1]
    return x    
    
def main() :
    s1 = int(input())
    s2 = int(input())
    a = int(input())
    b = int(input())
    c = int(input())
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
        
exec(input().strip())


# 1639120, 2022-09-24 09:22:34, PP--[xx][xxxx] (33%)

def f1(a,b,c):
    x = [int(a),int(b),int(c)]
    y = []
    for i in range(3):
        if x[i] > 0:
            y.append(x[i])
    y = min(y)
    return y
    
def f2(a,b,c):
    x = [int(a),int(b),int(c)]
    y = []
    for i in range(3):
        if x[i] < 0:
            y.append(x[i])
    y = max(y)
    return y    
    
def f3(a,b,c):
    x = [int(a),int(b),int(c)]
    x = abs(sum(x))
    x = str(x)
    x = x[0]
    return x

def f4(a,b,c):
    x = [int(a),int(b),int(c)]
    x = sum(x)
    x = str(x)
    x = x[-1]
    return x    
    
def main() :
    s1 = int(input())
    s2 = int(input())
    a = int(input())
    b = int(input())
    c = int(input())
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
        
exec(input().strip())


# 1639277, 2022-09-24 09:26:05, PP--[--][P-P-] (33%)

def f1(a,b,c):
    x = [int(a),int(b),int(c)]
    y = []
    for i in range(3):
        if x[i] > 0:
            y.append(x[i])
    y = min(y)
    return y
    
def f2(a,b,c):
    x = [int(a),int(b),int(c)]
    y = []
    for i in range(3):
        if x[i] < 0:
            y.append(x[i])
    y = max(y)
    return y    
    
def f3(a,b,c):
    x = [int(a),int(b),int(c)]
    x = abs(sum(x))
    x = str(x)
    x = x[0]
    return x

def f4(a,b,c):
    x = [int(a),int(b),int(c)]
    x = sum(x)
    x = str(x)
    x = x[-1]
    return x    
    
def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
        
exec(input().strip())


# 1642011, 2022-09-24 10:32:55, PPP-[--][P-P-] (50%)

def f1(a,b,c):
    x = [a,b,c]
    y = []
    for i in range(3):
        if x[i] > 0:
            y.append(x[i])
    y = min(y)
    return y
    
def f2(a,b,c):
    x = [a,b,c]
    y = []
    for i in range(3):
        if x[i] < 0:
            y.append(x[i])
    y = max(y)
    return y    
    
def f3(a,b,c):
    x = [int(a),int(b),int(c)]
    x = (sum(x)**2)**0.5
    x = str(x)
    x = int(x[0])
    return x

def f4(a,b,c):
    x = [int(a),int(b),int(c)]
    x = (sum(x)**2)**0.5
    x = str(x)
    x = int(x[-1])
    return x    
    
def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
        
exec(input().strip())


# 1642115, 2022-09-24 10:34:33, PPPP[--][P-P-] (67%)

def f1(a,b,c):
    x = [a,b,c]
    y = []
    for i in range(3):
        if x[i] > 0:
            y.append(x[i])
    y = min(y)
    return y
    
def f2(a,b,c):
    x = [a,b,c]
    y = []
    for i in range(3):
        if x[i] < 0:
            y.append(x[i])
    y = max(y)
    return y    
    
def f3(a,b,c):
    x = [int(a),int(b),int(c)]
    x = abs(sum(x))
    x = str(x)
    x = int(x[0])
    return x

def f4(a,b,c):
    x = [int(a),int(b),int(c)]
    x = abs(sum(x))
    x = str(x)
    x = int(x[-1])
    return x    
    
def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
        
exec(input().strip())


# 1642382, 2022-09-24 10:38:03, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    x = [a,b,c]
    y = []
    for i in range(3):
        if x[i] > 0:
            y.append(x[i])
    y = min(y)
    return y
    
def f2(a,b,c):
    x = [a,b,c]
    y = []
    for i in range(3):
        if x[i] < 0:
            y.append(x[i])
    y = max(y)
    return y    
    
def f3(a,b,c):
    x = [int(a),int(b),int(c)]
    x = abs(sum(x))
    x = str(x)
    x = int(x[0])
    return x

def f4(a,b,c):
    x = [int(a),int(b),int(c)]
    x = abs(sum(x))
    x = str(x)
    x = int(x[-1])
    return x    
    
def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
        
exec(input().strip())



6530204321
# 1639052, 2022-09-24 09:21:15, PP--[--][P-P-] (33%)

def f1(a,b,c):
    test = []
    for i in [a,b,c]:
        if i>0:
            test.append(i)
    return min(test)
def f2(a,b,c):
    test = []
    for i in [a,b,c]:
        if i<0:
            test.append(i)
    return max(test)
def f3(a,b,c):
    plus = a+b+c
    plus = abs(plus)
    return str(plus)[0]
def f4(a,b,c):
    plus = a+b+c
    return str(plus)[-1]
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1==0 and s2==1:
        print(f2(a,b,c))
    if s1 == 1 and s2==0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())

# 1639189, 2022-09-24 09:24:14, PPPP[--][P-P-] (67%)

def f1(a,b,c):
    test = []
    for i in [a,b,c]:
        if i>0:
            test.append(i)
    return min(test)
def f2(a,b,c):
    test = []
    for i in [a,b,c]:
        if i<0:
            test.append(i)
    return max(test)
def f3(a,b,c):
    plus = a+b+c
    plus = abs(plus)
    return int(str(plus)[0])
def f4(a,b,c):
    plus = a+b+c
    return int(str(plus)[-1])
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1==0 and s2==1:
        print(f2(a,b,c))
    if s1 == 1 and s2==0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())

# 1639275, 2022-09-24 09:26:03, PPPP[--][P-P-] (67%)

def f1(a,b,c):
    test = []
    for i in [a,b,c]:
        if int(i)>0:
            test.append(int(i))
    return min(test)
def f2(a,b,c):
    test = []
    for i in [a,b,c]:
        if int(i)<0:
            test.append(int(i))
    return max(test)
def f3(a,b,c):
    plus = a+b+c
    plus = abs(plus)
    return int(str(plus)[0])
def f4(a,b,c):
    plus = a+b+c
    return int(str(plus)[-1])
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1==0 and s2==1:
        print(f2(a,b,c))
    if s1 == 1 and s2==0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())

# 1639300, 2022-09-24 09:26:55, PPPP[--][P-P-] (67%)

def f1(a,b,c):
    test = []
    for i in [a,b,c]:
        if int(i)>0:
            test.append(int(i))
    return min(test)
def f2(a,b,c):
    test = []
    for i in [a,b,c]:
        if int(i)<0:
            test.append(int(i))
    return max(test)
def f3(a,b,c):
    plus = a+b+c
    plus = abs(plus)
    return int(str(plus)[0])
def f4(a,b,c):
    plus = a+b+c
    plus = abs(plus)
    return int(str(plus)[-1])
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1==0 and s2==1:
        print(f2(a,b,c))
    if s1 == 1 and s2==0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())

# 1639429, 2022-09-24 09:30:13, PPPP[--][P-P-] (67%)

def f1(a,b,c):
    test = []
    for i in [a,b,c]:
        if int(i)>0:
            test.append(int(i))
    return min(test)
def f2(a,b,c):
    test = []
    for i in [a,b,c]:
        if int(i)<0:
            test.append(int(i))
    return max(test)
def f3(a,b,c):
    plus = a+b+c
    plus = abs(plus)
    return int(str(plus)[0])
def f4(a,b,c):
    plus = a+b+c
    plus = abs(plus)
    return int(str(plus)[-1])
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if int(s1) == 0 and int(s2) == 0:
        print(f1(a,b,c))
    if int(s1) == 0 and int(s2) == 0:
        print(f2(a,b,c))
    if int(s1) == 0 and int(s2) == 0:
        print(f3(a,b,c))
    if int(s1) == 0 and int(s2) == 0:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())

# 1639577, 2022-09-24 09:33:51, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    test = []
    for i in [a,b,c]:
        if int(i)>0:
            test.append(int(i))
    return min(test)
def f2(a,b,c):
    test = []
    for i in [a,b,c]:
        if int(i)<0:
            test.append(int(i))
    return max(test)
def f3(a,b,c):
    plus = a+b+c
    plus = abs(plus)
    return int(str(plus)[0])
def f4(a,b,c):
    plus = a+b+c
    return int(str(plus)[-1])
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1 == 1 and s2==0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())


6531312621
# 1639287, 2022-09-24 09:26:21, PPPP[--][P-P-] (67%)

def f1(a,b,c):
    s = []
    if a > 0:
        s.append(a)
    if b > 0:
        s.append(b)
    if c > 0:
        s.append(c)
    return min(s)

def f2(a, b, c):
    s = []
    if a < 0:
        s.append(a)
    if b < 0:
        s.append(b)
    if c < 0:
        s.append(c)
    return max(s)

def f3(a, b, c):
    s = a + b + c
    s = str(abs(s))
    return int(s[0])

def  f4(a, b, c):
    s = a + b + c
    s = str(s)
    return int(s[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

exec(input().strip())
# 1640565, 2022-09-24 10:01:07, --PP[--][P-P-] (33%)

def f1(a,b,c):
    if a < 0:
        a = 1001
    if b < 0:
        b = 1001
    if c < 0:
        c = 1001
    return min(a,b,c)

def f2(a, b, c):
    if a > 0:
        a = -1001
    if b > 0:
        b = -1001
    if c > 0:
        c = -1001
    return max(a,b,c)

def f3(a, b, c):
    s = a + b + c
    s = str(abs(s))
    return int(s[0])

def  f4(a, b, c):
    s = a + b + c
    s = str(abs(s))
    return int(s[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

exec(input().strip())
# 1640626, 2022-09-24 10:03:01, compilation error (0%)

def f1(a,b,c):
    if a <= 0:
        a = 1001
    if b <= 0:
        b = 1001
    if c = 0:
        c = 1001
    return min(a,b,c)

def f2(a, b, c):
    if a >= 0:
        a = -1001
    if b >= 0:
        b = -1001
    if c >= 0:
        c = -1001
    return max(a,b,c)

def f3(a, b, c):
    s = a + b + c
    s = str(abs(s))
    return int(s[0])

def  f4(a, b, c):
    s = a + b + c
    s = str(abs(s))
    return int(s[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

exec(input().strip())
# 1640663, 2022-09-24 10:03:52, PPPP[--][P-P-] (67%)

def f1(a,b,c):
    if a <= 0:
        a = 1001
    if b <= 0:
        b = 1001
    if c <= 0:
        c = 1001
    return min(a,b,c)

def f2(a, b, c):
    if a >= 0:
        a = -1001
    if b >= 0:
        b = -1001
    if c >= 0:
        c = -1001
    return max(a,b,c)

def f3(a, b, c):
    s = a + b + c
    s = str(abs(s))
    return int(s[0])

def  f4(a, b, c):
    s = a + b + c
    s = str(abs(s))
    return int(s[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

exec(input().strip())
# 1642044, 2022-09-24 10:33:29, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    if a <= 0:
        a = 1001
    if b <= 0:
        b = 1001
    if c <= 0:
        c = 1001
    return min(a,b,c)

def f2(a, b, c):
    if a >= 0:
        a = -1001
    if b >= 0:
        b = -1001
    if c >= 0:
        c = -1001
    return max(a,b,c)

def f3(a, b, c):
    s = a + b + c
    s = str(abs(s))
    return int(s[0])

def  f4(a, b, c):
    s = a + b + c
    s = str(abs(s))
    return int(s[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

exec(input().strip())
# 1642127, 2022-09-24 10:34:44, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    s = []
    if a > 0:
        s.append(a)
    if b > 0:
        s.append(b)
    if c > 0:
        s.append(c)
    return min(s)

def f2(a, b, c):
    s = []
    if a < 0:
        s.append(a)
    if b < 0:
        s.append(b)
    if c < 0:
        s.append(c)
    return max(s)

def f3(a, b, c):
    s = a + b + c
    s = str(abs(s))
    return int(s[0])

def  f4(a, b, c):
    s = a + b + c
    s = str(abs(s))
    return int(s[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

exec(input().strip())

6532106921
# 1639731, 2022-09-24 09:37:57, PPPP[--][----] (67%)

import math
def f1(a,b,c):
    a=max(0,a); b=max(0,b); c=max(0,c)
    if(a==0): a=10000
    if(b==0): b=10000
    if(c==0): c=10000
    return min(a,b,c)
def f2(a,b,c):
    a=min(0,a); b=min(0,b); c=min(0,c)
    if(a==0): a=-10000
    if(b==0): b=-10000
    if(c==0): c=-10000
    return max(a,b,c)
def f3(a,b,c):
    sum=abs(a+b+c)
    while(sum>=10):
        sum/=10
    return math.floor(sum)
def f4(a,b,c):
    sum=abs(a+b+c)
    while(sum>=10):
        sum%=10
    return sum

def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if(s1==0 and s2==0):
        print(f1(a,b,c))
    elif(s1==0 and s2):
        print(f2(a,b,c))
    elif(s1 and not s2):
        print(f3(a,b,c))
    if(s1 and s2):
        print(f4(a,b,c))
    else: print('Error')
exec(input().strip())
# 1639788, 2022-09-24 09:39:19, PPPP[PP][PPPP] (100%)

import math
def f1(a,b,c):
    a=max(0,a); b=max(0,b); c=max(0,c)
    if(a==0): a=10000
    if(b==0): b=10000
    if(c==0): c=10000
    return min(a,b,c)
def f2(a,b,c):
    a=min(0,a); b=min(0,b); c=min(0,c)
    if(a==0): a=-10000
    if(b==0): b=-10000
    if(c==0): c=-10000
    return max(a,b,c)
def f3(a,b,c):
    sum=abs(a+b+c)
    while(sum>=10):
        sum/=10
    return math.floor(sum)
def f4(a,b,c):
    sum=abs(a+b+c)
    while(sum>=10):
        sum%=10
    return sum

def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if(s1==0 and s2==0):
        print(f1(a,b,c))
    elif(s1==0 and s2==1):
        print(f2(a,b,c))
    elif(s1==1 and s2==0):
        print(f3(a,b,c))
    elif(s1==1 and s2==1):
        print(f4(a,b,c))
    else: print('Error')
exec(input().strip())
# 1641108, 2022-09-24 10:15:30, PP-P[PP][PPPP] (83%)

def f1(a,b,c):
    a=max(0,a); b=max(0,b); c=max(0,c)
    if(a==0): a=10000
    if(b==0): b=10000
    if(c==0): c=10000
    return min(a,b,c)
def f2(a,b,c):
    a=min(0,a); b=min(0,b); c=min(0,c)
    if(a==0): a=-10000
    if(b==0): b=-10000
    if(c==0): c=-10000
    return max(a,b,c)
def f3(a,b,c):
    sum=abs(a+b+c)
    sum=str(sum)
    return sum[0]
def f4(a,b,c):
    sum=abs(a+b+c)
    return sum%10

def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if(s1==0 and s2==0):
        print(f1(a,b,c))
    elif(s1==0 and s2==1):
        print(f2(a,b,c))
    elif(s1==1 and s2==0):
        print(f3(a,b,c))
    elif(s1==1 and s2==1):
        print(f4(a,b,c))
    else: print('Error')
exec(input().strip())
# 1641158, 2022-09-24 10:16:43, PP--[PP][PPPP] (67%)

def f1(a,b,c):
    a=max(0,a); b=max(0,b); c=max(0,c)
    if(a==0): a=10000
    if(b==0): b=10000
    if(c==0): c=10000
    return min(a,b,c)
def f2(a,b,c):
    a=min(0,a); b=min(0,b); c=min(0,c)
    if(a==0): a=-10000
    if(b==0): b=-10000
    if(c==0): c=-10000
    return max(a,b,c)
def f3(a,b,c):
    sum=abs(a+b+c)
    sum=str(sum)
    return sum[0]
def f4(a,b,c):
    sum=abs(a+b+c)
    sum=str(sum)
    return sum[len(sum)-1]

def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if(s1==0 and s2==0):
        print(f1(a,b,c))
    elif(s1==0 and s2==1):
        print(f2(a,b,c))
    elif(s1==1 and s2==0):
        print(f3(a,b,c))
    elif(s1==1 and s2==1):
        print(f4(a,b,c))
    else: print('Error')
exec(input().strip())
# 1641182, 2022-09-24 10:17:13, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    a=max(0,a); b=max(0,b); c=max(0,c)
    if(a==0): a=10000
    if(b==0): b=10000
    if(c==0): c=10000
    return min(a,b,c)
def f2(a,b,c):
    a=min(0,a); b=min(0,b); c=min(0,c)
    if(a==0): a=-10000
    if(b==0): b=-10000
    if(c==0): c=-10000
    return max(a,b,c)
def f3(a,b,c):
    sum=abs(a+b+c)
    sum=str(sum)
    return int(sum[0])
def f4(a,b,c):
    sum=abs(a+b+c)
    sum=str(sum)
    return int(sum[len(sum)-1])

def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if(s1==0 and s2==0):
        print(f1(a,b,c))
    elif(s1==0 and s2==1):
        print(f2(a,b,c))
    elif(s1==1 and s2==0):
        print(f3(a,b,c))
    elif(s1==1 and s2==1):
        print(f4(a,b,c))
    else: print('Error')
exec(input().strip())
# 1641300, 2022-09-24 10:19:30, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    a=max(0,a); b=max(0,b); c=max(0,c)
    if(a==0): a=10000
    if(b==0): b=10000
    if(c==0): c=10000
    return min(a,b,c)
def f2(a,b,c):
    a=min(0,a); b=min(0,b); c=min(0,c)
    if(a==0): a=-10000
    if(b==0): b=-10000
    if(c==0): c=-10000
    return max(a,b,c)
def f3(a,b,c):
    sum=abs(a+b+c)
    sum=str(sum)
    return int(sum[0])
def f4(a,b,c):
    sum=abs(a+b+c)
    sum=str(sum)
    return int(sum[len(sum)-1])

def main():
    s1,s2,a,b,c=input().split()
    s1=int(s1); s2=int(s2); a=int(a); b=int(b); c=int(c)
    if(s1==0 and s2==0):
        print(f1(a,b,c))
    elif(s1==0 and s2==1):
        print(f2(a,b,c))
    elif(s1==1 and s2==0):
        print(f3(a,b,c))
    elif(s1==1 and s2==1):
        print(f4(a,b,c))
    else: print('Error')
exec(input().strip())

6532124121
# 1639166, 2022-09-24 09:23:42, PP-P[PP][PPPP] (83%)

def f1(a,b,c):
    l = [a,b,c]
    l.sort()
    for t in l:
        if(t>0):
            break
    return t

def f2(a,b,c):
    l = [a,b,c]
    l.sort()
    t = 0
    for i in range(2,-1,-1):
        if(l[i]<0):
            t = l[i]
            break
    return t

def f3(a,b,c):
    n = a+b+c
    n = abs(n)
    while(n>10):
        n//=10
    return n

def f4(a,b,c):
    n = a+b+c
    n = abs(n)
    return n%10

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if(s1==0 and s2==0):
        print(f1(a,b,c))
    elif(s1==0 and s2==1):
        print(f2(a,b,c))
    elif(s1==1 and s2==0):
        print(f3(a,b,c))
    elif(s1==1 and s2==1):
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip())
# 1639617, 2022-09-24 09:34:48, PP-P[PP][PPPP] (83%)

def f1(a,b,c):
    l = [a,b,c]
    l.sort()
    for t in l:
        if(t>0):
            break
    return t

def f2(a,b,c):
    l = [a,b,c]
    l.sort()
    l = l[::-1]
    #print(l)
    t = 0
    for i in range(0,len(l)):
        if(l[i]<0):
            t = l[i]
            break
    return t

def f3(a,b,c):
    n = a+b+c
    n = abs(n)
    while(n>10):
        n//=10
    return n

def f4(a,b,c):
    n = a+b+c
    n = abs(n)
    return n%10

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if(s1==0 and s2==0):
        print(f1(a,b,c))
    elif(s1==0 and s2==1):
        print(f2(a,b,c))
    elif(s1==1 and s2==0):
        print(f3(a,b,c))
    elif(s1==1 and s2==1):
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip())
# 1640064, 2022-09-24 09:47:13, PP-P[PP][PPPP] (83%)

def f1(a,b,c):
    l = [a,b,c]
    l.sort()
    #print(l)
    for i in l:
        if(i>0):
            return i

def f2(a,b,c):
    l = [a,b,c]
    l.sort()
    l = l[::-1]
    #print(l)
    for i in l:
        if(i<0):
            return i

def f3(a,b,c):
    n = a+b+c
    n = abs(n)
    #print(n)
    while(n>10):
        n//=10
    return n

def f4(a,b,c):
    n = a+b+c
    n = abs(n)
    #print(n)
    return n%10

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if(s1==0 and s2==0):
        print(f1(a, b, c))
    elif(s1==0 and s2==1):
        print(f2(a, b, c))
    elif(s1==1 and s2==0):
        print(f3(a, b, c))
    elif(s1==1 and s2==1):
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip())
# 1640080, 2022-09-24 09:47:38, ---P[PP][PPPP] (50%)

def f1(a,b,c):
    l = [a,b,c]
    l.sort()
    #print(l)
    for i in l:
        if(i>=0):
            return i

def f2(a,b,c):
    l = [a,b,c]
    l.sort()
    l = l[::-1]
    #print(l)
    for i in l:
        if(i<=0):
            return i

def f3(a,b,c):
    n = a+b+c
    n = abs(n)
    #print(n)
    while(n>10):
        n//=10
    return n

def f4(a,b,c):
    n = a+b+c
    n = abs(n)
    #print(n)
    return n%10

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if(s1==0 and s2==0):
        print(f1(a, b, c))
    elif(s1==0 and s2==1):
        print(f2(a, b, c))
    elif(s1==1 and s2==0):
        print(f3(a, b, c))
    elif(s1==1 and s2==1):
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip())
# 1640102, 2022-09-24 09:48:09, PP-P[PP][PPPP] (83%)

def f1(a,b,c):
    l = [a,b,c]
    l.sort()
    #print(l)
    for i in l:
        if(i>0):
            return i

def f2(a,b,c):
    l = [a,b,c]
    l.sort()
    l = l[::-1]
    #print(l)
    for i in l:
        if(i<0):
            return i

def f3(a,b,c):
    n = a+b+c
    n = abs(n)
    #print(n)
    while(n>10):
        n//=10
    return n

def f4(a,b,c):
    n = a+b+c
    n = abs(n)
    #print(n)
    return n%10

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if(s1==0 and s2==0):
        print(f1(a, b, c))
    elif(s1==0 and s2==1):
        print(f2(a, b, c))
    elif(s1==1 and s2==0):
        print(f3(a, b, c))
    elif(s1==1 and s2==1):
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip())
# 1640224, 2022-09-24 09:51:28, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    l = [a,b,c]
    l.sort()
    #print(l)
    for i in l:
        if(i>0):
            return i

def f2(a,b,c):
    l = [a,b,c]
    l.sort()
    l = l[::-1]
    #print(l)
    for i in l:
        if(i<0):
            return i

def f3(a,b,c):
    n = a+b+c
    n = abs(n)
    #print(n)
    while(n>=10):
        n//=10
    return n

def f4(a,b,c):
    n = a+b+c
    n = abs(n)
    #print(n)
    return n%10

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if(s1==0 and s2==0):
        print(f1(a, b, c))
    elif(s1==0 and s2==1):
        print(f2(a, b, c))
    elif(s1==1 and s2==0):
        print(f3(a, b, c))
    elif(s1==1 and s2==1):
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip())

6531806321
# 1639717, 2022-09-24 09:37:30, PP--[--][----] (33%)

def f1(a,b,c):
    x=[a,b,c]
    y=list()
    for e in x:
        if e>0:
            y.append(e)
    return min(y)
def f2(a,b,c):
    m=[a,b,c]
    n=list()
    for e in m:
        if e<0:
            n.append(e)
    return max(n)
def f3(a,b,c):
    o=str(abs(a+b+c))
    return o[0]
def f4(a,b,c):
    r=str(abs(a+b+c))
    return r[-1]
def main():
    p=[int(e) for e in input().split()]
    s1=p[0]
    s2=p[1]
    a=p[2]
    b=p[3]
    c=p[4]
    print(s1,s2,a,b,c)
    if s1==0 and s2==0:
        return f1(a,b,c)
    elif s1==0 and s2==1:
        return f2(a,b,c)
    elif s1==1 and s2==0:
        return f3(a,b,c)
    elif s1==1 and s2==1:
        return f4(a,b,c)
    else:
        return 'Error'

exec(input().strip())
    

# 1640860, 2022-09-24 10:08:51, PP--[--][----] (33%)

def f1(a,b,c):
    x=[a,b,c]
    y=list()
    for e in x:
        if e>0:
            y.append(e)
    return min(y)
def f2(a,b,c):
    m=[a,b,c]
    n=list()
    for e in m:
        if e<0:
            n.append(e)
    return max(n)
def f3(a,b,c):
    o=str(abs(a+b+c))
    return o[0]
def f4(a,b,c):
    r=str(abs(a+b+c))
    return r[-1]
def main():
    p=[int(e) for e in input().split()]
    s1=p[0]
    s2=p[1]
    a=p[2]
    b=p[3]
    c=p[4]
    if s1==0 and s2==0:
        return f1(a,b,c)
    elif s1==0 and s2==1:
        return f2(a,b,c)
    elif s1==1 and s2==0:
        return f3(a,b,c)
    elif s1==1 and s2==1:
        return f4(a,b,c)
    else:
        return 'Error'

exec(input().strip())
# 1641678, 2022-09-24 10:26:51, PP--[--][----] (33%)

def f1(a,b,c):
    x=[a,b,c]
    y=list()
    for e in x:
        if e>0:
            y.append(e)
    return min(y)
def f2(a,b,c):
    m=[a,b,c]
    n=list()
    for e in m:
        if e<0:
            n.append(e)
    return max(n)
def f3(a,b,c):
    o=str(abs(a+b+c))
    return o[0]
def f4(a,b,c):
    r=str(abs(a+b+c))
    return r[-1]

def main():
    p=list()
    p=[int(e) for e in input().split()]
    s1=p[0]
    s2=p[1]
    a=p[2]
    b=p[3]
    c=p[4]
    
    print(s1,s2,a,b,c)
    if s1==0 and s2==0:
        return f1(a,b,c)
    elif s1==0 and s2==1:
        return f2(a,b,c)
    elif s1==1 and s2==0:
        return f3(a,b,c)
    elif s1==1 and s2==1:
        return f4(a,b,c)
    else:
        return 'Error'

exec(input().strip())
    

# 1641728, 2022-09-24 10:27:52, PP--[--][----] (33%)

def f1(a,b,c):
    x=[a,b,c]
    y=list()
    for e in x:
        if e>0:
            y.append(e)
    return min(y)
def f2(a,b,c):
    m=[a,b,c]
    n=list()
    for e in m:
        if e<0:
            n.append(e)
    return max(n)
def f3(a,b,c):
    o=str(abs(a+b+c))
    return o[0]
def f4(a,b,c):
    r=str(abs(a+b+c))
    return r[-1]

def main():
    p=list()
    p=[int(e) for e in input().split()]
    s1=p[0]
    s2=p[1]
    a=p[2]
    b=p[3]
    c=p[4]
    
    if s1==0 and s2==0:
        return f1(a,b,c)
    elif s1==0 and s2==1:
        return f2(a,b,c)
    elif s1==1 and s2==0:
        return f3(a,b,c)
    elif s1==1 and s2==1:
        return f4(a,b,c)
    else:
        return 'Error'

exec(input().strip())
# 1641912, 2022-09-24 10:30:54, PP--[PP][PPPP] (67%)

def f1(a,b,c):
    x=[a,b,c]
    y=list()
    for e in x:
        if e>0:
            y.append(e)
    return min(y)
def f2(a,b,c):
    m=[a,b,c]
    n=list()
    for e in m:
        if e<0:
            n.append(e)
    return max(n)
def f3(a,b,c):
    o=str(abs(a+b+c))
    return o[0]
def f4(a,b,c):
    r=str(abs(a+b+c))
    return r[-1]

def main():
    p=list()
    p=[int(e) for e in input().split()]
    s1=p[0]
    s2=p[1]
    a=p[2]
    b=p[3]
    c=p[4]
    if s1==0 and s2==0:
        return print(f1(a,b,c))
    elif s1==0 and s2==1:
        return print(f2(a,b,c))
    elif s1==1 and s2==0:
        return print(f3(a,b,c))
    elif s1==1 and s2==1:
        return print(f4(a,b,c))
    else:
        return print('Error')

exec(input().strip())
    

# 1642025, 2022-09-24 10:33:11, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    x=[a,b,c]
    y=list()
    for e in x:
        if e>0:
            y.append(e)
    return min(y)
def f2(a,b,c):
    m=[a,b,c]
    n=list()
    for e in m:
        if e<0:
            n.append(e)
    return max(n)
def f3(a,b,c):
    o=str(abs(a+b+c))
    return int(o[0])
def f4(a,b,c):
    r=str(abs(a+b+c))
    return int(r[-1])

def main():
    p=list()
    p=[int(e) for e in input().split()]
    s1=p[0]
    s2=p[1]
    a=p[2]
    b=p[3]
    c=p[4]
    if s1==0 and s2==0:
        return print(f1(a,b,c))
    elif s1==0 and s2==1:
        return print(f2(a,b,c))
    elif s1==1 and s2==0:
        return print(f3(a,b,c))
    elif s1==1 and s2==1:
        return print(f4(a,b,c))
    else:
        return print('Error')

exec(input().strip())

6431523621
# 1639121, 2022-09-24 09:22:34, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    p = [a,b,c]
    s = []
    for i in p :
        if i>0 and type(i)==int :
            s.append(i)
    return min(s)
def f2(a, b, c):
    p = [a,b,c]
    s = []
    for i in p :
        if i<0 and type(i)==int :
            s.append(i)
    return max(s)
def f3(a, b, c):
    p = a+b+c
    if p<0 :
        p*=(-1)
    return str(p)[0]
def f4(a, b, c):
    p = a+b+c
    if p<0 :
        p*=(-1)
    return str(p)[-1]
def main():
    s1,s2,a,b,c = [ int(i) for i in input().split() ]
    if s1==0 and s2==0 :
        print(f1(a,b,c))
    elif s1==0 and s2==1 :
        print(f2(a,b,c))
    elif s1==1 and s2==0 :
        print(f3(a,b,c))
    elif s1==1 and s2==1 :
        print(f4(a,b,c))
    else :
        print('Error')
exec(input().strip()) # DON'T remove this line

# 1639278, 2022-09-24 09:26:07, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    p = [a,b,c]
    s = []
    for i in p :
        if i>0 :
            if type(i)==int :
                s.append(i)
    return min(s)
def f2(a, b, c):
    p = [a,b,c]
    s = []
    for i in p :
        if i<0 :
            if type(i)==int :
                s.append(i)
    return max(s)
def f3(a, b, c):
    p = a+b+c
    if p<0 :
        p*=(-1)
    return str(p)[0]
def f4(a, b, c):
    p = a+b+c
    if p<0 :
        p*=(-1)
    return str(p)[-1]
def main():
    s1,s2,a,b,c = [ int(i) for i in input().split() ]
    if s1==0 and s2==0 :
        print(f1(a,b,c))
    elif s1==0 and s2==1 :
        print(f2(a,b,c))
    elif s1==1 and s2==0 :
        print(f3(a,b,c))
    elif s1==1 and s2==1 :
        print(f4(a,b,c))
    else :
        print('Error')
exec(input().strip()) # DON'T remove this line

# 1639403, 2022-09-24 09:29:32, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    p = [a,b,c]
    s = []
    for i in p :
        if i>0 :
            if type(i)==int :
                s.append(i)
    return min(s)
def f2(a, b, c):
    p = [a,b,c]
    s = []
    for i in p :
        if i<0 :
            if type(i)==int :
                s.append(i)
    return max(s)
def f3(a, b, c):
    p = a+b+c
    if p<0 :
        p*=(-1)
    return str(p)[0]
def f4(a, b, c):
    p = a+b+c
    if p<0 :
        p*=(-1)
    return str(p)[-1]
def main():
    s1,s2,a,b,c = [ int(i) for i in input().strip().split() ]
    if s1==0 and s2==0 :
        print(f1(a,b,c))
    elif s1==0 and s2==1 :
        print(f2(a,b,c))
    elif s1==1 and s2==0 :
        print(f3(a,b,c))
    elif s1==1 and s2==1 :
        print(f4(a,b,c))
    else :
        print('Error')
exec(input().strip()) # DON'T remove this line

# 1640122, 2022-09-24 09:49:00, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    p = [a,b,c]
    s = []
    for i in p :
        if i>0 :
            s.append(i)
    return min(s)
def f2(a, b, c):
    p = [a,b,c]
    s = []
    for i in p :
        if i<0 :
            s.append(i)
    return max(s)
def f3(a, b, c):
    p = a+b+c
    if p<0 :
        p*=(-1)
    return str(p)[0]
def f4(a, b, c):
    p = a+b+c
    if p<0 :
        p*=(-1)
    return str(p)[-1]
def main():
    s1,s2,a,b,c = [ int(i) for i in input().strip().split() ]
    if s1==0 and s2==0 :
        print(f1(a,b,c))
    elif s1==0 and s2==1 :
        print(f2(a,b,c))
    elif s1==1 and s2==0 :
        print(f3(a,b,c))
    elif s1==1 and s2==1 :
        print(f4(a,b,c))
    else :
        print('Error')
exec(input().strip()) # DON'T remove this line

# 1640302, 2022-09-24 09:53:39, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    p = [a,b,c]
    s = []
    for i in p :
        if i>0 :
            s.append(i)
    return min(s)
def f2(a, b, c):
    p = [a,b,c]
    s = []
    for i in p :
        if i<0 :
            s.append(i)
    return max(s)
def f3(a, b, c):
    p = a+b+c
    if p<0 :
        p*=(-1)
    return int(str(p)[0])
def f4(a, b, c):
    p = a+b+c
    if p<0 :
        p*=(-1)
    return int(str(p)[-1])
def main():
    s1,s2,a,b,c = [ int(i) for i in input().strip().split() ]
    if s1==0 and s2==0 :
        print(f1(a,b,c))
    elif s1==0 and s2==1 :
        print(f2(a,b,c))
    elif s1==1 and s2==0 :
        print(f3(a,b,c))
    elif s1==1 and s2==1 :
        print(f4(a,b,c))
    else :
        print('Error')
exec(input().strip()) # DON'T remove this line


6431418421
# 1640177, 2022-09-24 09:50:26, --PP[PP][PPPP] (67%)

def f1(a,b,c):
    f=[a,b,c]
    for i in f:
        if i <= 0:
            f.remove(i)
    return min(f)

def f2(a, b, c):
    f=[a,b,c]
    for i in f:
        if i >= 0:
            f.remove(i)
    return max(f)
    
def f3(a, b, c):
    pl= a+b+c
    if pl<0:
        pl *= -1
    pl=str(pl)
    wa=int(pl[0])
    return wa
    
def f4(a, b, c):
    pl= a+b+c
    if pl<0:
        pl *= -1
    pl=str(pl)
    wa=int(pl[-1])
    return wa

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 ==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2== 1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1640824, 2022-09-24 10:07:57, ----[--][----] (0%)

def f1(a,b,c):
    f=[a,b,c]
    for i in f:
        if i <= 0:
            f.remove(i)
    return min(f)

def f2(a, b, c):
    f=[a,b,c]
    for i in f:
        if i >= 0:
            f.remove(i)
    return max(f)
    
def f3(a, b, c):
    pl= a+b+c
    if pl<0:
        pl *= -1
    pl=str(pl)
    wa=int(pl[0])
    return wa
    
def f4(a, b, c):
    pl= a+b+c
    if pl<0:
        pl *= -1
    pl=str(pl)
    wa=int(pl[-1])
    return wa

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 ==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2== 1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
#exec(input().strip()) # DON'T remove this line
# 1640834, 2022-09-24 10:08:07, --PP[PP][PPPP] (67%)

def f1(a,b,c):
    f=[a,b,c]
    for i in f:
        if i <= 0:
            f.remove(i)
    return min(f)

def f2(a, b, c):
    f=[a,b,c]
    for i in f:
        if i >= 0:
            f.remove(i)
    return max(f)
    
def f3(a, b, c):
    pl= a+b+c
    if pl<0:
        pl *= -1
    pl=str(pl)
    wa=int(pl[0])
    return wa
    
def f4(a, b, c):
    pl= a+b+c
    if pl<0:
        pl *= -1
    pl=str(pl)
    wa=int(pl[-1])
    return wa

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 ==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2== 1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1641442, 2022-09-24 10:22:21, P-PP[P-][PPPP] (67%)

def f1(a,b,c):
    f=[a,b,c]
    v=[a,b,c]
    if f[0] <=0:
        v.remove(f[0])
    if f[1] <=0:
        v.remove(f[1])
    if f[2] <=0:
        v.remove(f[2])
    return min(v)

def f2(a, b, c):
    f=[a,b,c]
    v=[a,b,c]
    if f[0] >=0:
        v.remove(f[0])
    if f[1] >=0:
        v.remove(f[1])
    if f[2] >=0:
        v.remove(f[2])
    return min(v)
    
def f3(a, b, c):
    pl= a+b+c
    if pl<0:
        pl *= -1
    pl=str(pl)
    wa=int(pl[0])
    return wa
    
def f4(a, b, c):
    pl= a+b+c
    if pl<0:
        pl *= -1
    pl=str(pl)
    wa=int(pl[-1])
    return wa

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 ==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2== 1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1641480, 2022-09-24 10:23:20, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    f=[a,b,c]
    v=[a,b,c]
    if f[0] <=0:
        v.remove(f[0])
    if f[1] <=0:
        v.remove(f[1])
    if f[2] <=0:
        v.remove(f[2])
    return min(v)

def f2(a, b, c):
    f=[a,b,c]
    v=[a,b,c]
    if f[0] >=0:
        v.remove(f[0])
    if f[1] >=0:
        v.remove(f[1])
    if f[2] >=0:
        v.remove(f[2])
    return max(v)
    
def f3(a, b, c):
    pl= a+b+c
    if pl<0:
        pl *= -1
    pl=str(pl)
    wa=int(pl[0])
    return wa
    
def f4(a, b, c):
    pl= a+b+c
    if pl<0:
        pl *= -1
    pl=str(pl)
    wa=int(pl[-1])
    return wa

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 ==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2== 1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line

6531409921
# 1639766, 2022-09-24 09:38:49, PPx-[--][P-P-] (33%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for i in x:
        if i >0:
            y.append(i)
    return min(y)

def f2(a, b, c):
    x = [a,b,c]
    y = []
    for i in x:
        if i < 0:
            y.append(i)
    return max(y)

def f3(a, b, c):
    g = []
    s = a+b+c
    s = str(s)
    for i in s:
        if i in ['1','2','3','4','5','6','7','8','9']:
            g.append(i)
    d = g[0]
    d = int(d)
    return d

def f4(a, b, c):
    g = []
    s = a+b+c
    s = str(s)
    for i in s:
        if i in ['1','2','3','4','5','6','7','8','9']:
            g.append(i)
        
        
    d = g[-1]
    d = int(d)
    
    return d

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2==1:
        print( f2(a, b, c))
    if s1==1 and s2==0:
        print(f3(a, b, c))
    if s1 == 1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip())   
# 1639829, 2022-09-24 09:40:39, PPx-[PP][PPPP] (67%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for i in x:
        if i >0:
            y.append(i)
    return min(y)

def f2(a, b, c):
    x = [a,b,c]
    y = []
    for i in x:
        if i < 0:
            y.append(i)
    return max(y)

def f3(a, b, c):
    g = []
    s = a+b+c
    s = str(s)
    for i in s:
        if i in ['1','2','3','4','5','6','7','8','9']:
            g.append(i)
    d = g[0]
    d = int(d)
    return d

def f4(a, b, c):
    g = []
    s = a+b+c
    s = str(s)
    for i in s:
        if i in ['1','2','3','4','5','6','7','8','9']:
            g.append(i)
        
        
    d = g[-1]
    d = int(d)
    
    return d

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2==1:
        print( f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1 == 1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip())   

# 1641142, 2022-09-24 10:16:20, PPx-[PP][-P-P] (50%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for i in x:
        if i >0:
            y.append(i)
    return min(y)

def f2(a, b, c):
    x = [a,b,c]
    y = []
    for i in x:
        if i < 0:
            y.append(i)
    return max(y)

def f3(a, b, c):
    g = []
    s = a+b+c
    s = str(s)
    for i in s:
        if i in ['1','2','3','4','5','6','7','8','9']:
            g.append(i)
    d = g[0]
    d = int(d)
    return d

def f4(a, b, c):
    g = []
    s = a+b+c
    s = str(s)
    for i in s:
        if i in ['1','2','3','4','5','6','7','8','9']:
            g.append(i)
        
        
    d = g[-1]
    d = int(d)
    
    return d

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1 == 1 and s2==1:
        print(f4(a, b, c))
    elif s1 != 1 and s2!=1 and s1 != 0 and s2 != 0:
        print("Error")

exec(input().strip())   

# 1641165, 2022-09-24 10:16:48, PPx-[PP][PPPP] (67%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for i in x:
        if i >0:
            y.append(i)
    return min(y)

def f2(a, b, c):
    x = [a,b,c]
    y = []
    for i in x:
        if i < 0:
            y.append(i)
    return max(y)

def f3(a, b, c):
    g = []
    s = a+b+c
    s = str(s)
    for i in s:
        if i in ['1','2','3','4','5','6','7','8','9']:
            g.append(i)
    d = g[0]
    d = int(d)
    return d

def f4(a, b, c):
    g = []
    s = a+b+c
    s = str(s)
    for i in s:
        if i in ['1','2','3','4','5','6','7','8','9']:
            g.append(i)
        
        
    d = g[-1]
    d = int(d)
    
    return d

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1 == 1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip())   

# 1641910, 2022-09-24 10:30:54, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for i in x:
        if i >0:
            y.append(i)
    return min(y)

def f2(a, b, c):
    x = [a,b,c]
    y = []
    for i in x:
        if i < 0:
            y.append(i)
    return max(y)

def f3(a, b, c):
    g = []
    s = a+b+c
    s = str(s)
    for i in s:
        if i in ['1','2','3','4','5','6','7','8','9','0']:
            g.append(i)
    d = g[0]
    d = int(d)
    return d

def f4(a, b, c):
    g = []
    s = a+b+c
    s = str(s)
    for i in s:
        if i in ['1','2','3','4','5','6','7','8','9','0']:
            g.append(i)
        
        
    d = g[-1]
    d = int(d)
    
    return d

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1 == 1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip())   


6530042021
# 1640331, 2022-09-24 09:54:33, PPxP[PP][PPPx] (67%)

def f1(a, b, c):
    t = [a,b,c]
    s = []
    for i in t:
        if i>0 :
            s += [i]
    e = min(s)
    return(e)

def f2(a, b, c):
    t = [a,b,c]
    s = []
    for i in t:
        if i<0 :
            s += [i]
    e = max(s)
    return(e)
    
def f3(a, b, c):
    e = a+b+c
    e = str(e)
    e = e[0]
    e = int(e)
    return(e)

def f4(a, b, c):
    e = a+b+c
    e = str(e)
    e = e[-1]
    e = int(e)
    return(e)

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0 :
        print(f1(a, b, c))
    elif s1==0 and s2==1 :
        print(f2(a, b, c))
    elif s1==1 and s2==0 :
        print(f3(a, b, c))
    elif s1==1 and s2==1 :
        print(f4(a, b, c))
    else :
        print('Error')

exec(input().strip()) # DON'T remove this line

# 1640576, 2022-09-24 10:01:29, PPxP[PP][PPPP] (83%)

def f1(a, b, c):
    t = [a,b,c]
    s = []
    for i in t:
        if i>0 :
            s += [i]
    e = min(s)
    return(e)

def f2(a, b, c):
    t = [a,b,c]
    s = []
    for i in t:
        if i<0 :
            s += [i]
    e = max(s)
    return(e)
    
def f3(a, b, c):
    e = a+b+c
    if e>0 :
        e = str(e)
        e = e[0]
        e = int(e)
    else :
        e = str(e)
        e = e[1]
        e = int(e)
    return(e)

def f4(a, b, c):
    e = a+b+c
    e = str(e)
    e = e[-1]
    e = int(e)
    return(e)

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0 :
        print(f1(a, b, c))
    elif s1==0 and s2==1 :
        print(f2(a, b, c))
    elif s1==1 and s2==0 :
        print(f3(a, b, c))
    elif s1==1 and s2==1 :
        print(f4(a, b, c))
    else :
        print('Error')
    

exec(input().strip()) # DON'T remove this line

    

# 1641085, 2022-09-24 10:15:02, PPxP[PP][PPPP] (83%)

def f1(a, b, c):
    t = [a,b,c]
    s = []
    for i in t:
        if i>0 :
            s += [i]
    e = min(s)
    return(e)

def f2(a, b, c):
    t = [a,b,c]
    s = []
    for i in t:
        if i<0 :
            s += [i]
    e = max(s)
    return(e)
    
def f3(a, b, c):
    e = a+b+c
    if e>0 :
        e = str(e)
        e = e[0]
        e = int(e)
    else :
        e = str(e)
        e = e[1]
        e = int(e)
    return(e)

def f4(a, b, c):
    e = a+b+c
    if e>0 :
        e = str(e)
        e = e[-1]
        e = int(e)
    else :
        e = str(e)
        e = e[-1]
        e = int(e)
    return(e)


def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0 :
        print(f1(a, b, c))
    elif s1==0 and s2==1 :
        print(f2(a, b, c))
    elif s1==1 and s2==0 :
        print(f3(a, b, c))
    elif s1==1 and s2==1 :
        print(f4(a, b, c))
    else :
        print('Error')

exec(input().strip()) # DON'T remove this line

    
# 1641281, 2022-09-24 10:19:11, PPxP[PP][PPPP] (83%)

def f1(a, b, c):
    t = [a,b,c]
    s = []
    for i in t:
        if i>0 :
            s += [i]
    e = min(s)
    return(e)

def f2(a, b, c):
    t = [a,b,c]
    s = []
    for i in t:
        if i<0 :
            s += [i]
    e = max(s)
    return(e)
    
def f3(a, b, c):
    e = a+b+c
    if e>0 :
        e = str(e)
        e = e[0]
        e = int(e)
    else :
        e = str(e)
        e = e[1]
        e = int(e)
    return(e)

def f4(a, b, c):
    e = a+b+c
    e = str(e)
    e = e[-1]
    e = int(e)
    return(e)


def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0 :
        print(f1(a, b, c))
    elif s1==0 and s2==1 :
        print(f2(a, b, c))
    elif s1==1 and s2==0 :
        print(f3(a, b, c))
    elif s1==1 and s2==1 :
        print(f4(a, b, c))
    else :
        print('Error')

exec(input().strip()) # DON'T remove this line

    
# 1641427, 2022-09-24 10:22:03, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    t = [a,b,c]
    s = []
    for i in t:
        if i>0 :
            s += [i]
    e = min(s)
    return(e)

def f2(a, b, c):
    t = [a,b,c]
    s = []
    for i in t:
        if i<0 :
            s += [i]
    e = max(s)
    return(e)
    
def f3(a, b, c):
    e = a+b+c
    if e>0 :
        e = str(e)
        e = e[0]
        e = int(e)
    elif e<0 :
        e = str(e)
        e = e[1]
        e = int(e)
    elif e==0 :
        e = 0
    return(e)

def f4(a, b, c):
    e = a+b+c
    e = str(e)
    e = e[-1]
    e = int(e)
    return(e)


def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0 :
        print(f1(a, b, c))
    elif s1==0 and s2==1 :
        print(f2(a, b, c))
    elif s1==1 and s2==0 :
        print(f3(a, b, c))
    elif s1==1 and s2==1 :
        print(f4(a, b, c))
    else :
        print('Error')

exec(input().strip()) # DON'T remove this line

    
    


6530050021
# 1640094, 2022-09-24 09:48:00, PPxx[xx][xxxx] (33%)

def f1(a, b, c):
    p = []
    if a>0:
        p.append(a)
    if b>0:
        p.append(b)
    if c>0:
        p.append(c)
    x = min(p)
    return x


def f2(a, b, c):
    p = []
    if a<0:
        p.append(a)
    if b<0:
        p.append(b)
    if c<0:
        p.append(c)
    x = max(p)
    return x

def f3(a, b, c):
    x = abs(a+b+c)
    y = x[0]
    return (int(y))

def f4(a, b, c):
    x = a+b+c
    y = x[-1]
    return int(y)

def main():
    r = input().slice()
    s1 = int(r[0])
    s2 = int(r[1])
    a = int(r[2])
    b = int(r[3])
    c = int(r[4])
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
        
exec(input().strip()) # DON'T remove this line
    
    
    
    
    
# 1640176, 2022-09-24 09:50:24, PPPx[xx][xxxx] (50%)

def f1(a, b, c):
    p = []
    if a>0:
        p.append(a)
    if b>0:
        p.append(b)
    if c>0:
        p.append(c)
    x = min(p)
    return x


def f2(a, b, c):
    p = []
    if a<0:
        p.append(a)
    if b<0:
        p.append(b)
    if c<0:
        p.append(c)
    x = max(p)
    return x

def f3(a, b, c):
    x = str(abs(a+b+c))
    y = x[0]
    return (int(y))

def f4(a, b, c):
    x = a+b+c
    y = x[-1]
    return int(y)

def main():
    r = input().slice()
    s1 = int(r[0])
    s2 = int(r[1])
    a = int(r[2])
    b = int(r[3])
    c = int(r[4])
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
        
exec(input().strip()) # DON'T remove this line
    
    
    
    
    
# 1640295, 2022-09-24 09:53:31, PPPP[--][P-P-] (67%)

def f1(a, b, c):
    p = []
    if a>0:
        p.append(a)
    if b>0:
        p.append(b)
    if c>0:
        p.append(c)
    x = min(p)
    return x


def f2(a, b, c):
    p = []
    if a<0:
        p.append(a)
    if b<0:
        p.append(b)
    if c<0:
        p.append(c)
    x = max(p)
    return x

def f3(a, b, c):
    x = str(abs(a+b+c))
    y = x[0]
    return (int(y))

def f4(a, b, c):
    x = str(abs(a+b+c))
    y = x[-1]
    return int(y)

def main():
    r = input().split()
    s1 = int(r[0])
    s2 = int(r[1])
    a = int(r[2])
    b = int(r[3])
    c = int(r[4])
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
        
exec(input().strip()) # DON'T remove this line
    
    
    
    
    
# 1640597, 2022-09-24 10:02:05, PPPP[--][----] (67%)

def f1(a, b, c):
    p = []
    if a>0:
        p.append(a)
    if b>0:
        p.append(b)
    if c>0:
        p.append(c)
    x = min(p)
    return x


def f2(a, b, c):
    p = []
    if a<0:
        p.append(a)
    if b<0:
        p.append(b)
    if c<0:
        p.append(c)
    x = max(p)
    return x

def f3(a, b, c):
    x = str(abs(a+b+c))
    y = x[0]
    return (int(y))

def f4(a, b, c):
    x = str(abs(a+b+c))
    y = x[-1]
    return int(y)

def main():
    r = input().split()
    s1 = int(r[0])
    s2 = int(r[1])
    a = int(r[2])
    b = int(r[3])
    c = int(r[4])
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    else:
        print("Error")
        
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    else:
        print("Error")
        
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    else:
        print("Error")
        
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))  
    else:
        print("Error")
        
exec(input().strip()) # DON'T remove this line
    
    
    
    
    
# 1640640, 2022-09-24 10:03:19, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    p = []
    if a>0:
        p.append(a)
    if b>0:
        p.append(b)
    if c>0:
        p.append(c)
    x = min(p)
    return x


def f2(a, b, c):
    p = []
    if a<0:
        p.append(a)
    if b<0:
        p.append(b)
    if c<0:
        p.append(c)
    x = max(p)
    return x

def f3(a, b, c):
    x = str(abs(a+b+c))
    y = x[0]
    return (int(y))

def f4(a, b, c):
    x = str(abs(a+b+c))
    y = x[-1]
    return int(y)

def main():
    r = input().split()
    s1 = int(r[0])
    s2 = int(r[1])
    a = int(r[2])
    b = int(r[3])
    c = int(r[4])
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    
        
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
        
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
        
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))  
    else:
        print("Error")
        
exec(input().strip()) # DON'T remove this line
    
    
    
    
    

6530056821
# 1639125, 2022-09-24 09:22:37, P-x-[xx][PxPx] (17%)

def f1(a, b, c):
    l = [int(a),int(b),int(c)]
    r = []
    for e in l:
        if e>0:
            r.append(e)
    return int(min(r))
    
def f2(a, b, c):
    l = [int(a),int(b),int(c)]
    r = []
    for e in l:
        if e>0:
            r.append(e)
    return int(max(r))

def f3(a, b, c):
    l = [int(a),int(b),int(c)]
    r = sum(l)
    if l>0:
        return str(l)[0]
    else:
        return str(l)[1]
def f4(a, b, c):
    l = [int(a),int(b),int(c)]
    r = sum(l)
    return str(l)[-1]

def main():
    p = [int(e) for e in input().split()]
    if p[0] == 0 and p[1] == 0:
        print(f1(a,b,c))
    elif p[0] == 0 and p[1] == 1:
        print(f2(a,b,c))
    elif p[0] == 1 and p[1] == 0:
        print(f3(a,b,c))
    elif p[0] == 1 and p[1] == 1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1639219, 2022-09-24 09:24:52, P-x-[xx][PxPx] (17%)

def f1(a, b, c):
    l = [int(a),int(b),int(c)]
    r = []
    for e in l:
        if e>0:
            r.append(e)
    return int(min(r))
    
def f2(a, b, c):
    l = [int(a),int(b),int(c)]
    r = []
    for e in l:
        if e>0:
            r.append(e)
    return int(max(r))

def f3(a, b, c):
    l = [int(a),int(b),int(c)]
    r = sum(l)
    if r>0:
        return str(r)[0]
    else:
        return str(r)[1]
def f4(a, b, c):
    l = [int(a),int(b),int(c)]
    r = sum(l)
    return str(r)[-1]

def main():
    p = [int(e) for e in input().split()]
    if p[0] == 0 and p[1] == 0:
        print(f1(a,b,c))
    elif p[0] == 0 and p[1] == 1:
        print(f2(a,b,c))
    elif p[0] == 1 and p[1] == 0:
        print(f3(a,b,c))
    elif p[0] == 1 and p[1] == 1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1639314, 2022-09-24 09:27:18, PPx-[PP][PPPP] (67%)

def f1(a, b, c):
    l = [int(a),int(b),int(c)]
    r = []
    for e in l:
        if e>0:
            r.append(e)
    return int(min(r))
    
def f2(a, b, c):
    l = [int(a),int(b),int(c)]
    r = []
    for e in l:
        if e<0:
            r.append(e)
    return int(max(r))

def f3(a, b, c):
    l = [int(a),int(b),int(c)]
    r = sum(l)
    if r>0:
        return str(r)[0]
    else:
        return str(r)[1]
def f4(a, b, c):
    l = [int(a),int(b),int(c)]
    r = sum(l)
    return str(r)[-1]

def main():
    p = [int(e) for e in input().split()]
    if p[0] == 0 and p[1] == 0:
        print(f1(p[2],p[3],p[4]))
    elif p[0] == 0 and p[1] == 1:
        print(f2(p[2],p[3],p[4]))
    elif p[0] == 1 and p[1] == 0:
        print(f3(p[2],p[3],p[4]))
    elif p[0] == 1 and p[1] == 1:
        print(f4(p[2],p[3],p[4]))
    else:
        print('Error')
        
exec(input().strip()) # DON'T remove this line
# 1641619, 2022-09-24 10:25:48, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    l = [int(a),int(b),int(c)]
    r = []
    for e in l:
        if e>0:
            r.append(e)
    return int(min(r))
    
def f2(a, b, c):
    l = [int(a),int(b),int(c)]
    r = []
    for e in l:
        if e<0:
            r.append(e)
    return int(max(r))

def f3(a, b, c):
    l = [int(a),int(b),int(c)]
    r = sum(l)
    if r>=0:
        return str(r)[0]
    else:
        return str(r)[1]
def f4(a, b, c):
    l = [int(a),int(b),int(c)]
    r = sum(l)
    return str(r)[-1]

def main():
    p = [int(e) for e in input().split()]
    if p[0] == 0 and p[1] == 0:
        print(f1(p[2],p[3],p[4]))
    elif p[0] == 0 and p[1] == 1:
        print(f2(p[2],p[3],p[4]))
    elif p[0] == 1 and p[1] == 0:
        print(f3(p[2],p[3],p[4]))
    elif p[0] == 1 and p[1] == 1:
        print(f4(p[2],p[3],p[4]))
    else:
        print('Error')
        
exec(input().strip()) # DON'T remove this line
# 1641692, 2022-09-24 10:27:07, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    l = [int(a),int(b),int(c)]
    r = []
    for e in l:
        if e>0:
            r.append(e)
    return int(min(r))
    
def f2(a, b, c):
    l = [int(a),int(b),int(c)]
    r = []
    for e in l:
        if e<0:
            r.append(e)
    return int(max(r))

def f3(a, b, c):
    l = [int(a),int(b),int(c)]
    r = sum(l)
    if r>=0:
        return int(str(r)[0])
    else:
        return int(str(r)[1])
def f4(a, b, c):
    l = [int(a),int(b),int(c)]
    r = sum(l)
    return int(str(r)[-1])

def main():
    p = [int(e) for e in input().split()]
    if p[0] == 0 and p[1] == 0:
        print(f1(p[2],p[3],p[4]))
    elif p[0] == 0 and p[1] == 1:
        print(f2(p[2],p[3],p[4]))
    elif p[0] == 1 and p[1] == 0:
        print(f3(p[2],p[3],p[4]))
    elif p[0] == 1 and p[1] == 1:
        print(f4(p[2],p[3],p[4]))
    else:
        print('Error')
        
exec(input().strip()) # DON'T remove this line

6530078621
# 1639507, 2022-09-24 09:31:59, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    s=[]
    if a>0:
        s.append(a)
    if b>0:
        s.append(b)
    if c>0:
        s.append(c)
    return min(s)
    
    
def f2(a, b, c):
    s=[]
    if a<0:
        s.append(a)
    if b<0:
        s.append(b)
    if c<0:
        s.append(c)
    return max(s)
    
    
def f3(a, b, c):
    s=abs(a+b+c)
    return str(s)[0]
    
def f4(a, b, c):
    s=abs(a+b+c)
    return str(s)[-1]
    
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0:
        print (f1(a, b, c))
    elif s1==0 and s2==1:
        print (f2(a, b, c))
    elif s1==1 and s2==0:
        print (f3(a, b, c))
    elif s1==1 and s2==1:
        print (f4(a, b, c))
    else:
        print ('Error')
    
exec(input().strip())

# 1641375, 2022-09-24 10:20:58, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    s=[]
    if a>0:
        s.append(a)
    if b>0:
        s.append(b)
    if c>0:
        s.append(c)
    return min(s)
    
    
def f2(a, b, c):
    s=[]
    if a<0:
        s.append(a)
    if b<0:
        s.append(b)
    if c<0:
        s.append(c)
    return max(s)
    
    
def f3(a, b, c):
    s=abs(a+b+c)
    return str(s)[0]
    
def f4(a, b, c):
    s=abs(a+b+c)
    return str(s)[-1]
    
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0:
        print (f1(a, b, c))
    elif s1==0 and s2==1:
        print (f2(a, b, c))
    elif s1==1 and s2==0:
        print (f3(a, b, c))
    elif s1==1 and s2==1:
        print (f4(a, b, c))
    else:
        print ('Error')
    
exec(input().strip())
# 1641586, 2022-09-24 10:25:17, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    s=[]
    if a>0:
        s.append(a)
    if b>0:
        s.append(b)
    if c>0:
        s.append(c)
    return min(s)
    
    
def f2(a, b, c):
    s=[]
    if a<0:
        s.append(a)
    if b<0:
        s.append(b)
    if c<0:
        s.append(c)
    return max(s)
    
    
def f3(a, b, c):
    s=abs(a+b+c)
    return str(s)[0]
    
def f4(a, b, c):
    s=abs(a+b+c)
    return str(s)[-1]
    
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0:
        print (f1(a, b, c))
    elif s1==0 and s2==1:
        print (f2(a, b, c))
    elif s1==1 and s2==0:
        print (f3(a, b, c))
    elif s1==1 and s2==1:
        print (f4(a, b, c))
    else:
        print ('Error')
    
exec(input() .strip())
# 1641939, 2022-09-24 10:31:29, PPxx[PP][PxPx] (50%)

def f1(a, b, c):
    s=[]
    if a>0:
        s.append(a)
    if b>0:
        s.append(b)
    if c>0:
        s.append(c)
    return min(s)
    
    
def f2(a, b, c):
    s=[]
    if a<0:
        s.append(a)
    if b<0:
        s.append(b)
    if c<0:
        s.append(c)
    return max(s)
    
    
def f3(a, b, c):
    s=abs(a+b+c)
    return int(s)[0]
    
def f4(a, b, c):
    s=abs(a+b+c)
    return int(s)[-1]
    
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0:
        print (f1(a, b, c))
    elif s1==0 and s2==1:
        print (f2(a, b, c))
    elif s1==1 and s2==0:
        print (f3(a, b, c))
    elif s1==1 and s2==1:
        print (f4(a, b, c))
    else:
        print ('Error')
    
exec(input() .strip())
# 1641965, 2022-09-24 10:31:56, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    s=[]
    if a>0:
        s.append(a)
    if b>0:
        s.append(b)
    if c>0:
        s.append(c)
    return min(s)
    
    
def f2(a, b, c):
    s=[]
    if a<0:
        s.append(a)
    if b<0:
        s.append(b)
    if c<0:
        s.append(c)
    return max(s)
    
    
def f3(a, b, c):
    s=abs(a+b+c)
    return int(str(s)[0])
    
def f4(a, b, c):
    s=abs(a+b+c)
    return int(str(s)[-1])
    
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0:
        print (f1(a, b, c))
    elif s1==0 and s2==1:
        print (f2(a, b, c))
    elif s1==1 and s2==0:
        print (f3(a, b, c))
    elif s1==1 and s2==1:
        print (f4(a, b, c))
    else:
        print ('Error')
    
exec(input() .strip())

6530082021
# 1639603, 2022-09-24 09:34:30, ----[--][----] (0%)

def f1(a, b, c):
    min_plus = 1000
    if min_plus > a and a > 0:
        min_plus = a
    if min_plus > b and b > 0:
        min_plus = b
    if min_plus > c and c > 0:
        min_plus = c
    return min_plus

def f2(a, b, c):
    max_minus = -1000
    if max_minus < a and a < 0:
        max_minus = a
    if max_minus < b and b < 0:
        max_minus = b
    if max_minus < c and c < 0:
        max_minus = c
    return max_minus

def f3(a, b, c):
    x = abs(a + b + c)
    y = str(x)
    left = y[0]
    return left

def f4(a, b, c):
    x = abs(a + b + c)
    y = str(x)
    right = y[-1]
    return right

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
# 1639656, 2022-09-24 09:35:55, PP--[--][P-P-] (33%)

def f1(a, b, c):
    min_plus = 1000
    if min_plus > a and a > 0:
        min_plus = a
    if min_plus > b and b > 0:
        min_plus = b
    if min_plus > c and c > 0:
        min_plus = c
    return min_plus

def f2(a, b, c):
    max_minus = -1000
    if max_minus < a and a < 0:
        max_minus = a
    if max_minus < b and b < 0:
        max_minus = b
    if max_minus < c and c < 0:
        max_minus = c
    return max_minus

def f3(a, b, c):
    x = abs(a + b + c)
    y = str(x)
    left = y[0]
    return left

def f4(a, b, c):
    x = abs(a + b + c)
    y = str(x)
    right = y[-1]
    return right

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')

exec(input().strip()) 
# 1639756, 2022-09-24 09:38:37, PPPP[--][P-P-] (67%)

def f1(a, b, c):
    min_plus = 1000
    if min_plus > a and a > 0:
        min_plus = a
    if min_plus > b and b > 0:
        min_plus = b
    if min_plus > c and c > 0:
        min_plus = c
    return min_plus

def f2(a, b, c):
    max_minus = -1000
    if max_minus < a and a < 0:
        max_minus = a
    if max_minus < b and b < 0:
        max_minus = b
    if max_minus < c and c < 0:
        max_minus = c
    return max_minus

def f3(a, b, c):
    x = abs(a + b + c)
    y = str(x)
    left = int(y[0])
    return left

def f4(a, b, c):
    x = abs(a + b + c)
    y = str(x)
    right = int(y[-1])
    return right

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')

exec(input().strip())        

# 1639863, 2022-09-24 09:41:20, PPPP[--][P-P-] (67%)

def f1(a, b, c):
    min_plus = 1000
    if min_plus > a and a > 0:
        min_plus = int(a)
    if min_plus > b and b > 0:
        min_plus = int(b)
    if min_plus > c and c > 0:
        min_plus = int(c)
    return min_plus

def f2(a, b, c):
    max_minus = -1000
    if max_minus < a and a < 0:
        max_minus = int(a)
    if max_minus < b and b < 0:
        max_minus = int(b)
    if max_minus < c and c < 0:
        max_minus = int(c)
    return max_minus

def f3(a, b, c):
    x = abs(a + b + c)
    y = str(x)
    left = int(y[0])
    return left

def f4(a, b, c):
    x = abs(a + b + c)
    y = str(x)
    right = int(y[-1])
    return right

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')

exec(input().strip())        

# 1640303, 2022-09-24 09:53:40, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    min_plus = 1000
    if min_plus > a and a > 0:
        min_plus = int(a)
    if min_plus > b and b > 0:
        min_plus = int(b)
    if min_plus > c and c > 0:
        min_plus = int(c)
    return min_plus

def f2(a, b, c):
    max_minus = -1000
    if max_minus < a and a < 0:
        max_minus = int(a)
    if max_minus < b and b < 0:
        max_minus = int(b)
    if max_minus < c and c < 0:
        max_minus = int(c)
    return max_minus

def f3(a, b, c):
    x = abs(a + b + c)
    y = str(x)
    left = int(y[0])
    return left

def f4(a, b, c):
    x = abs(a + b + c)
    y = str(x)
    right = int(y[-1])
    return right

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')

exec(input().strip())


6531306921
# 1639225, 2022-09-24 09:25:00, ----[PP][PPPP] (33%)

def f1(a,b,c):
  x=[a,b,c]
  for i in x:
    if i<0:
      x.remove(i)
  x.sort()
  return x[0]

def f2(a,b,c):
  x=[a,b,c]
  for i in x:
    if i>=0:
      x.remove(i)
  x.sort()
  return x[-1]

def f3(a,b,c):
  x=str(abs(a+b+c))
  return x[0]

def f4(a,b,c):
  x=str(abs(a+b+c))
  return x[-1]

def main():
  s1,s2,a,b,c=[int(e) for e in input().split()]
  if s1==0 and s2==0:
    print(f1(a,b,c))
  elif s1==0 and s2==1:
    print(f2(a,b,c))
  elif s1==1 and s2==0:
    print(f3(a,b,c))
  elif s1==1 and s2==1:
    print(f4(a,b,c))
  else:
    print('Error')
exec(input().strip())
# 1639297, 2022-09-24 09:26:51, --PP[PP][PPPP] (67%)

def f1(a,b,c):
  x=[a,b,c]
  for i in x:
    if i<0:
      x.remove(i)
  x.sort()
  return int(x[0])

def f2(a,b,c):
  x=[a,b,c]
  for i in x:
    if i>=0:
      x.remove(i)
  x.sort()
  return int(x[-1])

def f3(a,b,c):
  x=str(abs(a+b+c))
  return int(x[0])

def f4(a,b,c):
  x=str(abs(a+b+c))
  return int(x[-1])

def main():
  s1,s2,a,b,c=[int(e) for e in input().split()]
  if s1==0 and s2==0:
    print(f1(a,b,c))
  elif s1==0 and s2==1:
    print(f2(a,b,c))
  elif s1==1 and s2==0:
    print(f3(a,b,c))
  elif s1==1 and s2==1:
    print(f4(a,b,c))
  else:
    print('Error')
exec(input().strip())
# 1639500, 2022-09-24 09:31:43, P-PP[P-][PPPP] (67%)

def f1(a,b,c):
  x=[a,b,c]
  y=[]
  for i in x:
    if i>0:
      y.append(i)
  y.sort()
  return int(y[0])

def f2(a,b,c):
  x=[a,b,c]
  y=[]
  for i in x:
    if i<0:
      y.append(i)
  y.sort()
  return int(x[-1])

def f3(a,b,c):
  x=str(abs(a+b+c))
  return int(x[0])

def f4(a,b,c):
  x=str(abs(a+b+c))
  return int(x[-1])

def main():
  s1,s2,a,b,c=[int(e) for e in input().split()]
  if s1==0 and s2==0:
    print(f1(a,b,c))
  elif s1==0 and s2==1:
    print(f2(a,b,c))
  elif s1==1 and s2==0:
    print(f3(a,b,c))
  elif s1==1 and s2==1:
    print(f4(a,b,c))
  else:
    print('Error')
exec(input().strip())
# 1639549, 2022-09-24 09:33:05, --PP[PP][PPPP] (67%)

def f1(a,b,c):
  x=[a,b,c]
  
  for i in x:
    if i<=0:
      x.remove(i)
  x.sort()
  return int(x[0])

def f2(a,b,c):
  x=[a,b,c]
  
  for i in x:
    if i>=0:
      x.remove(i)
  x.sort()
  return int(x[-1])

def f3(a,b,c):
  x=str(abs(a+b+c))
  return int(x[0])

def f4(a,b,c):
  x=str(abs(a+b+c))
  return int(x[-1])

def main():
  s1,s2,a,b,c=[int(e) for e in input().split()]
  if s1==0 and s2==0:
    print(f1(a,b,c))
  elif s1==0 and s2==1:
    print(f2(a,b,c))
  elif s1==1 and s2==0:
    print(f3(a,b,c))
  elif s1==1 and s2==1:
    print(f4(a,b,c))
  else:
    print('Error')
exec(input().strip())
# 1639645, 2022-09-24 09:35:35, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
  x=[a,b,c]
  y=[]
  for i in x:
    if i>0:
      y.append(i)
  y.sort()
  return int(y[0])

def f2(a,b,c):
  x=[a,b,c]
  y=[]
  for i in x:
    if i<0:
      y.append(i)
  y.sort()
  return int(y[-1])

def f3(a,b,c):
  x=str(abs(a+b+c))
  return int(x[0])

def f4(a,b,c):
  x=str(abs(a+b+c))
  return int(x[-1])

def main():
  s1,s2,a,b,c=[int(e) for e in input().split()]
  if s1==0 and s2==0:
    print(f1(a,b,c))
  elif s1==0 and s2==1:
    print(f2(a,b,c))
  elif s1==1 and s2==0:
    print(f3(a,b,c))
  elif s1==1 and s2==1:
    print(f4(a,b,c))
  else:
    print('Error')
exec(input().strip())

6531318421
# 1638953, 2022-09-24 09:18:49, PP-P[PP][PPPP] (83%)

def f1(a, b, c):
    l = [a, b, c]
    return min([x for x in l if x > 0])


def f2(a, b, c):
    l = [a, b, c]
    return max([x for x in l if x < 0])


def f3(a, b, c):
    return str(a+b+c)[1] if str(a+b+c)[0] == '-' else str(a+b+c)[0]


def f4(a, b, c):
    return abs((a+b+c)) % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')


exec(input().strip())  # DON'T remove this line

# 1641039, 2022-09-24 10:13:28, PP-P[--][P-P-] (50%)

def f1(a, b, c):
    l = [a, b, c]
    return min([x for x in l if x > 0])


def f2(a, b, c):
    l = [a, b, c]
    return max([x for x in l if x < 0])


def f3(a, b, c):
    return str(a+b+c)[1] if str(a+b+c)[0] == '-' else str(a+b+c)[0]


def f4(a, b, c):
    return abs((a+b+c)) % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')


exec(input().strip())  # DON'T remove this line

# 1641060, 2022-09-24 10:14:03, PP-P[PP][PPPP] (83%)

def f1(a, b, c):
    l = [a, b, c]
    return min([x for x in l if x > 0])


def f2(a, b, c):
    l = [a, b, c]
    return max([x for x in l if x < 0])


def f3(a, b, c):
    return str(a+b+c)[1] if str(a+b+c)[0] == '-' else str(a+b+c)[0]


def f4(a, b, c):
    return abs((a+b+c)) % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')


exec(input().strip())  # DON'T remove this line

# 1641926, 2022-09-24 10:31:07, PP-P[PP][PPPP] (83%)

def f1(a, b, c):
    l = [a, b, c]
    return min([x for x in l if x > 0])


def f2(a, b, c):
    l = [a, b, c]
    return max([x for x in l if x < 0])


def f3(a, b, c):
    return str(abs(a+b+c))[0]


def f4(a, b, c):
    return abs((a+b+c)) % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')


exec(input().strip())  # DON'T remove this line

# 1642153, 2022-09-24 10:35:15, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    l = [a, b, c]
    return min([x for x in l if x > 0])


def f2(a, b, c):
    l = [a, b, c]
    return max([x for x in l if x < 0])


def f3(a, b, c):
    return int(str(abs(a+b+c))[0])


def f4(a, b, c):
    return abs((a+b+c)) % 10


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')


exec(input().strip())  # DON'T remove this line


6531321221
# 1639071, 2022-09-24 09:21:32, ----[--][----] (0%)

def f1(a, b, c):
    d = [a, b, c]
    e = []
    for i in range(3):
        if d[i] > 0:
            e.append(d[i])
    return min(e)


def f2(a, b, c):
    d = [a, b, c]
    e = []
    for i in range(3):
        if d[i] < 0:
            e.append(d[i])
    return max(e)


def f3(a, b, c):
    d = a + b + c
    d = abs(d)
    return d[0]


def f4(a, b, c):
    d = a + b + c
    d = abs(d)
    return d[-1]


def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


print(f2(-20, -18, 4))

# 1639076, 2022-09-24 09:21:36, ----[--][----] (0%)

def f1(a, b, c):
    d = [a, b, c]
    e = []
    for i in range(3):
        if d[i] > 0:
            e.append(d[i])
    return min(e)


def f2(a, b, c):
    d = [a, b, c]
    e = []
    for i in range(3):
        if d[i] < 0:
            e.append(d[i])
    return max(e)


def f3(a, b, c):
    d = a + b + c
    d = abs(d)
    return d[0]


def f4(a, b, c):
    d = a + b + c
    d = abs(d)
    return d[-1]


def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")



# 1639091, 2022-09-24 09:21:54, PPxx[PP][PxPx] (50%)

def f1(a, b, c):
    d = [a, b, c]
    e = []
    for i in range(3):
        if d[i] > 0:
            e.append(d[i])
    return min(e)


def f2(a, b, c):
    d = [a, b, c]
    e = []
    for i in range(3):
        if d[i] < 0:
            e.append(d[i])
    return max(e)


def f3(a, b, c):
    d = a + b + c
    d = abs(d)
    return d[0]


def f4(a, b, c):
    d = a + b + c
    d = abs(d)
    return d[-1]


def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
        
exec(input().strip())
# 1639141, 2022-09-24 09:23:07, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    d = [a, b, c]
    e = []
    for i in range(3):
        if d[i] > 0:
            e.append(d[i])
    return min(e)


def f2(a, b, c):
    d = [a, b, c]
    e = []
    for i in range(3):
        if d[i] < 0:
            e.append(d[i])
    return max(e)


def f3(a, b, c):
    d = a + b + c
    d = abs(d)
    return str(d)[0]


def f4(a, b, c):
    d = a + b + c
    d = abs(d)
    return str(d)[-1]


def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())

# 1639214, 2022-09-24 09:24:44, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    d = [a, b, c]
    e = []
    for i in range(3):
        if d[i] > 0:
            e.append(d[i])
    return min(e)


def f2(a, b, c):
    d = [a, b, c]
    e = []
    for i in range(3):
        if d[i] < 0:
            e.append(d[i])
    return max(e)


def f3(a, b, c):
    d = a + b + c
    d = abs(d)
    return int(str(d)[0])


def f4(a, b, c):
    d = a + b + c
    d = abs(d)
    return int(str(d)[-1])


def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())

6531324121
# 1638878, 2022-09-24 09:17:13, --x-[PP][PPPx] (17%)

def f1(a, b, c):
    min = a

    for n in [a,b,c]:
        if n <= a and n > 0:
            min = n

    return min

def f2(a, b, c):
    max = a

    for n in [a,b,c]:
        if n >= a and n < 0:
            max = n

    return max

def f3(a, b, c):

    r = a + b + c
    r = str(r)
    res = int(r[0])

    return res

def f4(a, b, c):
    return (a + b + c)%10

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
     
    if s1 == 0 and s2 == 0:
       print(f1(a,b,c))
    
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))

    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))

    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    
    else:
        print("Error")

exec(input().strip())
# 1639026, 2022-09-24 09:20:32, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    min = a

    for n in [a,b,c]:
        if n <= a and n > 0:
            min = n

    return min

def f2(a, b, c):
    max = a

    for n in [a,b,c]:
        if n >= a and n < 0:
            max = n

    return max

def f3(a, b, c):

    r = a + b + c
    r = str(r)

    if int(r) < 0:
        res = int(r[1])
    else:
        res = int(r[0])

    return res

def f4(a, b, c):
    r = a+b+c
    if r < 0:
        r = -r
    return (r)%10

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
     
    if s1 == 0 and s2 == 0:
       print(f1(a,b,c))
    
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))

    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))

    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    
    else:
        print("Error")



exec(input().strip())
# 1639896, 2022-09-24 09:42:18, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    min = a
    if min == 0:
        min = b
    for n in [a,b,c]:
        if n <= a and n > 0:
            min = n

    return min

def f2(a, b, c):
    max = a

    for n in [a,b,c]:
        if n >= a and n < 0:
            max = n

    return max

def f3(a, b, c):

    r = a + b + c
    r = str(r)

    if int(r) < 0:
        res = int(r[1])
    else:
        res = int(r[0])

    return res

def f4(a, b, c):
    r = a+b+c
    if r < 0:
        r = -r
    return (r)%10

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
     
    if s1 == 0 and s2 == 0:
       print(f1(a,b,c))
    
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))

    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))

    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    
    else:
        print("Error")



exec(input().strip())
# 1639973, 2022-09-24 09:44:20, P-PP[PP][PPPP] (83%)

def f1(a, b, c):
    res = [x for x in [a,b,c] if x > 0]
    min = res[0]

    for i in range(len(res)):
        if res[i] <= res[0]:
            min = res[i]

    return min

def f2(a, b, c):
    max = a

    for n in [a,b,c]:
        if n >= a and n < 0:
            max = n

    return max

def f3(a, b, c):

    r = a + b + c
    r = str(r)

    if int(r) < 0:
        res = int(r[1])
    else:
        res = int(r[0])

    return res

def f4(a, b, c):
    r = a+b+c
    if r < 0:
        r = -r
    return (r)%10

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
     
    if s1 == 0 and s2 == 0:
       print(f1(a,b,c))
    
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))

    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))

    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    
    else:
        print("Error")



exec(input().strip())
# 1639994, 2022-09-24 09:45:01, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    res = [x for x in [a,b,c] if x > 0]
    min = res[0]

    for i in range(len(res)):
        if res[i] <= res[0]:
            min = res[i]

    return min

def f2(a, b, c):
    res = [x for x in [a,b,c] if x < 0]
    max = res[0]

    for i in range(len(res)):
        if res[i] >= res[0]:
            max = res[i]

    return max

def f3(a, b, c):

    r = a + b + c
    r = str(r)

    if int(r) < 0:
        res = int(r[1])
    else:
        res = int(r[0])

    return res

def f4(a, b, c):
    r = a+b+c
    if r < 0:
        r = -r
    return (r)%10

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
     
    if s1 == 0 and s2 == 0:
       print(f1(a,b,c))
    
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))

    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))

    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    
    else:
        print("Error")



exec(input().strip())

6531345321
# 1639242, 2022-09-24 09:25:33, PP-P[PP][PPPP] (83%)

def f1(a, b, c):
    min = 10000
    x = [a,b,c]
    x.sort()
    for e in x :
        if e > 0 :
            return e
 
def f2(a, b, c):
    min = 10000
    x = [a,b,c]
    x.sort(reverse=True)
    for e in x :
        if e < 0 :
            return e
    
def f3(a, b, c):
    sum = a + b + c 
    sum = abs(sum)
    st = str(sum)
    return st[0]
 
def f4(a, b, c):
    sum = a + b + c 
    sum = abs(sum)
    return sum%10
 
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1== 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 ==1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print("Error")
exec(input().strip()) # DON'T remove this line
# 1640603, 2022-09-24 10:02:13, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x = [a,b,c]
    x.sort()
    for e in x :
        if e > 0 :
            return e
 
def f2(a, b, c):
    x = [a,b,c]
    x.sort(reverse=True)
    for e in x :
        if e < 0 :
            return e
    
def f3(a, b, c):
    sum = a + b + c 
    sum = abs(sum)
    st = str(sum)
    return st[0]
 
def f4(a, b, c):
    sum = a + b + c 
    sum = abs(sum)
    return sum%10 +1
 
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1== 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 ==1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print("Error")
exec(input().strip()) # DON'T remove this line
# 1640671, 2022-09-24 10:04:05, PP-P[PP][PPPP] (83%)

def f1(a, b, c):
    x = [a,b,c]
    x.sort()
    for e in x :
        if e > 0 :
            return e
 
def f2(a, b, c):
    x = [a,b,c]
    x.sort(reverse=True)
    for e in x :
        if e < 0 :
            return e
    
def f3(a, b, c):
    sum = a + b + c 
    sum = abs(sum)
    st = str(sum)
    return st[0]
 
def f4(a, b, c):
    sum = a + b + c 
    sum = abs(sum)
    return abs(sum%10) 
 
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1== 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 ==1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print("Error")
exec(input().strip()) # DON'T remove this line
# 1640696, 2022-09-24 10:04:45, PP-P[PP][P-P-] (67%)

def f1(a, b, c):
    x = [a,b,c]
    x.sort()
    for e in x :
        if e > 0 :
            return e
 
def f2(a, b, c):
    x = [a,b,c]
    x.sort(reverse=True)
    for e in x :
        if e < 0 :
            return e
    
def f3(a, b, c):
    sum = a + b + c 
    sum = abs(sum)
    st = str(sum)
    return st[0] +'1'
 
def f4(a, b, c):
    sum = a + b + c 
    sum = abs(sum)
    return abs(sum%10) 
 
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1== 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 ==1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print("Error")
exec(input().strip()) # DON'T remove this line
# 1640776, 2022-09-24 10:06:39, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    x = [a,b,c]
    x.sort()
    for e in x :
        if e > 0 :
            return e
 
def f2(a, b, c):
    x = [a,b,c]
    x.sort(reverse=True)
    for e in x :
        if e < 0 :
            return e
    
def f3(a, b, c):
    sum = a + b + c 
    sum = abs(sum)
    st = str(sum)
    return int(st[0]) 
 
def f4(a, b, c):
    sum = a + b + c 
    sum = abs(sum)
    return abs(sum%10) 
 
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1== 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 ==1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print("Error")
exec(input().strip()) # DON'T remove this line

6230089221
# 1639268, 2022-09-24 09:25:59, ----[--][----] (0%)

def f1(a, b, c):
    s=[]
    l=[]
    s.append(int(a))
    s.append(int(b))
    s.append(int(c))
    for e in s:
        if e>0:
            l.append(e)
    return min(l)
def f2(a, b, c):
    s=[]
    l=[]
    s.append(int(a))
    s.append(int(b))
    s.append(int(c))
    for e in s:
        if e<0:
            l.append(e)
    return max(l)
def f3(a, b, c):
    z=int(a)+int(b)+int(c)
    z=abs(z)
    z=str(z)[0]
    return z
def f4(a, b, c):
    z=int(a)+int(b)+int(c)
    z=abs(z)
    z=str(z)[-1]
    return z
# 1639454, 2022-09-24 09:30:49, PP--[-P][P-P-] (33%)

def f1(a, b, c):
    s=[]
    l=[]
    s.append(int(a))
    s.append(int(b))
    s.append(int(c))
    for e in s:
        if e>0:
            l.append(e)
    return min(l)
def f2(a, b, c):
    s=[]
    l=[]
    s.append(int(a))
    s.append(int(b))
    s.append(int(c))
    for e in s:
        if e<0:
            l.append(e)
    return max(l)
def f3(a, b, c):
    z=int(a)+int(b)+int(c)
    z=abs(z)
    z=str(z)[0]
    return z
def f4(a, b, c):
    z=int(a)+int(b)+int(c)
    z=abs(z)
    z=str(z)[-1]
    return z
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    if s1==0 and s2==1:
        print(f2(a, b, c))
    if s1==1 and s2==0:
        print(f3(a, b, c))
    if s1==1 and s2==1:
        print(f4(a, b, c))
    if s1 not in [0,1] or s2 not in [1,2]:
        print("Error")
exec(input().strip()) # DON'T remove this line
# 1639509, 2022-09-24 09:32:03, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    s=[]
    l=[]
    s.append(int(a))
    s.append(int(b))
    s.append(int(c))
    for e in s:
        if e>0:
            l.append(e)
    return min(l)
def f2(a, b, c):
    s=[]
    l=[]
    s.append(int(a))
    s.append(int(b))
    s.append(int(c))
    for e in s:
        if e<0:
            l.append(e)
    return max(l)
def f3(a, b, c):
    z=int(a)+int(b)+int(c)
    z=abs(z)
    z=str(z)[0]
    return z
def f4(a, b, c):
    z=int(a)+int(b)+int(c)
    z=abs(z)
    z=str(z)[-1]
    return z
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line
# 1639582, 2022-09-24 09:33:54, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    s=[]
    l=[]
    s.append(int(a))
    s.append(int(b))
    s.append(int(c))
    for e in s:
        if e>0:
            l.append(e)
    return min(l)
def f2(a, b, c):
    s=[]
    l=[]
    s.append(int(a))
    s.append(int(b))
    s.append(int(c))
    for e in s:
        if e<0:
            l.append(e)
    return max(l)
def f3(a, b, c):
    z=int(a)+int(b)+int(c)
    z=abs(z)
    z=str(z)[0]
    z=int(z)
    return z
def f4(a, b, c):
    z=int(a)+int(b)+int(c)
    z=abs(z)
    z=str(z)[-1]
    z=int(z)
    return z
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

6230141121
# 1639760, 2022-09-24 09:38:41, PP--[--][P-P-] (33%)

def f1(a,b,c) :
    e = [a,b,c]
    d = []
    for i in e :
        if i > 0 :
            d.append(i)
    return min(d)
def f2(a,b,c) :
    e = [a,b,c]
    d = []
    for i in e :
        if i < 0 :
            d.append(i)
    return max(d)
def f3(a,b,c) :
    s = a+b+c
    s = str(abs(s))
    return s[0]
def f4(a,b,c) :
    s = a+b+c
    s = str(abs(s))
    return s[-1]
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
exec(input().strip())
# 1639887, 2022-09-24 09:41:50, PP--[PP][PPPP] (67%)

def f1(a,b,c) :
    e = [a,b,c]
    d = []
    for i in e :
        if i > 0 :
            d.append(i)
    return min(d)
def f2(a,b,c) :
    e = [a,b,c]
    d = []
    for i in e :
        if i < 0 :
            d.append(i)
    return max(d)
def f3(a,b,c) :
    s = a+b+c
    s = str(abs(s))
    return s[0]
def f4(a,b,c) :
    s = a+b+c
    s = str(abs(s))
    return s[-1]
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
exec(input().strip())
# 1640244, 2022-09-24 09:52:00, PP--[PP][PPPP] (67%)

def f1(a,b,c) :
    e = [a,b,c]
    d = []
    for i in e :
        if i > 0 :
            d.append(i)
    return min(d)
def f2(a,b,c) :
    e = [a,b,c]
    d = []
    for i in e :
        if i < 0 :
            d.append(i)
    return max(d)
def f3(a,b,c) :
    s = a+b+c
    s = str(abs(s))
    return s[0]
def f4(a,b,c) :
    s = a+b+c
    s = str(s)
    return s[-1]
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
exec(input().strip())
# 1641554, 2022-09-24 10:24:39, PPPP[PP][PPPP] (100%)

def f1(a,b,c) :
    e = [a,b,c]
    d = []
    for i in e :
        if i > 0 :
            d.append(i)
    return min(d)
def f2(a,b,c) :
    e = [a,b,c]
    d = []
    for i in e :
        if i < 0 :
            d.append(i)
    return max(d)
def f3(a,b,c) :
    s = a+b+c
    s = str(abs(s))
    return int(s[0])
def f4(a,b,c) :
    s = a+b+c
    s = str(abs(s))
    return int(s[-1])
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
exec(input().strip())

6231110921
# 1639449, 2022-09-24 09:30:39, xPPP[x-][PPPP] (67%)

def f1(a, b, c):
    f1=[]
    if a>0:
        f+=[a]
    if b>0:
        f+=[b]
    if c>0:
        f+=[c]
    f1.sort()
    return int(f1[0])

def f2(a, b, c):
    f2=[]
    if a<0:
        f2+=[a]
    if b<0:
        f2+=[b]
    if c<0:
        f2+=[c]
    f2.sort()
    return int(f2[-1])
        
def f3(a, b, c):
    summ = a+b+c
    summ = abs(summ)
    summ = list(str(summ))
    return int(summ[0])
def f4(a, b, c):
    summ = a+b+c
    summ = abs(summ)
    summ = list(str(summ))
    return int(summ[-1])
def main():
    x = input().split(' ')
    s1 = x[0]
    s2 = x[1]
    a = int(x[2])
    b = int(x[3])
    c = int(x[4])
    if s1 == '0' and s2 == '0':
        print(f1(a,b,c))
    if s1 == '0' and s1 == '1':
        print(f2(a,b,c))
    if s1 == '1' and s2 == '0':
        print(f3(a,b,c))
    if s1 == '1' and s2 == '1':
        print(f4(a,b,c))
    if (s1 != '0' and s1 != '1') or (s2 != '0' and s2 != '1'):
        print('Error')
exec(input().strip()) # DON'T remove this line


# 1640418, 2022-09-24 09:57:20, P-PP[P-][PPPP] (67%)

def f1(a, b, c):
    f1=[]
    if a>0:
        f1+=[str(a)]
    if b>0:
        f1+=[str(b)]
    if c>0:
        f1+=[str(c)]
    f1.sort()
    return int(f1[0])

def f2(a, b, c):
    f2=[]
    if a<0:
        f2+=[str(a)]
    if b<0:
        f2+=[str(b)]
    if c<0:
        f2+=[str(c)]
    f2.sort()
    return int(f2[-1])
        
def f3(a, b, c):
    summ = a+b+c
    summ = abs(summ)
    summ = list(str(summ))
    return int(summ[0])
def f4(a, b, c):
    summ = a+b+c
    summ = abs(summ)
    summ = list(str(summ))
    return int(summ[-1])
def main():
    x = input().split(' ')
    s1 = x[0]
    s2 = x[1]
    a = int(x[2])
    b = int(x[3])
    c = int(x[4])
    if s1 == '0' and s2 == '0':
        print(f1(a,b,c))
    if s1 == '0' and s1 == '1':
        print(f2(a,b,c))
    if s1 == '1' and s2 == '0':
        print(f3(a,b,c))
    if s1 == '1' and s2 == '1':
        print(f4(a,b,c))
    if (s1 != '0' and s1 != '1') or (s2 != '0' and s2 != '1'):
        print('Error')
exec(input().strip()) # DON'T remove this line

# 1640465, 2022-09-24 09:58:38, PPPP[P-][PPPP] (83%)

def f1(a, b, c):
    f1=[]
    if a>0:
        f1+=[a]
    if b>0:
        f1+=[b]
    if c>0:
        f1+=[c]
    f1.sort()
    return int(f1[0])

def f2(a, b, c):
    f2=[]
    if a<0:
        f2+=[a]
    if b<0:
        f2+=[b]
    if c<0:
        f2+=[c]
    f2.sort()
    return int(f2[-1])
        
def f3(a, b, c):
    summ = a+b+c
    summ = abs(summ)
    summ = list(str(summ))
    return int(summ[0])
def f4(a, b, c):
    summ = a+b+c
    summ = abs(summ)
    summ = list(str(summ))
    return int(summ[-1])
def main():
    x = input().split(' ')
    s1 = x[0]
    s2 = x[1]
    a = int(x[2])
    b = int(x[3])
    c = int(x[4])
    if s1 == '0' and s2 == '0':
        print(f1(a,b,c))
    if s1 == '0' and s1 == '1':
        print(f2(a,b,c))
    if s1 == '1' and s2 == '0':
        print(f3(a,b,c))
    if s1 == '1' and s2 == '1':
        print(f4(a,b,c))
    if (s1 != '0' and s1 != '1') or (s2 != '0' and s2 != '1'):
        print('Error')
exec(input().strip()) # DON'T remove this line

# 1640575, 2022-09-24 10:01:25, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    f1=[]
    if a>0:
        f1+=[a]
    if b>0:
        f1+=[b]
    if c>0:
        f1+=[c]
    f1.sort()
    return int(f1[0])

def f2(a, b, c):
    f2=[]
    if a<0:
        f2+=[a]
    if b<0:
        f2+=[b]
    if c<0:
        f2+=[c]
    f2.sort()
    return int(f2[-1])
        
def f3(a, b, c):
    summ = a+b+c
    summ = abs(summ)
    summ = list(str(summ))
    return int(summ[0])
def f4(a, b, c):
    summ = a+b+c
    summ = abs(summ)
    summ = list(str(summ))
    return int(summ[-1])
def main():
    x = input().split(' ')
    s1 = x[0]
    s2 = x[1]
    a = int(x[2])
    b = int(x[3])
    c = int(x[4])
    if s1 == '0' and s2 == '0':
        print(f1(a,b,c))
    if s1 == '0' and s2 == '1':
        print(f2(a,b,c))
    if s1 == '1' and s2 == '0':
        print(f3(a,b,c))
    if s1 == '1' and s2 == '1':
        print(f4(a,b,c))
    if (s1 != '0' and s1 != '1') or (s2 != '0' and s2 != '1'):
        print('Error')
exec(input().strip()) # DON'T remove this line

6231417621
# 1639463, 2022-09-24 09:31:02, ----[PP][PPPP] (33%)

def f1(a, b, c):
    x=[a,b,c]
    for i in a,b,c:
        if i<0:
            x.remove(i)
    r=min(x)
    return r

def f2(a, b, c):
    x=[a,b,c]
    for i in a,b,c:
        if i>0:
            x.remove(i)
    r=max(x)
    return r

def f3(a, b, c):
    x=[a,b,c]
    y=sum(x)
    y=abs(y)
    y=str(y)
    return y[0]

def f4(a, b, c):
    x=[a,b,c]
    y=sum(x)
    y=abs(y)
    y=str(y)
    return y[-1]
 
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1 ==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c)
)
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c)
)
    else:
        print('Error')



exec(input().strip()) # DON'T remove this line

# 1641075, 2022-09-24 10:14:30, ----[PP][PPPP] (33%)

def f1(a, b, c):
    x=[a,b,c]
    for i in a,b,c:
        if i<0:
            x.remove(i)
    r=min(x)
    return r

def f2(a, b, c):
    x=[a,b,c]
    for i in a,b,c:
        if i>0:
            x.remove(i)
    r=max(x)
    return r

def f3(a, b, c):
    x=[a,b,c]
    y=sum(x)
    y=abs(y)
    y=str(y)
    return y[0]

def f4(a, b, c):
    x=[a,b,c]
    y=sum(x)
    y=abs(y)
    y=str(y)
    return y[-1]
 
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1 ==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c)
)
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c)
)
    else:
        print('Error')



exec(input().strip()) # DON'T remove this line
# 1641444, 2022-09-24 10:22:24, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    x=[a,b,c]
    for i in a,b,c:
        if i<0:
            x.remove(i)
    r=min(x)
    return int(r)

def f2(a, b, c):
    x=[a,b,c]
    for i in a,b,c:
        if i>0:
            x.remove(i)
    r=max(x)
    return int(r)

def f3(a, b, c):
    x=[a,b,c]
    y=sum(x)
    y=abs(y)
    y=str(y)
    return int(y[0])

def f4(a, b, c):
    x=[a,b,c]
    y=sum(x)
    y=abs(y)
    y=str(y)
    return int(y[-1])
 
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1 ==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c)
)
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c)
)
    else:
        print('Error')



exec(input().strip())
# 1641544, 2022-09-24 10:24:30, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    x=[a,b,c]
    for i in a,b,c:
        if i<=0:
            x.remove(i)
    r=min(x)
    return int(r)

def f2(a, b, c):
    x=[a,b,c]
    for i in a,b,c:
        if i>=0:
            x.remove(i)
    r=max(x)
    return int(r)
    
def f3(a, b, c):
    x=[a,b,c]
    y=sum(x)
    y=abs(y)
    y=str(y)
    return int(y[0])

def f4(a, b, c):
    x=[a,b,c]
    y=sum(x)
    y=abs(y)
    y=str(y)
    return int(y[-1])
 
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1 ==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c)
)
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c)
)
    else:
        print('Error')



exec(input().strip())

6231425621
# 1638854, 2022-09-24 09:16:48, Pxxx[xx][xxxx] (17%)

def f1(a,b,c):
    out = [a,b,c]
    if not a > 0:
        out.remove(a)
    if not b > 0:
        out.remove(b)
    if not c > 0:
        out.remove(c)
    return min(out)


        
    
    
exec(input().strip())
# 1639048, 2022-09-24 09:21:06, PPPx[xx][xxxx] (50%)

def f1(a,b,c):
    out = [a,b,c]
    if not a > 0:
        out.remove(a)
    if not b > 0:
        out.remove(b)
    if not c > 0:
        out.remove(c)
    return min(out)

def f2(a,b,c):
    out = [a,b,c]
    if not a < 0:
        out.remove(a)
    if not b < 0:
        out.remove(b)
    if not c < 0:
        out.remove(c)
    return max(out)

def f3(a, b, c):
    out = [a,b,c]
    s = sum(out)
    t = str(abs(s))
    r = int(t[0])
    return r

        
    
    
exec(input().strip())
# 1639257, 2022-09-24 09:25:48, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    out = [a,b,c]
    if not a > 0:
        out.remove(a)
    if not b > 0:
        out.remove(b)
    if not c > 0:
        out.remove(c)
    return min(out)

def f2(a,b,c):
    out = [a,b,c]
    if not a < 0:
        out.remove(a)
    if not b < 0:
        out.remove(b)
    if not c < 0:
        out.remove(c)
    return max(out)

def f3(a, b, c):
    out = [a,b,c]
    s = sum(out)
    t = str(abs(s))
    r = int(t[0])
    return r

def f4(a, b, c):
     out = [a,b,c]
     s = sum(out)
     t = str(abs(s))
     r = int(t[-1])
     return r
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2==0 :
        print(f1(a,b,c))
        
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
        
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
        
        
    
        
        
    
    
exec(input().strip())
# 1640121, 2022-09-24 09:48:58, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    out = [a,b,c]
    if not a > 0:
        out.remove(a)
    if not b > 0:
        out.remove(b)
    if not c > 0:
        out.remove(c)
    return min(out)

def f2(a,b,c):
    out = [a,b,c]
    if not a < 0:
        out.remove(a)
    if not b < 0:
        out.remove(b)
    if not c < 0:
        out.remove(c)
    return max(out)

def f3(a, b, c):
    out = [a,b,c]
    s = sum(out)
    t = str(abs(s))
    r = int(t[0])
    return r

def f4(a, b, c):
     out = [a,b,c]
     s = sum(out)
     t = str(abs(s))
     r = int(t[-1])
     return r
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2==0 :
        print(f1(a,b,c))
        
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
        
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
        
exec(input().strip()) # DON'T remove this line

6530010921
# 1639747, 2022-09-24 09:38:31, xxPx[xx][xxxx] (17%)

def f3(a, b, c):
    d = 0
    e = []
    d = int(a)+int(b)+int(c)
    d = str(d)
    for i in range(len(d)):
        e += d[i]
    if e[0] == '-':
        return int(e[1])
    else:
        return int(e[0])
    
exec(input().strip()) # DON'T remove this line

# 1640523, 2022-09-24 09:59:52, compilation error (0%)

def f1(a, b, c):
    e = []
    c1 = []
    a = int(a)
    if a > 0:
        for i in range(2,a+1):
            if a%i == 0:
                e += [i]
                if len(e)==1:
                    c1 += [a]
    if b > 0:
        for i in range(2,b+1):
            if a%i == 0:
                e += [i]
                if len(e)==1:
                    c1 += [b]
    if c > 0:
        for i in range(2,c+1):
            if c%i == 0:
                e += [i]
                if len(e)==1:
                    c1 += [a]
    c2 = min(c1)
    return(c2)
            
def f2(a, b, c):
      
        e = []
    c1 = []
    a = int(a)
    if a < 0:
        for i in range(2,a+1):
            if a%i == 0:
                e += [i]
                if len(e)==1:
                    c1 += [a]
    if b < 0:
        for i in range(2,b+1):
            if a%i == 0:
                e += [i]
                if len(e)==1:
                    c1 += [b]
    if c < 0:
        for i in range(2,c+1):
            if c%i == 0:
                e += [i]
                if len(e)==1:
                    c1 += [a]
    c2 = min(c1)
    return(c2)

def f3(a, b, c):
    d = 0
    e = []
    d = int(a)+int(b)+int(c)
    d = str(d)
    for i in range(len(d)):
        e += d[i]
    if e[0] == '-':
        return int(e[1])
    else:
        return int(e[0])
    
def f4(a, b, c):
    d = 0
    e = []
    d = int(a)+int(b)+int(c)
    d = str(d)
    for i in range(len(d)):
        e += d[i]
    return int(e[-1])
    
exec(input().strip()) # DON'T remove this line
    
exec(input().strip()) # DON'T remove this line

# 1641056, 2022-09-24 10:13:57, -PPP[-P][PPPP] (67%)

def f1(a, b, c):
    e = []
    a = int(a)
    b = int(b)
    c = int(c)
    if a > 0:
        e += [a]
    if b > 0:
        e += [b]
    if c > 0:
        e += [c]
    c2 = min(e)
    return(e,c2)

def f2(a, b, c):
    e = []
    a = int(a)
    b = int(b)
    c = int(c)
    if a < 0:
        e += [a]
    if b < 0:
        e += [b]
    if c < 0:
        e += [c]
    c2 = max(e)
    return(c2)

def f3(a, b, c):
    d = 0
    e = []
    d = int(a)+int(b)+int(c)
    d = str(d)
    for i in range(len(d)):
        e += d[i]
    if e[0] == '-':
        return int(e[1])
    else:
        return int(e[0])
    
def f4(a, b, c):
    d = 0
    e = []
    d = int(a)+int(b)+int(c)
    d = str(d)
    for i in range(len(d)):
        e += d[i]
    return int(e[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
    
    
exec(input().strip()) # DON'T remove this line


# 1641139, 2022-09-24 10:16:18, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    e = []
    a = int(a)
    b = int(b)
    c = int(c)
    if a > 0:
        e += [a]
    if b > 0:
        e += [b]
    if c > 0:
        e += [c]
    c2 = min(e)
    return(c2)

def f2(a, b, c):
    e = []
    a = int(a)
    b = int(b)
    c = int(c)
    if a < 0:
        e += [a]
    if b < 0:
        e += [b]
    if c < 0:
        e += [c]
    c2 = max(e)
    return(c2)

def f3(a, b, c):
    d = 0
    e = []
    d = int(a)+int(b)+int(c)
    d = str(d)
    for i in range(len(d)):
        e += d[i]
    if e[0] == '-':
        return int(e[1])
    else:
        return int(e[0])
    
def f4(a, b, c):
    d = 0
    e = []
    d = int(a)+int(b)+int(c)
    d = str(d)
    for i in range(len(d)):
        e += d[i]
    return int(e[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
    
    
exec(input().strip()) # DON'T remove this line



6530018021
# 1639344, 2022-09-24 09:28:07, PPxP[PP][P-PP] (67%)

def f1(a, b, c):
    if a <= 0:
        a = 1001
    if b <= 0:
        b = 1001
    if c <= 0:
        c = 1001
    return min(a,b,c)
    
def f2(a, b, c):

    if a >= 0:
        a = -1001
    if b >= 0:
        b = -1001
    if c >= 0:
        c = -1001
    return max(a,b,c)

def f3(a, b, c):

    d = a + b + c
    e = str(d)
    return int(e[1])
def f4(a, b, c):

    d = a + b + c
    e = str(d)
    return int(e[-1])
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line

# 1639524, 2022-09-24 09:32:25, PPxP[PP][P-PP] (67%)

def f1(a, b, c):
    if a <= 0:
        a = 1001
    if b <= 0:
        b = 1001
    if c <= 0:
        c = 1001
    return min(a,b,c)
    
def f2(a, b, c):

    if a >= 0:
        a = -1001
    if b >= 0:
        b = -1001
    if c >= 0:
        c = -1001
    return max(a,b,c)

def f3(a, b, c):

    d = a + b + c
    e = str(d)
    return int(e[1])
def f4(a, b, c):

    d = a + b + c
    e = str(d)
    return int(e[-1])
def main():
    s1,s2,a,b,c = [int(f) for f in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1639590, 2022-09-24 09:34:15, PPxP[PP][P-PP] (67%)

def f1(a, b, c):
    if a <= 0:
        a = 1001
    if b <= 0:
        b = 1001
    if c <= 0:
        c = 1001
    return min(a,b,c)
    
def f2(a, b, c):

    if a >= 0:
        a = -1001
    if b >= 0:
        b = -1001
    if c >= 0:
        c = -1001
    return max(a,b,c)

def f3(a, b, c):

    d = a + b + c
    e = str(d)
    return int(e[1])
def f4(a, b, c):

    d = a + b + c
    e = str(d)
    return int(e[-1])
def main():
    s1,s2,a,b,c = [int(g) for g in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1639674, 2022-09-24 09:36:18, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    if a <= 0:
        a = 1001
    if b <= 0:
        b = 1001
    if c <= 0:
        c = 1001
    return min(a,b,c)
    
def f2(a, b, c):

    if a >= 0:
        a = -1001
    if b >= 0:
        b = -1001
    if c >= 0:
        c = -1001
    return max(a,b,c)

def f3(a, b, c):

    d = a + b + c
    if d < 0:
        d = -1 * d
    e = str(d)
    return int(e[0])
def f4(a, b, c):

    d = a + b + c
    e = str(d)
    return int(e[-1])
def main():
    s1,s2,a,b,c = [int(g) for g in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line


6531403021
# 1639539, 2022-09-24 09:32:47, PP--[PP][PPPP] (67%)

def f1(a,b,c) :
    n =list()
    if a > 0 : n.append(int(a))
    if b > 0 : n.append(int(b))
    if c > 0 : n.append(int(c))
    min1 = n[0]
    for x in n :
        if x<min1 : min1=x
    return min1

def f2(a,b,c) :
    n =list()
    if a < 0 : n.append(int(a))
    if b < 0 : n.append(int(b))
    if c < 0 : n.append(int(c))
    max1 = n[0]
    for x in n :
        if x>max1 : max1=x
    return max1

def f3(a,b,c) :
    sum1 = int(a)+int(b)+int(c)
    if sum1 < 0 : sum1*=-1
    s = str(sum1)
    return s[0]

def f4(a,b,c) :
    sum1 = int(a)+int(b)+int(c)
    if sum1 < 0 : sum1*=-1
    s = str(sum1)
    return s[len(s)-1]

def main() :
    s1,s2,a,b,c = [int (e) for e in input().split()]
    if s1 == 0 and s2 == 0 : print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 : print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 : print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 : print(f4(a,b,c))
    else : print("Error")

exec(input().strip()) # DON'T remove this line

# 1639667, 2022-09-24 09:36:08, PP--[PP][PPP-] (50%)

def f1(a,b,c) :
    n =list()
    if a > 0 : n.append(int(a))
    if b > 0 : n.append(int(b))
    if c > 0 : n.append(int(c))
    min1 = n[0]
    for x in n :
        if x<min1 : min1=x
    return min1

def f2(a,b,c) :
    n =list()
    if a < 0 : n.append(int(a))
    if b < 0 : n.append(int(b))
    if c < 0 : n.append(int(c))
    max1 = n[0]
    for x in n :
        if x>max1 : max1=x
    return max1

def f3(a,b,c) :
    sum1 = int(a)+int(b)+int(c)
    s = str(sum1)
    return s[0]

def f4(a,b,c) :
    sum1 = int(a)+int(b)+int(c)
    if sum1 < 0 : sum1*=-1
    s = str(sum1)
    return s[len(s)-1]

def main() :
    s1,s2,a,b,c = [int (e) for e in input().split()]
    if s1 == 0 and s2 == 0 : print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 : print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 : print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 : print(f4(a,b,c))
    else : print("Error")

exec(input().strip()) # DON'T remove this line

# 1639680, 2022-09-24 09:36:29, PP--[PP][PPPP] (67%)

def f1(a,b,c) :
    n =list()
    if a > 0 : n.append(int(a))
    if b > 0 : n.append(int(b))
    if c > 0 : n.append(int(c))
    min1 = n[0]
    for x in n :
        if x<min1 : min1=x
    return min1

def f2(a,b,c) :
    n =list()
    if a < 0 : n.append(int(a))
    if b < 0 : n.append(int(b))
    if c < 0 : n.append(int(c))
    max1 = n[0]
    for x in n :
        if x>max1 : max1=x
    return max1

def f3(a,b,c) :
    sum1 = int(a)+int(b)+int(c)
    if sum1 < 0 : sum1*=-1
    s = str(sum1)
    return s[0]

def f4(a,b,c) :
    sum1 = int(a)+int(b)+int(c)
    if sum1 < 0 : sum1*=-1
    s = str(sum1)
    return s[len(s)-1]

def main() :
    s1,s2,a,b,c = [int (e) for e in input().split()]
    if s1 == 0 and s2 == 0 : print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 : print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 : print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 : print(f4(a,b,c))
    else : print("Error")

exec(input().strip()) # DON'T remove this line

# 1639727, 2022-09-24 09:37:49, PPPP[PP][PPPP] (100%)

def f1(a,b,c) :
    n =list()
    if a > 0 : n.append(int(a))
    if b > 0 : n.append(int(b))
    if c > 0 : n.append(int(c))
    min1 = n[0]
    for x in n :
        if x<min1 : min1=x
    return min1

def f2(a,b,c) :
    n =list()
    if a < 0 : n.append(int(a))
    if b < 0 : n.append(int(b))
    if c < 0 : n.append(int(c))
    max1 = n[0]
    for x in n :
        if x>max1 : max1=x
    return max1

def f3(a,b,c) :
    sum1 = int(a)+int(b)+int(c)
    if sum1 < 0 : sum1*=-1
    s = str(sum1)
    return int(s[0])

def f4(a,b,c) :
    sum1 = int(a)+int(b)+int(c)
    if sum1 < 0 : sum1*=-1
    s = str(sum1)
    return int(s[len(s)-1])

def main() :
    s1,s2,a,b,c = [int (e) for e in input().split()]
    if s1 == 0 and s2 == 0 : print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 : print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 : print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 : print(f4(a,b,c))
    else : print("Error")

exec(input().strip()) # DON'T remove this line


6530060221
# 1639859, 2022-09-24 09:41:15, P---[P-][PPPP] (33%)

def f1(a,b,c):
  k = []
  d = (a,b,c)
  for i in range(3):
      if d[i] > 0:
          k.append(d[i])
  return min(k)


def f2(a,b,c):
  k = []
  d = (a,b,c)
  for i in range(3):
      if d[i] > 0:
          k.append(d[i])
  return max(k)

  
def f3(a,b,c):
  f = int(a)+int(b)+int(c)
  if f < 0:
      f = f*-1
  f1 = str(f)[0]
  return f1

     

def f4(a,b,c):
  f = int(a)+int(b)+int(c)
  if f < 0:
      f = f*-1
  f1 = str(f)[-1]
  return f1
  
def main():
  s1,s2,a,b,c = [int(e) for e in input().split()]
  if s1==0 and s2==0:
    print(f1(a,b,c))
  elif s1==0 and s2==1:
    print(f2(a,b,c))
  elif s1==1 and s2==0:
    print(f3(a,b,c))
  elif s1==1 and s2==1:
    print(f4(a,b,c))
  else :
    print("Error")
  
exec(input().strip()) # DON'T remove this line
  
  

# 1639918, 2022-09-24 09:42:53, P-PP[P-][PPPP] (67%)

def f1(a,b,c):
  k = []
  d = (a,b,c)
  for i in range(3):
      if d[i] > 0:
          k.append(d[i])
  return int(min(k))


def f2(a,b,c):
  k = []
  d = (a,b,c)
  for i in range(3):
      if d[i] > 0:
          k.append(d[i])
  return int(max(k))

  
def f3(a,b,c):
  f = int(a)+int(b)+int(c)
  if f < 0:
      f = f*-1
  f1 = str(f)[0]
  return int(f1)

     

def f4(a,b,c):
  f = int(a)+int(b)+int(c)
  if f < 0:
      f = f*-1
  f1 = str(f)[-1]
  return int(f1)
  
def main():
  s1,s2,a,b,c = [int(e) for e in input().split()]
  if s1==0 and s2==0:
    print(f1(a,b,c))
  elif s1==0 and s2==1:
    print(f2(a,b,c))
  elif s1==1 and s2==0:
    print(f3(a,b,c))
  elif s1==1 and s2==1:
    print(f4(a,b,c))
  else :
    print("Error")
  
exec(input().strip()) # DON'T remove this line


  
  

# 1640086, 2022-09-24 09:47:47, P-PP[P-][PPPP] (67%)

def f1(a,b,c):
  k = []
  d = (a,b,c)
  for i in range(3):
      if d[i] > 0:
          k.append(d[i])
  return int(round(min(k),0))


def f2(a,b,c):
  k = []
  d = (a,b,c)
  for i in range(3):
      if d[i] > 0:
          k.append(d[i])
  return int(round(max(k),0))

  
def f3(a,b,c):
  f = int(a)+int(b)+int(c)
  if f < 0:
      f = f*-1
  f1 = str(f)[0]
  return int(f1)

     

def f4(a,b,c):
  f = int(a)+int(b)+int(c)
  if f < 0:
      f = f*-1
  f1 = str(f)[-1]
  return int(f1)
  
def main():
  s1,s2,a,b,c = [int(e) for e in input().split()]
  if s1==0 and s2==0:
    print(f1(a,b,c))
  elif s1==0 and s2==1:
    print(f2(a,b,c))
  elif s1==1 and s2==0:
    print(f3(a,b,c))
  elif s1==1 and s2==1:
    print(f4(a,b,c))
  else :
    print("Error")
  
exec(input().strip()) # DON'T remove this line
# 1640157, 2022-09-24 09:49:51, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
  k = []
  d = (a,b,c)
  for i in range(3):
      if d[i] > 0:
          k.append(d[i])
  return int(round(min(k),0))


def f2(a,b,c):
  k = []
  d = (a,b,c)
  for i in range(3):
      if d[i] < 0:
          k.append(d[i])
  return int(round(max(k),0))

  
def f3(a,b,c):
  f = int(a)+int(b)+int(c)
  if f < 0:
      f = f*-1
  f1 = str(f)[0]
  return int(f1)

     

def f4(a,b,c):
  f = int(a)+int(b)+int(c)
  if f < 0:
      f = f*-1
  f1 = str(f)[-1]
  return int(f1)
  
def main():
  s1,s2,a,b,c = [int(e) for e in input().split()]
  if s1==0 and s2==0:
    print(f1(a,b,c))
  elif s1==0 and s2==1:
    print(f2(a,b,c))
  elif s1==1 and s2==0:
    print(f3(a,b,c))
  elif s1==1 and s2==1:
    print(f4(a,b,c))
  else :
    print("Error")
  
exec(input().strip()) # DON'T remove this line

6530085021
# 1639512, 2022-09-24 09:32:05, PP--[PP][PxPx] (50%)

def f1(a,b,c):
    lis = []
    if a > 0:
        lis.append(a)
    if b > 0:
        lis.append(b)
    if c > 0:
        lis.append(c)
    return(min(lis))
def f2(a,b,c):
    lis = []
    if a < 0:
        lis.append(a)
    if b < 0:
        lis.append(b)
    if c < 0:
        lis.append(c)
    return(max(lis))
def f3(a,b,c):
    lis = [a,b,c]
    x = str(abs(sum(lis)))
    return x[0]
def f4(a,b,c):
    lis = [a,b,c]
    x = str(abs(sum(lis)))
    return x[-1]
def main():
    s1,s2,a,b,c = input().split()
    s1,s2,a,b,c = int(s1),int(s2),int(a),int(b),int(c)
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f13(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) 
# 1641043, 2022-09-24 10:13:41, PP--[PP][PPPP] (67%)

def f1(a,b,c):
    lis = []
    if a > 0:
        lis.append(a)
    if b > 0:
        lis.append(b)
    if c > 0:
        lis.append(c)
    return(min(lis))
def f2(a,b,c):
    lis = []
    if a < 0:
        lis.append(a)
    if b < 0:
        lis.append(b)
    if c < 0:
        lis.append(c)
    return(max(lis))
def f3(a,b,c):
    lis = [a,b,c]
    x = str(abs(sum(lis)))
    return x[0]
def f4(a,b,c):
    lis = [a,b,c]
    x = str(abs(sum(lis)))
    return x[-1]
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip())
# 1641116, 2022-09-24 10:15:45, PP--[PP][PPPP] (67%)

def f1(a,b,c):
    lis = []
    if a > 0:
        lis.append(a)
    if b > 0:
        lis.append(b)
    if c > 0:
        lis.append(c)
    return min(lis)
def f2(a,b,c):
    lis = []
    if a < 0:
        lis.append(a)
    if b < 0:
        lis.append(b)
    if c < 0:
        lis.append(c)
    return max(lis)
def f3(a,b,c):
    lis = [a,b,c]
    x = str(abs(sum(lis)))
    return x[0]
def f4(a,b,c):
    lis = [a,b,c]
    x = str(abs(sum(lis)))
    return x[-1]
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip())
# 1641397, 2022-09-24 10:21:23, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    lis = []
    if a > 0:
        lis.append(a)
    if b > 0:
        lis.append(b)
    if c > 0:
        lis.append(c)
    return(min(lis))
def f2(a,b,c):
    lis = []
    if a < 0:
        lis.append(a)
    if b < 0:
        lis.append(b)
    if c < 0:
        lis.append(c)
    return(max(lis))
def f3(a,b,c):
    lis = [a,b,c]
    x = str(abs(sum(lis)))
    return int(x[0])
def f4(a,b,c):
    lis = [a,b,c]
    x = str(abs(sum(lis)))
    return int(x[-1])
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip())

6530090021
# 1639614, 2022-09-24 09:34:45, PPPP[--][P-P-] (67%)

def f1(a, b, c):
    b = [a,b,c]
    B=[]
    for i in b:
        if i > 0:
            B.append(i)
    M = min(B)
    return M

def f2(a, b, c):
    b = [a,b,c]
    B=[]
    for i in b:
        if i < 0:
            B.append(i)
    M = max(B)
    return M

def f3(a, b, c):
    b = [a,b,c]
    Q = sum(b)
    R = abs(Q)
    V = str(R)
    return int(V[0])

def f4(a, b, c):
    b = [a,b,c]
    Q = sum(b)
    R = abs(Q)
    V = str(R)
    return int(V[-1])

def main():
    v= input().split()
    v = [int(i) for i in v]
    s1,s2,a,b,c = v
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2==1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
    
exec(input().strip()) # DON'T remove this line

# 1639657, 2022-09-24 09:35:55, --PP[--][P-P-] (33%)

def f1(a, b, c):
    b = [a,b,c]
    B=[]
    for i in b:
        if i >= 0:
            B.append(i)
    M = min(B)
    return M

def f2(a, b, c):
    b = [a,b,c]
    B=[]
    for i in b:
        if i <= 0:
            B.append(i)
    M = max(B)
    return M

def f3(a, b, c):
    b = [a,b,c]
    Q = sum(b)
    R = abs(Q)
    V = str(R)
    return int(V[0])

def f4(a, b, c):
    b = [a,b,c]
    Q = sum(b)
    R = abs(Q)
    V = str(R)
    return int(V[-1])

def main():
    v= input().split()
    v = [int(i) for i in v]
    s1,s2,a,b,c = v
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2==1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
    
exec(input().strip()) # DON'T remove this line

# 1639669, 2022-09-24 09:36:10, PPPP[--][P-P-] (67%)

def f1(a, b, c):
    b = [a,b,c]
    B=[]
    for i in b:
        if i > 0:
            B.append(i)
    M = min(B)
    return M

def f2(a, b, c):
    b = [a,b,c]
    B=[]
    for i in b:
        if i < 0:
            B.append(i)
    M = max(B)
    return M

def f3(a, b, c):
    b = [a,b,c]
    Q = sum(b)
    R = abs(Q)
    V = str(R)
    return int(V[0])

def f4(a, b, c):
    b = [a,b,c]
    Q = sum(b)
    R = abs(Q)
    V = str(R)
    return int(V[-1])

def main():
    v= input().split()
    v = [int(i) for i in v]
    s1,s2,a,b,c = v
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2==1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
    
exec(input().strip()) # DON'T remove this line

# 1641134, 2022-09-24 10:16:08, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    b = [a,b,c]
    B=[]
    for i in b:
        if i > 0:
            B.append(i)
    M = min(B)
    return M

def f2(a, b, c):
    b = [a,b,c]
    B=[]
    for i in b:
        if i < 0:
            B.append(i)
    M = max(B)
    return M

def f3(a, b, c):
    b = [a,b,c]
    Q = sum(b)
    R = abs(Q)
    V = str(R)
    return int(V[0])

def f4(a, b, c):
    b = [a,b,c]
    Q = sum(b)
    R = abs(Q)
    V = str(R)
    return int(V[-1])

def main():
    v= input().split()
    v = [int(i) for i in v]
    s1,s2,a,b,c = v
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2==1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
    
exec(input().strip()) # DON'T remove this line


6530123121
# 1639281, 2022-09-24 09:26:12, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    A = [a,b,c]
    cal = []
    for i in A :
        i = int(i)
        if i > 0 :
            cal.append(i)
    return (min(cal))

def f2(a, b, c):
    A = [a,b,c]
    cal = []
    for i in A :
        i = int(i)
        if i < 0 :
            cal.append(i)
    return (max(cal))

def f3(a, b, c):
    A = [int(a),int(b),int(c)]
    S = abs(sum(A))
    S = str(S)
    return (S[0])

def f4(a, b, c):
    A = [int(a),int(b),int(c)]
    S = abs(sum(A))
    S = str(S)
    return (S[-1])

def main():
    s1 , s2 , a , b , c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print  (f1(a, b, c)
)
    elif s1 == 0 and s2 == 1:
        print  (f2(a, b, c)
)
    elif s1 == 1 and s2 == 0:
        print  (f3(a, b, c)
)
    elif s1 == 1 and s2 == 1:
        print  (f4(a, b, c)
)
    else :
        print ('Error')
        
exec(input().strip()) # DON'T remove this line

# 1640569, 2022-09-24 10:01:15, ----[PP][PPPP] (33%)

def f1(a, b, c):
    A = [a,b,c]
    cal = []
    for i in A :
        i = int(i)
        if i >= 0 :
            cal.append(i)
    return (min(cal))

def f2(a, b, c):
    A = [a,b,c]
    cal = []
    for i in A :
        i = int(i)
        if i <= 0 :
            cal.append(i)
    return (max(cal))

def f3(a, b, c):
    A = [int(a),int(b),int(c)]
    S = abs(sum(A))
    S = str(S)
    return (S[0])

def f4(a, b, c):
    A = [int(a),int(b),int(c)]
    S = abs(sum(A))
    S = str(S)
    return (S[-1])

def main():
    s1 , s2 , a , b , c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print  (f1(a, b, c)
)
    elif s1 == 0 and s2 == 1:
        print  (f2(a, b, c)
)
    elif s1 == 1 and s2 == 0:
        print  (f3(a, b, c)
)
    elif s1 == 1 and s2 == 1:
        print  (f4(a, b, c)
)
    else :
        print ('Error')
        
exec(input().strip()) # DON'T remove this line
# 1640580, 2022-09-24 10:01:35, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    A = [a,b,c]
    cal = []
    for i in A :
        i = int(i)
        if i > 0 :
            cal.append(i)
    return (min(cal))

def f2(a, b, c):
    A = [a,b,c]
    cal = []
    for i in A :
        i = int(i)
        if i < 0 :
            cal.append(i)
    return (max(cal))

def f3(a, b, c):
    A = [int(a),int(b),int(c)]
    S = abs(sum(A))
    S = str(S)
    return (S[0])

def f4(a, b, c):
    A = [int(a),int(b),int(c)]
    S = abs(sum(A))
    S = str(S)
    return (S[-1])

def main():
    s1 , s2 , a , b , c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print  (f1(a, b, c)
)
    elif s1 == 0 and s2 == 1:
        print  (f2(a, b, c)
)
    elif s1 == 1 and s2 == 0:
        print  (f3(a, b, c)
)
    elif s1 == 1 and s2 == 1:
        print  (f4(a, b, c)
)
    else :
        print ('Error')
        
exec(input().strip()) # DON'T remove this line
# 1640730, 2022-09-24 10:05:43, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    A = [a,b,c]
    cal = []
    for i in A :
        i = int(i)
        if i > 0 :
            cal.append(i)
    return (min(cal))

def f2(a, b, c):
    A = [a,b,c]
    cal = []
    for i in A :
        i = int(i)
        if i < 0 :
            cal.append(i)
    return (max(cal))

def f3(a, b, c):
    A = [a,b,c]
    S = abs(sum(A))
    S = str(S)
    return (int(S[0]))

def f4(a, b, c):
    A = [a,b,c]
    S = abs(sum(A))
    S = str(S)
    return (int(S[-1]))

def main():
    s1 , s2 , a , b , c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print  (f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print  (f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print  (f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print  (f4(a, b, c))
    else :
        print ('Error')
        
exec(input().strip()) # DON'T remove this line


6530170621
# 1639945, 2022-09-24 09:43:47, PP--[PP][PPPP] (67%)

def f1(a,b,c):
    x=[]
    if a > 0 :
        x.append(a)
    if b > 0 :
        x.append(b)
    if c > 0 :
        x.append(c)
    return min(x)
def f2(a,b,c):
    x=[]
    if a < 0 :
        x.append(a)
    if b < 0 :
        x.append(b)
    if c < 0 :
        x.append(c)
    return max(x)
def f3(a,b,c):
    x=a+b+c
    if x >= 0 :
        a=str(x)
        return a[0]
    else:
        a=str(x)
        return a[1]
def f4(a,b,c):
    x=str(a+b+c)
    if len(x)==1:
        return x[0]
    else:
        return x[-1]
def main():
    x  = input().split()
    s1 = int(x[0])
    s2 = int(x[1])
    a  = int(x[2])
    b  = int(x[3])
    c  = int(x[4])
    if   s1==0 and s2==0:
        return print(f1(a,b,c))
    elif s1==0 and s2==1:
        return print(f2(a,b,c))
    elif s1==1 and s2==0:
        return print(f3(a,b,c))
    elif s1==1 and s2==1:
        return print(f4(a,b,c))
    else:
        return print('Error')
exec(input().strip())
# 1640066, 2022-09-24 09:47:21, PP--[PP][PPPP] (67%)

def f1(a,b,c):
    x=[]
    if a > 0 :
        x.append(a)
    if b > 0 :
        x.append(b)
    if c > 0 :
        x.append(c)
    a=min(x)
    return a
def f2(a,b,c):
    x=[]
    if a < 0 :
        x.append(a)
    if b < 0 :
        x.append(b)
    if c < 0 :
        x.append(c)
    return max(x)
def f3(a,b,c):
    x=a+b+c
    if x >= 0 :
        a=str(x)
        return a[0]
    else:
        a=str(x)
        return a[1]
def f4(a,b,c):
    x=str(a+b+c)
    if len(x)==1:
        return x[0]
    else:
        return x[-1]
def main():
    x  = input().split()
    s1 = int(x[0])
    s2 = int(x[1])
    a  = int(x[2])
    b  = int(x[3])
    c  = int(x[4])
    if   s1==0 and s2==0:
        return print(f1(a,b,c))
    elif s1==0 and s2==1:
        return print(f2(a,b,c))
    elif s1==1 and s2==0:
        return print(f3(a,b,c))
    elif s1==1 and s2==1:
        return print(f4(a,b,c))
    else:
        return print('Error')
exec(input().strip())
# 1640240, 2022-09-24 09:51:54, PP--[PP][PPPP] (67%)

def f1(a,b,c):
    x=[]
    if a > 0 :
        x+=[a]
    if b > 0 :
        x+=[b]
    if c > 0 :
        x+=[c]
    return min(x)
def f2(a,b,c):
    x=[]
    if a < 0 :
        x+=[a]
    if b < 0 :
        x+=[b]
    if c < 0 :
        x+=[c]
    return max(x)
def f3(a,b,c):
    x=a+b+c
    if x >= 0 :
        a=str(x)
        return a[0]
    else:
        a=str(x)
        return a[1]
def f4(a,b,c):
    x=str(a+b+c)
    if len(x)==1:
        return x[0]
    else:
        return x[-1]
def main():
    x  = input().split()
    s1 = int(x[0])
    s2 = int(x[1])
    a  = int(x[2])
    b  = int(x[3])
    c  = int(x[4])
    if   s1==0 and s2==0:
        return print(f1(a,b,c))
    elif s1==0 and s2==1:
        return print(f2(a,b,c))
    elif s1==1 and s2==0:
        return print(f3(a,b,c))
    elif s1==1 and s2==1:
        return print(f4(a,b,c))
    else:
        return print('Error')
exec(input().strip())
# 1640729, 2022-09-24 10:05:42, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    x=[]
    if a > 0 :
        x+=[a]
    if b > 0 :
        x+=[b]
    if c > 0 :
        x+=[c]
    return min(x)
def f2(a,b,c):
    x=[]
    if a < 0 :
        x+=[a]
    if b < 0 :
        x+=[b]
    if c < 0 :
        x+=[c]
    return max(x)
def f3(a,b,c):
    x=a+b+c
    if x >= 0 :
        a=str(x)
        return int(a[0])
    else:
        a=str(x)
        return int(a[1])
def f4(a,b,c):
    x=str(a+b+c)
    if len(x)==1:
        return int(x[0])
    else:
        return int(x[-1])
def main():
    x  = input().split()
    s1 = int(x[0])
    s2 = int(x[1])
    a  = int(x[2])
    b  = int(x[3])
    c  = int(x[4])
    if   s1==0 and s2==0:
        return print(f1(a,b,c))
    elif s1==0 and s2==1:
        return print(f2(a,b,c))
    elif s1==1 and s2==0:
        return print(f3(a,b,c))
    elif s1==1 and s2==1:
        return print(f4(a,b,c))
    else:
        return print('Error')
exec(input().strip())

6530182121
# 1639122, 2022-09-24 09:22:36, PP--[PP][PPPP] (67%)

def f1(a,b,c) :
    #OK
    out = [] 
    if a > 0 and type(a) == int:
        out.append(a)
    if b > 0 and type(b) == int:
        out.append(b)
    if c > 0 and type(c) == int:
        out.append(c)
    ans = min(out)
    return ans

def f2(a,b,c) :
    #OK
    out = []
    if a < 0 and type(a) == int:
        out.append(a)
    if b < 0 and type(b) == int:
        out.append(b)
    if c < 0 and type(c) == int:
        out.append(c)
    ans = max(out)
    return ans

import math

def f3(a,b,c) :
    #OK
    summ = a+b+c
    out = math.fabs(summ)
    ans = str(out)[0]
    #print(summ)
    return ans

def f4(a,b,c):
    summ = a+b+c
    out = abs(summ)
    ans = str(out)[-1]
    return ans
    

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == s2 == 1 :
        print(f4(a,b,c))
    else :
        print("Error")
    
exec(input().strip()) # DON'T remove this line
    
    

# 1640011, 2022-09-24 09:45:43, PPP-[PP][PPPP] (83%)

def f1(a,b,c) :
    #OK
    out = [] 
    if a > 0 and type(a) == int:
        out.append(a)
    if b > 0 and type(b) == int:
        out.append(b)
    if c > 0 and type(c) == int:
        out.append(c)
    ans = min(out)
    return ans

def f2(a,b,c) :
    #OK
    out = []
    if a < 0 and type(a) == int:
        out.append(a)
    if b < 0 and type(b) == int:
        out.append(b)
    if c < 0 and type(c) == int:
        out.append(c)
    ans = max(out)
    return int(ans)


def f3(a,b,c) :
    #OK
    summ = a+b+c
    out = abs(summ)
    ans = str(int(out))[0]
    #print(summ)
    return int(ans)

def f4(a,b,c):
    summ = a+b+c
    out = abs(int(summ))
    ans = str(out)[-1]
    return ans
    

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == s2 == 1 :
        print(f4(a,b,c))
    else :
        print("Error")
    
exec(input().strip()) # DON'T remove this line

# 1640017, 2022-09-24 09:45:59, PPPP[PP][PPPP] (100%)

def f1(a,b,c) :
    #OK
    out = [] 
    if a > 0 and type(a) == int:
        out.append(a)
    if b > 0 and type(b) == int:
        out.append(b)
    if c > 0 and type(c) == int:
        out.append(c)
    ans = min(out)
    return ans

def f2(a,b,c) :
    #OK
    out = []
    if a < 0 and type(a) == int:
        out.append(a)
    if b < 0 and type(b) == int:
        out.append(b)
    if c < 0 and type(c) == int:
        out.append(c)
    ans = max(out)
    return int(ans)


def f3(a,b,c) :
    #OK
    summ = a+b+c
    out = abs(summ)
    ans = str(int(out))[0]
    #print(summ)
    return int(ans)

def f4(a,b,c):
    summ = a+b+c
    out = abs(int(summ))
    ans = str(out)[-1]
    return int(ans)
    

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == s2 == 1 :
        print(f4(a,b,c))
    else :
        print("Error")
    
exec(input().strip()) # DON'T remove this line
# 1641379, 2022-09-24 10:21:00, PPPP[PP][PPPP] (100%)

def f1(a,b,c) :
    #OK
    out = [] 
    if a > 0 and type(a) == int:
        out.append(a)
    if b > 0 and type(b) == int:
        out.append(b)
    if c > 0 and type(c) == int:
        out.append(c)
    ans = min(out)
    return int(ans)

def f2(a,b,c) :
    #OK
    out = []
    if a < 0 and type(a) == int:
        out.append(a)
    if b < 0 and type(b) == int:
        out.append(b)
    if c < 0 and type(c) == int:
        out.append(c)
    ans = max(out)
    return int(ans)


def f3(a,b,c) :
    #OK
    summ = a+b+c
    out = abs(summ)
    ans = str(int(out))[0]
    #print(summ)
    return int(ans)

def f4(a,b,c):
    summ = a+b+c
    out = abs(int(summ))
    ans = str(out)[-1]
    return int(ans)
    

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == s2 == 1 :
        print(f4(a,b,c))
    else :
        print("Error")
    
exec(input().strip()) # DON'T remove this line

6530201421
# 1639294, 2022-09-24 09:26:43, x---[xP][PPPP] (17%)

def f1(a,b,c):
    digits=[a,b,c]
    mins=a
    for i in range(len(digits)):
        if digits[i]>0 and digits[i]<mins and digits%1==0:
            mins=digits[i]
    return mins
def f2(a, b, c):

    digits=[a,b,c]
    maxs=a
    for i in range(len(digits)):
        if digits[i]<0 and digits[i]>maxs:#####
            maxs=digits[i]
    return maxs
    
def f3(a, b, c):

    result=a+b+c
    if result<0:
        result*=(-1)
    return str(result)[0]

def f4(a, b, c):

    result=a+b+c
    if result<0:
        result*=(-1)
    return str(result)[-1]

def main():
    data=input().split()
    s1= int(data[0])
    s2=int(data[1])
    a=int(data[2])
    b=int(data[3])
    c=int(data[4])
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip()) # DON'T remove this line

# 1639311, 2022-09-24 09:27:14, ----[PP][PPPP] (33%)

def f1(a,b,c):
    digits=[a,b,c]
    mins=a
    for i in range(len(digits)):
        if digits[i]>0 and digits[i]<mins:
            mins=digits[i]
    return mins
def f2(a, b, c):

    digits=[a,b,c]
    maxs=a
    for i in range(len(digits)):
        if digits[i]<0 and digits[i]>maxs:#####
            maxs=digits[i]
    return maxs
    
def f3(a, b, c):

    result=a+b+c
    if result<0:
        result*=(-1)
    return str(result)[0]

def f4(a, b, c):

    result=a+b+c
    if result<0:
        result*=(-1)
    return str(result)[-1]

def main():
    data=input().split()
    s1= int(data[0])
    s2=int(data[1])
    a=int(data[2])
    b=int(data[3])
    c=int(data[4])
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip()) # DON'T remove this line

# 1640686, 2022-09-24 10:04:28, PP--[PP][PPPP] (67%)

def f1(a,b,c):
    digits=[a,b,c]
    mins=10000000
    for i in range(len(digits)):
        if digits[i]>0 and digits[i]<mins==int(mins):
            mins=digits[i]
    return mins
def f2(a, b, c):

    digits=[a,b,c]
    maxs=-9999999999
    for i in range(len(digits)):
        if digits[i]<0 and digits[i]>maxs and maxs==int(maxs):#####
            maxs=digits[i]
    return maxs
    
def f3(a, b, c):

    result=a+b+c
    if result<0:
        result*=(-1)
    return str(result)[0]

def f4(a, b, c):

    result=a+b+c
    if result<0:
        result*=(-1)
    return str(result)[-1]

def main():
    data=input().split()
    s1= int(data[0])
    s2=int(data[1])
    a=int(data[2])
    b=int(data[3])
    c=int(data[4])
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print("Error")


exec(input().strip()) # DON'T remove this line
# 1640749, 2022-09-24 10:06:08, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    digits=[a,b,c]
    mins=10000000
    for i in range(len(digits)):
        if digits[i]>0 and digits[i]<mins==int(mins):
            mins=digits[i]
    return mins
def f2(a, b, c):

    digits=[a,b,c]
    maxs=-9999999999
    for i in range(len(digits)):
        if digits[i]<0 and digits[i]>maxs and maxs==int(maxs):#####
            maxs=digits[i]
    return maxs
    
def f3(a, b, c):

    result=a+b+c
    if result<0:
        result*=(-1)
    result=str(result)[0]
    return int(result)

def f4(a, b, c):

    result=a+b+c
    if result<0:
        result*=(-1)
    result= str(result)[-1]
    return int(result)

def main():
    data=input().split()
    s1= int(data[0])
    s2=int(data[1])
    a=int(data[2])
    b=int(data[3])
    c=int(data[4])
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print("Error")


exec(input().strip()) # DON'T remove this line

6531314921
# 1640436, 2022-09-24 09:57:50, PP--[--][P-P-] (33%)

def f1(a, b, c):
    d = []
    if int(a) > 0:
        d.append(a)
    if int(b) > 0:
        d.append(b)
    if int(c) > 0:
        d.append(c)
    return (min(d))


def f2(a, b, c):
    d = []
    if int(a) < 0:
        d.append(a)
    if int(b) < 0:
        d.append(b)
    if int(c) < 0:
        d.append(c)
    return (max(d))


def f3(a, b, c):
    f = a+b+c
    f = str(f)
    if f[0] == '-':
        return (f[1])
    else:
        return (f[0])


def f4(a, b, c):
    e = a+b+c
    print(e)
    e = str(e)
    return (e[-1])


def main():
    h = input().split()
    s1, s2, a, b, c = h
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip())
# 1640584, 2022-09-24 10:01:47, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    d = []
    if int(a) > 0:
        d.append(a)
    if int(b) > 0:
        d.append(b)
    if int(c) > 0:
        d.append(c)
    return (min(d))


def f2(a, b, c):
    d = []
    if int(a) < 0:
        d.append(a)
    if int(b) < 0:
        d.append(b)
    if int(c) < 0:
        d.append(c)
    return (max(d))


def f3(a, b, c):
    f = a+b+c
    f = str(f)
    if f[0] == '-':
        return (f[1])
    else:
        return (f[0])


def f4(a, b, c):
    e = a+b+c
    e = str(e)
    return (e[-1])


def main():
    s1, s2, a, b, c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())

# 1640705, 2022-09-24 10:05:02, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    d = []
    if int(a) > 0:
        d.append(a)
    if int(b) > 0:
        d.append(b)
    if int(c) > 0:
        d.append(c)
    return (min(d))


def f2(a, b, c):
    d = []
    if int(a) < 0:
        d.append(a)
    if int(b) < 0:
        d.append(b)
    if int(c) < 0:
        d.append(c)
    return (max(d))


def f3(a, b, c):
    return(str(a+b+c).replace('-','')[0])


def f4(a, b, c):
    return(str(a+b+c)[-1])


def main():
    s1, s2, a, b, c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())

# 1640753, 2022-09-24 10:06:12, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    d = []
    if int(a) > 0:
        d.append(a)
    if int(b) > 0:
        d.append(b)
    if int(c) > 0:
        d.append(c)
    return (min(d))


def f2(a, b, c):
    d = []
    if int(a) < 0:
        d.append(a)
    if int(b) < 0:
        d.append(b)
    if int(c) < 0:
        d.append(c)
    return (max(d))


def f3(a, b, c):
    return(int(str(a+b+c).replace('-','')[0]))


def f4(a, b, c):
    return(int(str(a+b+c)[-1]))


def main():
    s1, s2, a, b, c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())

6531331521
# 1639215, 2022-09-24 09:24:46, PPx-[PP][P-PP] (50%)

def f1(a, b, c):
    x = [a, b, c]
    y = list()
    for e in x:
        if e > 0:
            y.append(e)
    y.sort()
    if len(y) > 0:
        return y[0]


def f2(a, b, c):
    x = [a, b, c]
    y = list()
    for e in x:
        if e < 0:
            y.append(e)
    y.sort()
    if len(y) > 0:
        return y[-1]


def f3(a, b, c):
    s = str(a+b+c)
    return s[1]


def f4(a, b, c):
    s = str(a+b+c)
    return s[-1]


def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0:
        if s2 == 0:
            print(f1(a, b, c))
        elif s2 == 1:
            print(f2(a, b, c))
        else:
            print('Error')
    elif s1 == 1:
        if s2 == 0:
            print(f3(a, b, c))
        elif s2 == 1:
            print(f4(a, b, c))
        else:
            print('Error')
    else:
        print('Error')


exec(input().strip())
# 1639342, 2022-09-24 09:28:02, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x = [a, b, c]
    y = list()
    for e in x:
        if e > 0:
            y.append(e)
    y.sort()
    if len(y) > 0:
        return y[0]


def f2(a, b, c):
    x = [a, b, c]
    y = list()
    for e in x:
        if e < 0:
            y.append(e)
    y.sort()
    if len(y) > 0:
        return y[-1]


def f3(a, b, c):
    s = a+b+c
    if s < 0:
        return str(s)[1]
    else:
        return str(s)[0]


def f4(a, b, c):
    s = str(a+b+c)
    return s[-1]


def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0:
        if s2 == 0:
            print(f1(a, b, c))
        elif s2 == 1:
            print(f2(a, b, c))
        else:
            print('Error')
    elif s1 == 1:
        if s2 == 0:
            print(f3(a, b, c))
        elif s2 == 1:
            print(f4(a, b, c))
        else:
            print('Error')
    else:
        print('Error')


exec(input().strip())
# 1640359, 2022-09-24 09:55:34, PPP-[PP][PPPP] (83%)

def f1(a, b, c):
    x = [a, b, c]
    y = list()
    for e in x:
        if e > 0:
            y.append(e)
    y.sort()
    if len(y) > 0:
        return y[0]


def f2(a, b, c):
    x = [a, b, c]
    y = list()
    for e in x:
        if e < 0:
            y.append(e)
    y.sort()
    if len(y) > 0:
        return y[-1]


def f3(a, b, c):
    s = a+b+c
    if s < 0:
        return int(str(s)[1])
    else:
        return int(str(s)[0])


def f4(a, b, c):
    s = str(a+b+c)
    return s[-1]


def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0:
        if s2 == 0:
            print(f1(a, b, c))
        elif s2 == 1:
            print(f2(a, b, c))
        else:
            print('Error')
    elif s1 == 1:
        if s2 == 0:
            print(f3(a, b, c))
        elif s2 == 1:
            print(f4(a, b, c))
        else:
            print('Error')
    else:
        print('Error')


exec(input().strip())
# 1640377, 2022-09-24 09:56:03, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    x = [a, b, c]
    y = list()
    for e in x:
        if e > 0:
            y.append(e)
    y.sort()
    if len(y) > 0:
        return y[0]


def f2(a, b, c):
    x = [a, b, c]
    y = list()
    for e in x:
        if e < 0:
            y.append(e)
    y.sort()
    if len(y) > 0:
        return y[-1]


def f3(a, b, c):
    s = a+b+c
    if s < 0:
        return int(str(s)[1])
    else:
        return int(str(s)[0])


def f4(a, b, c):
    s = str(a+b+c)
    return int(s[-1])


def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0:
        if s2 == 0:
            print(f1(a, b, c))
        elif s2 == 1:
            print(f2(a, b, c))
        else:
            print('Error')
    elif s1 == 1:
        if s2 == 0:
            print(f3(a, b, c))
        elif s2 == 1:
            print(f4(a, b, c))
        else:
            print('Error')
    else:
        print('Error')


exec(input().strip())

6531347621
# 1639389, 2022-09-24 09:29:12, xP--[xP][PPP-] (17%)

def f1(a, b, c):
    n = [a,b,c]
    res = n[2]
    n.sort()
    for i in range(1,len(n)+1):
        if n[i] > 0 and (n[i] < n[i-1]):
            res = n[i]
    return res

def f2(a, b, c):
    n = [a,b,c]
    rlist = []
    n.sort()
    for i in range(len(n)):
        if n[i] < 0:
            rlist.append(n[i])
    return rlist[-1]

def f3(a, b, c):
    total = str((a+ b +c)%10000)
    return int(total[0])

def f4(a, b, c):
    total = (a+ b +c)%10000
    return (total%10)


def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")




exec(input().strip()) # DON'T remove this line

# 1639443, 2022-09-24 09:30:29, PP--[PP][PPP-] (50%)

def f1(a, b, c):
    n = [a,b,c]
    rlist = []
    n.sort()
    for i in range(len(n)):
        if n[i] > 0:
            rlist.append(n[i])
    return rlist[0]

def f2(a, b, c):
    n = [a,b,c]
    rlist = []
    n.sort()
    for i in range(len(n)):
        if n[i] < 0:
            rlist.append(n[i])
    return rlist[-1]

def f3(a, b, c):
    total = str((a+ b +c)%10000)
    return int(total[0])

def f4(a, b, c):
    total = (a+ b +c)%10000
    return (total%10)


def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")




exec(input().strip()) # DON'T remove this line

# 1639589, 2022-09-24 09:34:12, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    n = [a,b,c]
    rlist = []
    n.sort()
    for i in range(len(n)):
        if n[i] > 0:
            rlist.append(n[i])
    return rlist[0]

def f2(a, b, c):
    n = [a,b,c]
    rlist = []
    n.sort()
    for i in range(len(n)):
        if n[i] < 0:
            rlist.append(n[i])
    return rlist[-1]

def f3(a, b, c):
    total = str(abs(a+ b +c))
    return int(total[0])

def f4(a, b, c):
    total = abs((a+ b +c))
    return (total%10)


def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")




exec(input().strip()) # DON'T remove this line

# 1640154, 2022-09-24 09:49:46, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    n = [a,b,c]
    rlist = []
    n.sort()
    for i in range(len(n)):
        if n[i] > 0:
            rlist.append(n[i])
    return rlist[0]
def f2(a, b, c):
    n = [a,b,c]
    rlist = []
    n.sort()
    for i in range(len(n)):
        if n[i] < 0:
            rlist.append(n[i])
    return rlist[-1]
def f3(a, b, c):
    total = str(abs(a+ b +c))
    return int(total[0])
def f4(a, b, c):
    total = abs((a+ b +c))
    return (total%10)
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

6532043021
# 1639145, 2022-09-24 09:23:11, PPPP[PP][-P-P] (83%)

def f1(a, b, c):
    if(a<=0):
        a = 1001
    if(b<=0):
        b = 1001
    if(c<=0):
        c = 1001
    return min(a,b,c)

def f2(a, b, c):
    if(a>=0):
        a = -1001
    if(b>=0):
        b = -1001
    if(c>=0):
        c = -1001
    return max(a,b,c)

def f3(a, b, c):
    a=a+b+c
    if(a<0):
        a*=-1
    while(a//10!=0):
        a=a//10
    return a

def f4(a, b, c):
    a=a+b+c
    if(a<0):
        a*=-1
    return a%10

def main():
    s1,s2,a,b,c = input().split()
    s1=int(s1)
    s2=int(s2)
    a = int(a)
    b = int(b)
    c = int(c)
    if not (s1 or s2):
        print(f1(a, b, c))
    if((not s1) and s2):
        print(f2(a, b, c))
    if((not s2) and s1):
        print(f3(a, b, c))
    if(s1 and s2):
        print(f4(a, b, c))


exec(input().strip())
# 1639690, 2022-09-24 09:36:46, PPPP[--][P-P-] (67%)

def f1(a, b, c):
    if(a<=0):
        a = 1001
    if(b<=0):
        b = 1001
    if(c<=0):
        c = 1001
    return min(a,b,c)

def f2(a, b, c):
    if(a>=0):
        a = -1001
    if(b>=0):
        b = -1001
    if(c>=0):
        c = -1001
    return max(a,b,c)

def f3(a, b, c):
    a=a+b+c
    if(a<0):
        a*=-1
    while(a//10!=0):
        a=a//10
    return a

def f4(a, b, c):
    a=a+b+c
    if(a<0):
        a*=-1
    return a%10

def main():
    s1,s2,a,b,c = input().split()
    s1=int(s1)
    s2=int(s2)
    a = int(a)
    b = int(b)
    c = int(c)

    if((s1!=1 or s1!=0) or (s2!=1 or s2!=0)):
        print("Error")
    elif not (s1 or s2):
        print(f1(a, b, c))
    elif((not s1) and s2):
        print(f2(a, b, c))
    elif((not s2) and s1):
        print(f3(a, b, c))
    elif(s1 and s2):
        print(f4(a, b, c))
    


exec(input().strip())
# 1639762, 2022-09-24 09:38:46, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    if(a<=0):
        a = 1001
    if(b<=0):
        b = 1001
    if(c<=0):
        c = 1001
    return min(a,b,c)

def f2(a, b, c):
    if(a>=0):
        a = -1001
    if(b>=0):
        b = -1001
    if(c>=0):
        c = -1001
    return max(a,b,c)

def f3(a, b, c):
    a=a+b+c
    if(a<0):
        a*=-1
    while(a//10!=0):
        a=a//10
    return a

def f4(a, b, c):
    a=a+b+c
    if(a<0):
        a*=-1
    return a%10

def main():
    s1,s2,a,b,c = input().split()
    s1=int(s1)
    s2=int(s2)
    a = int(a)
    b = int(b)
    c = int(c)

    if((s1<0 or s1>1) or (s2<0 or s2>1)):
        print("Error")
    elif not (s1 or s2):
        print(f1(a, b, c))
    elif((not s1) and s2):
        print(f2(a, b, c))
    elif((not s2) and s1):
        print(f3(a, b, c))
    elif(s1 and s2):
        print(f4(a, b, c))
    


exec(input().strip())
# 1639901, 2022-09-24 09:42:27, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    if(a<=0):
        a = 1001
    if(b<=0):
        b = 1001
    if(c<=0):
        c = 1001
    return min(a,b,c)

def f2(a, b, c):
    if(a>=0):
        a = -1001
    if(b>=0):
        b = -1001
    if(c>=0):
        c = -1001
    return max(a,b,c)

def f3(a, b, c):
    a=a+b+c
    if(a<0):
        a*=-1
    while(a//10!=0):
        a=a//10
    return a

def f4(a, b, c):
    a=a+b+c
    if(a<0):
        a*=-1
    return a%10

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if((s1<0 or s1>1) or (s2<0 or s2>1)):
        print("Error")
    elif not (s1 or s2):
        print(f1(a, b, c))
    elif((not s1) and s2):
        print(f2(a, b, c))
    elif((not s2) and s1):
        print(f3(a, b, c))
    elif(s1 and s2):
        print(f4(a, b, c))
    


exec(input().strip())

6532123521
# 1639164, 2022-09-24 09:23:35, --PP[PP][P-P-] (50%)

# type: ignore
def f1(a, b, c):
    if(a < 0):
        return b if b <= c else c
    elif(b < 0):
        return a if a <= c else c
    elif(c < 0):
        return a if a <= b else b


def f2(a, b, c):
    if(a > 0):
        return b if b >= c else c
    elif(b > 0):
        return a if a >= c else c
    elif(c > 0):
        return a if a >= b else b


def f3(a, b, c):
    d = str(a + b + c)
    return int(d[0] if d[0] != '-' else d[1])


def f4(a, b, c):
    return int(str(a + b + c)[-1])


def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if(s1 not in [0, 1] or s2 not in [0, 1]):
        print('Error')
        return
    if s1:
        if s2:
            print(f4(a, b, c))
        else:
            print(f4(a, b, c))
    else:
        if s2:
            print(f2(a, b, c))
        else:
            print(f1(a, b, c))


exec(input().strip())  # DON'T remove this line

# 1639279, 2022-09-24 09:26:09, PPPP[PP][P-P-] (83%)

# type: ignore
def f1(a, b, c):
    return min([e for e in [a, b, c] if e > 0])


def f2(a, b, c):
    return max([e for e in [a, b, c] if e < 0])


def f3(a, b, c):
    d = str(a + b + c)
    return int(d[0] if d[0] != '-' else d[1])


def f4(a, b, c):
    return int(str(a + b + c)[-1])


def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if(s1 not in [0, 1] or s2 not in [0, 1]):
        print('Error')
        return
    if s1:
        if s2:
            print(f4(a, b, c))
        else:
            print(f4(a, b, c))
    else:
        if s2:
            print(f2(a, b, c))
        else:
            print(f1(a, b, c))


exec(input().strip())  # DON'T remove this line

# 1639326, 2022-09-24 09:27:27, PPPP[PP][P-P-] (83%)

# type: ignore
def f1(a, b, c):
    return min([e for e in [a, b, c] if e > 0])


def f2(a, b, c):
    return max([e for e in [a, b, c] if e < 0])


def f3(a, b, c):
    return int(str(abs(a + b + c))[0])


def f4(a, b, c):
    return int(str(abs(a + b + c))[-1])


def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if(not(s1 in [0, 1] and s2 in [0, 1])):
        print('Error')
        return
    if s1:
        if s2:
            print(f4(a, b, c))
        else:
            print(f4(a, b, c))
    else:
        if s2:
            print(f2(a, b, c))
        else:
            print(f1(a, b, c))


exec(input().strip())  # DON'T remove this line

# 1640117, 2022-09-24 09:48:51, PPPP[PP][PPPP] (100%)

# type: ignore
def f1(a, b, c):
    return min([e for e in [a, b, c] if e > 0])


def f2(a, b, c):
    return max([e for e in [a, b, c] if e < 0])


def f3(a, b, c):
    return int(str(abs(a + b + c))[0])


def f4(a, b, c):
    return int(str(abs(a + b + c))[-1])


def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if(not(s1 in [0, 1] and s2 in [0, 1])):
        print('Error')
        return
    if s1:
        if s2:
            print(f4(a, b, c))
        else:
            print(f3(a, b, c))
    else:
        if s2:
            print(f2(a, b, c))
        else:
            print(f1(a, b, c))


exec(input().strip())  # DON'T remove this line


6532142421
# 1640621, 2022-09-24 10:02:42, --xP[--][PPPx] (17%)

#a,b,c = +,-,+0-
def f1(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่าน้อยท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    return min(a,b,c)
    
def f2(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    return max(a,b,c)

def f3(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเคร่ืองหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
    return int(str(a+b+c)[0])

def f4(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    return int(str(a+b+c)[-1])

def main():
# รับข้อมูลจากคีย์บอร์ดเป็นจํานวนเต็ม 5 จํานวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกําหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c) # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c) # ถ้าs1 หรือs2 เป็นค่าอ่ืนให้แสดงคําว่าError
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

exec(input().strip()) # DON'T remove this line
# 1640714, 2022-09-24 10:05:18, --PP[--][PPPP] (50%)

#a,b,c = +,-,+0-
def f1(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่าน้อยท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    return min(a,b,c)
    
def f2(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    return max(a,b,c)

def f3(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเคร่ืองหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
    sum = a+b+c
    if sum < 0:
        return int(str(sum)[1])
    return int(str(sum)[0])

def f4(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    return int(str(a+b+c)[-1])

def main():
# รับข้อมูลจากคีย์บอร์ดเป็นจํานวนเต็ม 5 จํานวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกําหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c) # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c) # ถ้าs1 หรือs2 เป็นค่าอ่ืนให้แสดงคําว่าError
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

exec(input().strip()) # DON'T remove this line
# 1640920, 2022-09-24 10:10:24, P-PP[P-][PPPP] (67%)

#a,b,c = +,-,+0-
def f1(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่าน้อยท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    l = [a,b,c]
    l2 = []
    for i in l:
        if i > 0:
            l2.append(i)
    return min(l2)
    
def f2(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    l = [a,b,c]
    l2 = []
    for i in l:
        if i < 0:
            l2.append(i)
    return min(l2)

def f3(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเคร่ืองหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
    sum = a+b+c
    if sum < 0:
        return int(str(sum)[1])
    return int(str(sum)[0])

def f4(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    return int(str(a+b+c)[-1])

def main():
# รับข้อมูลจากคีย์บอร์ดเป็นจํานวนเต็ม 5 จํานวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกําหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c) # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c) # ถ้าs1 หรือs2 เป็นค่าอ่ืนให้แสดงคําว่าError
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

exec(input().strip()) # DON'T remove this line
# 1641005, 2022-09-24 10:12:43, PPPP[PP][PPPP] (100%)

#a,b,c = +,-,+0-
def f1(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่าน้อยท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    l = [a,b,c]
    l2 = []
    for i in l:
        if i > 0:
            l2.append(i)
    return min(l2)
    
def f2(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    l = [a,b,c]
    l2 = []
    for i in l:
        if i < 0:
            l2.append(i)
    return max(l2)

def f3(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเคร่ืองหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
    sum = a+b+c
    if sum < 0:
        return int(str(sum)[1])
    return int(str(sum)[0])

def f4(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    return int(str(a+b+c)[-1])

def main():
# รับข้อมูลจากคีย์บอร์ดเป็นจํานวนเต็ม 5 จํานวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกําหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c) # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c) # ถ้าs1 หรือs2 เป็นค่าอ่ืนให้แสดงคําว่าError
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

exec(input().strip()) # DON'T remove this line

6532182521
# 1639128, 2022-09-24 09:22:46, ----[PP][PPPP] (33%)

from ftplib import B_CRLF


def f1(a, b, c):
    L = [a, b, c]
    mn = None
    for e in L:
        if mn == None or (e > 0 and e < mn):
            mn = e
    return mn


def f2(a, b, c):
    L = [a, b, c]
    mx = None
    for e in L:
        if mx == None or (e < 0 and e > mx):
            mx = e
    return mx


def f3(a, b, c):
    return str(abs(a+b+c))[0]


def f4(a, b, c):
    return str(abs(a+b+c))[-1]


def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')


exec(input().strip())  # DON'T remove this line

# 1639208, 2022-09-24 09:24:36, ----[PP][PPPP] (33%)

def f1(a, b, c):
    L = [a, b, c]
    mn = None
    for e in L:
        if mn == None or (e > 0 and e < mn):
            mn = e
    return int(mn)


def f2(a, b, c):
    L = [a, b, c]
    mx = None
    for e in L:
        if mx == None or (e < 0 and e > mx):
            mx = e
    return int(mx)


def f3(a, b, c):
    return str(abs(a+b+c))[0]


def f4(a, b, c):
    return str(abs(a+b+c))[-1]


def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')


exec(input().strip())  # DON'T remove this line

# 1639274, 2022-09-24 09:26:03, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    L = [a, b, c]
    mn = None
    for e in L:
        if mn == None or (e > 0 and e < mn):
            mn = e
    return int(mn)


def f2(a, b, c):
    L = [a, b, c]
    mx = None
    for e in L:
        if mx == None or (e < 0 and e > mx):
            mx = e
    return int(mx)


def f3(a, b, c):
    return int(str(abs(a+b+c))[0])


def f4(a, b, c):
    return int(str(abs(a+b+c))[-1])


def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')


exec(input().strip())  # DON'T remove this line

# 1639308, 2022-09-24 09:27:09, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    L = [a, b, c]
    mn = max(a, b, c)
    for e in L:
        if (e > 0 and e < mn):
            mn = e
    return int(mn)


def f2(a, b, c):
    L = [a, b, c]
    mx = min(a, b, c)
    for e in L:
        if (e < 0 and e > mx):
            mx = e
    return int(mx)


def f3(a, b, c):
    return int(str(abs(a+b+c))[0])


def f4(a, b, c):
    return int(str(abs(a+b+c))[-1])


def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')


exec(input().strip())  # DON'T remove this line


6531020321
# 1639432, 2022-09-24 09:30:19, PP-P[PP][PPPP] (83%)

def f1(a,b,c):
    x = []
    for e in [a,b,c]:
        if int(e)>0:
            x.append(e)
    return min(x)

def f2(a,b,c):
    x = []
    for e in [a,b,c]:
        if int(e)<0:
            x.append(e)
    return max(x)

def f3(a,b,c):
    sumn = int(a)+int(b)+int(c)
    a = str(abs(sumn))
    return a[0]

def f4(a,b,c):
    sumn = abs(int(a)+int(b)+int(c))
    return sumn%10

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0==s2:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1==s2:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())

# 1639467, 2022-09-24 09:31:11, PP-P[PP][PPPP] (83%)

def f1(a,b,c):
    x = []
    for e in [a,b,c]:
        if int(e)>0:
            x.append(int(e))
    return min(x)

def f2(a,b,c):
    x = []
    for e in [a,b,c]:
        if int(e)<0:
            x.append(e)
    return max(x)

def f3(a,b,c):
    sumn = int(a)+int(b)+int(c)
    a = str(abs(sumn))
    return a[0]

def f4(a,b,c):
    sumn = abs(int(a)+int(b)+int(c))
    return sumn%10

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0==s2:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1==s2:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())
# 1640784, 2022-09-24 10:06:53, PP-P[PP][PPPP] (83%)

def f1(a,b,c):
    x = []
    for e in [a,b,c]:
        if int(e)>0:
            x.append(int(e))
    return min(x)

def f2(a,b,c):
    x = []
    for e in [a,b,c]:
        if int(e)<0:
            x.append(int(e))
    return max(x)

def f3(a,b,c):
    sumn = int(a)+int(b)+int(c)
    a = str(abs(sumn))
    return a[0]

def f4(a,b,c):
    sumn = abs(int(a)+int(b)+int(c))
    return sumn%10

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0==s2:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1==s2:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())

# 1640805, 2022-09-24 10:07:37, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    x = []
    for e in [a,b,c]:
        if int(e)>0:
            x.append(int(e))
    return min(x)

def f2(a,b,c):
    x = []
    for e in [a,b,c]:
        if int(e)<0:
            x.append(int(e))
    return max(x)

def f3(a,b,c):
    sumn = int(a)+int(b)+int(c)
    a = str(abs(sumn))
    return int(a[0])

def f4(a,b,c):
    sumn = abs(int(a)+int(b)+int(c))
    return int(sumn%10)

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0==s2:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1==s2:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())


6531804021
# 1639966, 2022-09-24 09:44:14, --PP[-P][PPPP] (50%)

def f1(a, b, c):
    x=[a,b,c]
    find_min=sorted(x)
    ans=int(x[0])
    if ans<0:
        ans=int(x[1])
        if ans<0:
            ans=int(x[2])
        else:
            ans=int(x[1])
    elif ans>0:
        ans=ans
    return ans    

def f2(a, b, c):
    x=[a,b,c]
    find_max=sorted(x)
    ans=int(x[2])
    if ans>0:
        ans=int(x[1])
        if ans>0:
            ans=int(x[0])
        else:
            ans=int(x[1])
    elif ans<0:
        ans=ans
    return ans

def f3(a, b, c):
    sum=a+b+c
    str_sum=str(sum)
    if str_sum[0]=="-":
        ans=int(str_sum[1])
    else:
        ans=int(str_sum[0])
    return ans

def f4(a, b, c):
    sum=a+b+c
    str_sum=str(sum)
    ans=int(str_sum[len(str_sum)-1])
    return ans

def main():
    x=input().split()
    s1=int(x[0])
    s2=int(x[1])
    a=int(x[2])
    b=int(x[3])
    c=int(x[4])
    if s1==s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==s2==1:
        print(f4(a,b,c))
    else:
        print("Error")
        
            
exec(input().strip()) # DON'T remove this line 
# 1641524, 2022-09-24 10:24:11, --PP[-P][PPPP] (50%)

def f1(a, b, c):
    x=[a,b,c]
    find_min=sorted(x)
    ans=int(x[0])
    if ans<0:
        ans=int(x[1])
        if ans<0:
            ans=int(x[2])
        else:
            ans=int(x[1])
    elif ans>0:
        ans=ans
    return ans    

def f2(a, b, c):
    x=[a,b,c]
    find_max=sorted(x)
    ans=int(x[2])
    if ans>0:
        ans=int(x[1])
        if ans>0:
            ans=int(x[0])
        else:
            ans=int(x[1])
    elif ans<0:
        ans=ans
    return ans

def f3(a, b, c):
    sum=a+b+c
    str_sum=str(sum)
    if str_sum[0]=="-":
        ans=int(str_sum[1])
    else:
        ans=int(str_sum[0])
    return ans

def f4(a, b, c):
    sum=a+b+c
    str_sum=str(sum)
    ans=int(str_sum[len(str_sum)-1])
    return ans

def main():
    x=input().split()
    s1=int(x[0])
    s2=int(x[1])
    a=int(x[2])
    b=int(x[3])
    c=int(x[4])
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print("Error")
        
            
exec(input().strip()) # DON'T remove this line
# 1641840, 2022-09-24 10:29:49, --PP[-P][PPPP] (50%)

def f1(a, b, c):
    x=[a,b,c]
    find_min=sorted(x)
    ans=int(x[0])
    if ans<=0:
        ans=int(x[1])
        if ans<=0:
            ans=int(x[2])
        else:
            ans=int(x[1])
    elif ans>0:
        ans=ans
    return ans    

def f2(a, b, c):
    x=[a,b,c]
    find_max=sorted(x)
    ans=int(x[2])
    if ans>=0:
        ans=int(x[1])
        if ans>=0:
            ans=int(x[0])
        else:
            ans=int(x[1])
    elif ans<0:
        ans=ans
    return ans

def f3(a, b, c):
    sum=a+b+c
    str_sum=str(sum)
    if str_sum[0]=="-":
        ans=int(str_sum[1])
    else:
        ans=int(str_sum[0])
    return ans

def f4(a, b, c):
    sum=a+b+c
    str_sum=str(sum)
    ans=int(str_sum[len(str_sum)-1])
    return ans

def main():
    x=input().split()
    s1=int(x[0])
    s2=int(x[1])
    a=int(x[2])
    b=int(x[3])
    c=int(x[4])
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print("Error")
        
            
exec(input().strip()) # DON'T remove this line        
# 1642251, 2022-09-24 10:36:29, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    x=[a,b,c]
    find_min=sorted(x)
    ans=int(find_min[0])
    if ans<=0:
        ans=int(find_min[1])
        if ans<=0:
            ans=int(find_min[2])
        else:
            ans=int(find_min[1])
    elif ans>0:
        ans=ans
    return ans    

def f2(a, b, c):
    x=[a,b,c]
    find_max=sorted(x)
    ans=int(find_max[2])
    if ans>=0:
        ans=int(find_max[1])
        if ans>=0:
            ans=int(find_max[0])
        else:
            ans=int(find_max[1])
    elif ans<0:
        ans=ans
    return ans

def f3(a, b, c):
    sum=a+b+c
    str_sum=str(sum)
    if str_sum[0]=="-":
        ans=int(str_sum[1])
    else:
        ans=int(str_sum[0])
    return ans

def f4(a, b, c):
    sum=a+b+c
    str_sum=str(sum)
    ans=int(str_sum[len(str_sum)-1])
    return ans

def main():
    x=input().split()
    s1=int(x[0])
    s2=int(x[1])
    a=int(x[2])
    b=int(x[3])
    c=int(x[4])
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print("Error")
        
            
exec(input().strip()) # DON'T remove this line        

6430224821
# 1639755, 2022-09-24 09:38:35, PP--[--][P-P-] (33%)

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกําหนดข้างบน
    # คืนจํานวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    x = [a,b,c]
    y = []
    for i in x:
        if i > 0:
            y.append(i)
    y.sort()
    return int(y[0])
        
def f2(a, b, c):
    # a, b และ c มีค่าตามข้อกําหนดข้างบน
    # คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    x = [a,b,c]
    y = []
    for i in x:
        if i < 0:
            y.append(i)
    y.sort()
    return int(y[-1])
def f3(a, b, c):
    # a, b และ c มีค่าตามข้อกําหนดข้างบน
    # คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
    x = abs(a+b+c)
    y = str(x)
    z = y[0]
    return z
def f4(a, b, c):
    # a, b และ c มีค่าตามข้อกําหนดข้างบน
    # คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    x = abs(a+b+c)
    y = str(x)
    z = y[-1]
    return z
def main():
    # รับข้อมูลจากคีย์บอร์ดเป็นจํานวนเต็ม 5 จํานวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
    # ค่าของ a, b และ c เป็นไปตามข้อกําหนดข้างบน
    # ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
    # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
    # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
    # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
    # ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคําว่า Error
    es = input().split()
    s1 = int(es[0])
    s2 = int(es[1])
    a = int(es[2])
    b = int(es[3])
    c = int(es[4])
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else :
        print('Error')





exec(input().strip()) # DON'T remove this line


# 1639806, 2022-09-24 09:40:00, PPPP[--][P-P-] (67%)

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกําหนดข้างบน
    # คืนจํานวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    x = [a,b,c]
    y = []
    for i in x:
        if i > 0:
            y.append(i)
    y.sort()
    return int(y[0])
        
def f2(a, b, c):
    # a, b และ c มีค่าตามข้อกําหนดข้างบน
    # คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    x = [a,b,c]
    y = []
    for i in x:
        if i < 0:
            y.append(i)
    y.sort()
    return int(y[-1])
def f3(a, b, c):
    # a, b และ c มีค่าตามข้อกําหนดข้างบน
    # คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
    x = abs(a+b+c)
    y = str(x)
    z = int(y[0])
    return z
def f4(a, b, c):
    # a, b และ c มีค่าตามข้อกําหนดข้างบน
    # คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    x = abs(a+b+c)
    y = str(x)
    z = int(y[-1])
    return z
def main():
    # รับข้อมูลจากคีย์บอร์ดเป็นจํานวนเต็ม 5 จํานวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
    # ค่าของ a, b และ c เป็นไปตามข้อกําหนดข้างบน
    # ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
    # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
    # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
    # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
    # ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคําว่า Error
    es = input().split()
    s1 = int(es[0])
    s2 = int(es[1])
    a = int(es[2])
    b = int(es[3])
    c = int(es[4])
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else :
        print('Error')





exec(input().strip()) # DON'T remove this line


# 1642304, 2022-09-24 10:37:10, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกําหนดข้างบน
    # คืนจํานวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    x = [a,b,c]
    y = []
    for i in x:
        if i > 0:
            y.append(i)
    y.sort()
    return int(y[0])
        
def f2(a, b, c):
    # a, b และ c มีค่าตามข้อกําหนดข้างบน
    # คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    x = [a,b,c]
    y = []
    for i in x:
        if i < 0:
            y.append(i)
    y.sort()
    return int(y[-1])
def f3(a, b, c):
    # a, b และ c มีค่าตามข้อกําหนดข้างบน
    # คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
    x = abs(a+b+c)
    y = str(x)
    z = int(y[0])
    return z
def f4(a, b, c):
    # a, b และ c มีค่าตามข้อกําหนดข้างบน
    # คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    x = abs(a+b+c)
    y = str(x)
    z = int(y[-1])
    return z
def main():
    # รับข้อมูลจากคีย์บอร์ดเป็นจํานวนเต็ม 5 จํานวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
    # ค่าของ a, b และ c เป็นไปตามข้อกําหนดข้างบน
    # ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
    # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
    # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
    # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
    # ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคําว่า Error
    es = input().split()
    s1 = int(es[0])
    s2 = int(es[1])
    a = int(es[2])
    b = int(es[3])
    c = int(es[4])
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else :
        print('Error')





exec(input().strip()) # DON'T remove this line

6530017321
# 1640676, 2022-09-24 10:04:11, P-PP[P-][PxPx] (50%)


def f1(a, b, c):
    s=[]
    if int(a)>0:
        s.append(int(a))
    if int(b)>0:
        s.append(int(b))
    if int(c)>0:
        s.append(int(c))
    return int(min(s))

def f2(a, b, c):
    s=[]
    if int(a)<0:
        s.append(int(a))
    if int(b)<0:
        s.append(int(b))
    if int(c)<0:
        s.append(int(c))
    return int(min(s))    
    
    
def f3(a, b, c):
    ans = 0
    s=[a,b,c]
    ans=sum(s)
    if ans<0:
        ans=ans*-1
    ans=str(ans)
    return int(ans[0])
  
def f4(a, b, c):
    ans = 0
    s=[int(a),int(b),int(c)]
    ans=sum(s)
    if ans<0:
        ans=ans*-1
    ans=str(ans)
    return int(ans[-1])    
     

def main():
    s1,s2,a,b,c=input().split()
    if not s1 in ('0','1'):
        print('Error')
    elif not s2 in ('0','1'):
        print('Error')
    if (s1,s2) == ('0','0'):
        print(f1(a,b,c))
    if (s1,s2) == ('0','1'):
        print(f2(a,b,c))    
    if (s1,s2) == ('1','0'):
        print(f3(a,b,c)) 
    if (s1,s2) == ('1','1'):
        print(f4(a,b,c)) 
 
exec(input().strip()) # DON'T remove this line


# 1640937, 2022-09-24 10:10:48, PPPP[PP][PxPx] (83%)


def f1(a, b, c):
    s=[]
    if int(a)>0:
        s.append(int(a))
    if int(b)>0:
        s.append(int(b))
    if int(c)>0:
        s.append(int(c))
    return int(min(s))

def f2(a, b, c):
    s=[]
    if int(a)<0:
        s.append(int(a))
    if int(b)<0:
        s.append(int(b))
    if int(c)<0:
        s.append(int(c))
    return int(max(s))    
    
    
def f3(a, b, c):
    ans = 0
    s=[a,b,c]
    ans=sum(s)
    if ans<0:
        ans=ans*-1
    ans=str(ans)
    return int(ans[0])
  
def f4(a, b, c):
    ans = 0
    s=[int(a),int(b),int(c)]
    ans=sum(s)
    if ans<0:
        ans=ans*-1
    ans=str(ans)
    return int(ans[-1])    
     

def main():
    s1,s2,a,b,c=input().split()
    if not s1 in ('0','1'):
        print('Error')
    elif not s2 in ('0','1'):
        print('Error')
    if (s1,s2) == ('0','0'):
        print(f1(a,b,c))
    if (s1,s2) == ('0','1'):
        print(f2(a,b,c))    
    if (s1,s2) == ('1','0'):
        print(f3(a,b,c)) 
    if (s1,s2) == ('1','1'):
        print(f4(a,b,c)) 
 
exec(input().strip()) # DON'T remove this line


# 1640972, 2022-09-24 10:11:45, PPPP[PP][PPPP] (100%)


def f1(a, b, c):
    s=[]
    if int(a)>0:
        s.append(int(a))
    if int(b)>0:
        s.append(int(b))
    if int(c)>0:
        s.append(int(c))
    return int(min(s))

def f2(a, b, c):
    s=[]
    if int(a)<0:
        s.append(int(a))
    if int(b)<0:
        s.append(int(b))
    if int(c)<0:
        s.append(int(c))
    return int(max(s))    
    
    
def f3(a, b, c):
    ans = 0
    s=[int(a),int(b),int(c)]
    ans=sum(s)
    if ans<0:
        ans=ans*-1
    ans=str(ans)
    return int(ans[0])
  
def f4(a, b, c):
    ans = 0
    s=[int(a),int(b),int(c)]
    ans=sum(s)
    if ans<0:
        ans=ans*-1
    ans=str(ans)
    return int(ans[-1])    
     

def main():
    s1,s2,a,b,c=input().split()
    if not s1 in ('0','1'):
        print('Error')
    elif not s2 in ('0','1'):
        print('Error')
    if (s1,s2) == ('0','0'):
        print(f1(a,b,c))
    if (s1,s2) == ('0','1'):
        print(f2(a,b,c))    
    if (s1,s2) == ('1','0'):
        print(f3(a,b,c)) 
    if (s1,s2) == ('1','1'):
        print(f4(a,b,c)) 
 
exec(input().strip()) # DON'T remove this line



6530023021
# 1639290, 2022-09-24 09:26:34, PP--[xx][xxxx] (33%)

def f1(a, b, c):
    x=[]
    if a > 0:
        x.append(a)
    if b > 0:
        x.append(b)
    if c > 0:
        x.append(c)
    x = min(x)
    return x

def f2(a, b, c):
    x=[]
    if a < 0:
        x.append(a)
    if b < 0:
        x.append(b)
    if c < 0:
        x.append(c)
    x = max(x)
    return x

def f3(a, b, c):
    x = a+b+c
    x = str(x)
    if "-" in x:
        return x[1]
    else:
        return x[0]

def f4(a, b, c):
    x = a+b+c
    x = str(x)
    return x[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input.split()]
    if s1==0 and s2==0:
        print (f1(a,b,c))
    elif s1==0 and s2==1:
        print (f2(a,b,c))
    elif s1==1 and s2==0:
        print (f3(a,b,c))
    elif s1==1 and s2==1:
        print (f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line
# 1639361, 2022-09-24 09:28:28, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x=[]
    if a > 0:
        x.append(a)
    if b > 0:
        x.append(b)
    if c > 0:
        x.append(c)
    x = min(x)
    return x

def f2(a, b, c):
    x=[]
    if a < 0:
        x.append(a)
    if b < 0:
        x.append(b)
    if c < 0:
        x.append(c)
    x = max(x)
    return x

def f3(a, b, c):
    x = a+b+c
    x = str(x)
    if "-" in x:
        return x[1]
    else:
        return x[0]

def f4(a, b, c):
    x = a+b+c
    x = str(x)
    return x[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print (f1(a,b,c))
    elif s1==0 and s2==1:
        print (f2(a,b,c))
    elif s1==1 and s2==0:
        print (f3(a,b,c))
    elif s1==1 and s2==1:
        print (f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line
# 1640733, 2022-09-24 10:05:46, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    x=[]
    if a > 0:
        x.append(a)
    if b > 0:
        x.append(b)
    if c > 0:
        x.append(c)
    x = min(x)
    return int(x)

def f2(a, b, c):
    x=[]
    if a < 0:
        x.append(a)
    if b < 0:
        x.append(b)
    if c < 0:
        x.append(c)
    x = max(x)
    return int(x)

def f3(a, b, c):
    x = a+b+c
    x = str(x)
    if "-" in x:
        return int(x[1])
    else:
        return int(x[0])

def f4(a, b, c):
    x = a+b+c
    x = str(x)
    return int(x[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print (f1(a,b,c))
    elif s1==0 and s2==1:
        print (f2(a,b,c))
    elif s1==1 and s2==0:
        print (f3(a,b,c))
    elif s1==1 and s2==1:
        print (f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

6530028221
# 1640422, 2022-09-24 09:57:25, P-PP[xx][xxxx] (50%)



def f1(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    x=[]
    d=[a,b,c]
    for i in range(len(d)) :
        if d[i] > 0 :
            x.append(d[i])
    return min(x)



def f2(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    x=[]
    d=[a,b,c]
    for i in range(len(d)) :
        if d[i] > 0 :
            x.append(d[i])
    return max(x)



def f3(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    x=[a,b,c]
    a=sum(x)
    if a<0 :
        a*=(-1)
    s=str(a)
    b=a//10**(len(s)-1)
    return b



def f4(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    x=[a,b,c]
    a=sum(x)
    if a<0 :
        a*=(-1)
    s=str(a)
    b=a%10
    return b




def main(s1,s2,a,b,c):
# รับข้อมูลจากคีย์บอร์ดเป็นจํานวนเต็ม 5 จํานวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกําหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
# ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
# ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคําว่า Error
    if s1==0 and s2==0 :
        return print(f1(a,b,c))
    elif s1==0 and s2==1 :
        return print(f2(a,b,c))
    elif s1==1 and s2==0 :
        return print(f3(a,b,c))
    elif s1==1 and s2==1 :
        return print(f4(a,b,c))
    else :
        return print('Error')
    




exec(input().strip()) # DON'T remove this line

# 1642033, 2022-09-24 10:33:17, P-PP[P-][PPPP] (67%)



def f1(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    x=[]
    d=[a,b,c]
    for i in range(len(d)) :
        if d[i] > 0 :
            x.append(d[i])
    return min(x)



def f2(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    x=[]
    d=[a,b,c]
    for i in range(len(d)) :
        if d[i] > 0 :
            x.append(d[i])
    return max(x)



def f3(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    x=[a,b,c]
    a=sum(x)
    if a<0 :
        a*=(-1)
    s=str(a)
    b=a//10**(len(s)-1)
    return b



def f4(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    x=[a,b,c]
    a=sum(x)
    if a<0 :
        a*=(-1)
    s=str(a)
    b=a%10
    return b




def main():
# รับข้อมูลจากคีย์บอร์ดเป็นจํานวนเต็ม 5 จํานวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกําหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
# ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
# ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคําว่า Error
    x=[int(e) for e in input().split()]
    s1=x[0]
    s2=x[1]
    a=x[2]
    b=x[3]
    c=x[4]
    if s1==0 and s2==0 :
        return print(f1(a,b,c))
    elif s1==0 and s2==1 :
        return print(f2(a,b,c))
    elif s1==1 and s2==0 :
        return print(f3(a,b,c))
    elif s1==1 and s2==1 :
        return print(f4(a,b,c))
    else :
        return print('Error')
    




exec(input().strip()) # DON'T remove this line

# 1642145, 2022-09-24 10:35:03, PPPP[PP][PPPP] (100%)



def f1(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    x=[]
    d=[a,b,c]
    for i in range(len(d)) :
        if d[i] > 0 :
            x.append(d[i])
    return min(x)



def f2(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    x=[]
    d=[a,b,c]
    for i in range(len(d)) :
        if d[i] < 0 :
            x.append(d[i])
    return max(x)



def f3(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    x=[a,b,c]
    a=sum(x)
    if a<0 :
        a*=(-1)
    s=str(a)
    b=a//10**(len(s)-1)
    return b



def f4(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    x=[a,b,c]
    a=sum(x)
    if a<0 :
        a*=(-1)
    s=str(a)
    b=a%10
    return b




def main():
# รับข้อมูลจากคีย์บอร์ดเป็นจํานวนเต็ม 5 จํานวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกําหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
# ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
# ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคําว่า Error
    x=[int(e) for e in input().split()]
    s1=x[0]
    s2=x[1]
    a=x[2]
    b=x[3]
    c=x[4]
    if s1==0 and s2==0 :
        return print(f1(a,b,c))
    elif s1==0 and s2==1 :
        return print(f2(a,b,c))
    elif s1==1 and s2==0 :
        return print(f3(a,b,c))
    elif s1==1 and s2==1 :
        return print(f4(a,b,c))
    else :
        return print('Error')
    




exec(input().strip()) # DON'T remove this line


6530057421
# 1640607, 2022-09-24 10:02:24, compilation error (0%)

def f1(a, b, c):
    r = [a,b,c]
    x = []
    y = [] 
    for i in range (len(r)):
        if r[i] > 0:
            x.append(r[i])
    for i in range(len(x)):
        if x[i] == min(x):
           y.append(x[i])
           break
    return y[0]

def f2(a, b, c):
    def f1(a, b, c):
    r = [a,b,c]
    x = []
    y = [] 
    for i in range (len(r)):
        if r[i] < 0:
            x.append(r[i])
    for i in range(len(x)):
        if x[i] == max(x):
           y.append(x[i])
           break
    return y[0]
# 1641448, 2022-09-24 10:22:28, PP-P[xx][xxxx] (50%)

def f1(a, b, c):
    r = [a,b,c]
    x = []
    y = [] 
    for i in range (len(r)):
        if r[i] > 0:
            x.append(r[i])
    for i in range(len(x)):
        if x[i] == min(x):
           y.append(x[i])
           break
    return y[0]

def f2(a, b, c):
    r = [a,b,c]
    x = []
    y = [] 
    for i in range (len(r)):
        if r[i] < 0:
            x.append(r[i])
    for i in range(len(x)):
        if x[i] == max(x):
           y.append(x[i])
           break
    return y[0]
    
def f3(a, b, c):
    r = [a,b,c]
    x = abs(sum(r))
    y = str(abs(sum(r)))
    g = x//10**(len(y)-1)%10
    
def f4(a, b, c):
    r = [a,b,c]
    x = abs(sum(r))
    g = x%10
    return g

def main():
    s1,s2,a,b,c = int(input())
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f2(a,b,c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1641646, 2022-09-24 10:26:19, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    r = [a,b,c]
    x = []
    y = [] 
    for i in range (len(r)):
        if r[i] > 0:
            x.append(r[i])
    for i in range(len(x)):
        if x[i] == min(x):
           y.append(x[i])
           break
    return y[0]

def f2(a, b, c):
    r = [a,b,c]
    x = []
    y = [] 
    for i in range (len(r)):
        if r[i] < 0:
            x.append(r[i])
    for i in range(len(x)):
        if x[i] == max(x):
           y.append(x[i])
           break
    return y[0]
    
def f3(a, b, c):
    r = [a,b,c]
    x = abs(sum(r))
    y = str(abs(sum(r)))
    g = x//10**(len(y)-1)%10
    return g
    
def f4(a, b, c):
    r = [a,b,c]
    x = abs(sum(r))
    g = x%10
    return g

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f2(a,b,c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line

6530077021
# 1639427, 2022-09-24 09:30:10, PP--[PP][P-P-] (50%)

def f1(a, b, c):
    list = []
    for i in [a,b,c]:
        if i > 0 :
            list.append(i)
    return min(list)
    

def f2(a, b, c):
    list = []
    for i in [a,b,c]:
        if i < 0 :
            list.append(i)
    return max(list)
    
def f3(a, b, c):
    x = abs(a+b+c)
    print(str(x)[0])

def f4(a, b, c):
    x = abs(a+b+c)
    print(str(x)[-1])
    

def main():
    s1,s2,a,b,c  = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else :
        print('Error')
        
    
    
exec(input().strip()) # DON'T remove this line"""

# 1639498, 2022-09-24 09:31:42, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    list = []
    for i in [a,b,c]:
        if i > 0 :
            list.append(i)
    return min(list)
    

def f2(a, b, c):
    list = []
    for i in [a,b,c]:
        if i < 0 :
            list.append(i)
    return max(list)
    
def f3(a, b, c):
    x = abs(a+b+c)
    return str(x)[0]

def f4(a, b, c):
    x = abs(a+b+c)
    return str(x)[-1]
    

def main():
    s1,s2,a,b,c  = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else :
        print('Error')
        
    
    
exec(input().strip()) # DON'T remove this line"""
# 1640138, 2022-09-24 09:49:19, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    list = []
    for i in [a,b,c]:
        if i > 0 :
            list.append(i)
    return min(list)
    

def f2(a, b, c):
    list = []
    for i in [a,b,c]:
        if i < 0 :
            list.append(i)
    return max(list)
    
def f3(a, b, c):
    x = abs(a+b+c)
    return int(str(x)[0])

def f4(a, b, c):
    x = abs(a+b+c)
    return int(str(x)[-1])
    

def main():
    s1,s2,a,b,c  = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else :
        print('Error')
        
    
    
exec(input().strip()) # DON'T remove this line"""

6530128321
# 1639155, 2022-09-24 09:23:20, xx--[PP][PPPP] (33%)

def f1(a, b, c):
    l = [a,b,c]
    if (a<=0):
        l.pop(0)
    if (b<=0):
        l.pop(1)
    if (c<=0):
        l.pop(2)
    return min(l)
    

def f2(a, b, c):
    l = [a,b,c]
    if (a>=0):
        l.pop(0)
    if (b>=0):
        l.pop(1)
    if (c>=0):
        l.pop(2)
    return max(l)

def f3(a, b, c):
    sumn = abs(a+b+c)
    sumn = str(sumn)
    return sumn[0]
def f4(a, b, c):
    sumn = abs(a+b+c)
    sumn = str(sumn)
    return sumn[-1]

def main():
    s1,s2,a,b,c = [int(k) for k in input().split()]
    if (s1 == 0 and s2 == 0):
        print(f1(a, b, c))
    elif (s1 == 0 and s2 == 1):
        print(f2(a, b, c))
    elif (s1 == 1 and s2 == 0):
        print(f3(a, b, c))
    elif (s1 == 1 and s2 == 1):
        print(f4(a, b, c))
    else:
        print("Error")
    
    
    
exec(input().strip()) # DON'T remove this line

# 1639322, 2022-09-24 09:27:25, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    l = [a,b,c]
    if (a<=0):
        l.pop(l.index(a))
    if (b<=0):
        l.pop(l.index(b))
    if (c<=0):
        l.pop(l.index(c))
    return min(l)
    

def f2(a, b, c):
    l = [a,b,c]
    if (a>=0):
        l.pop(l.index(a))
    if (b>=0):
        l.pop(l.index(b))
    if (c>=0):
        l.pop(l.index(c))
    return max(l)

def f3(a, b, c):
    sumn = abs(a+b+c)
    sumn = str(sumn)
    return sumn[0]
def f4(a, b, c):
    sumn = abs(a+b+c)
    sumn = str(sumn)
    return sumn[-1]

def main():
    s1,s2,a,b,c = [int(k) for k in input().split()]
    if (s1 == 0 and s2 == 0):
        print(f1(a, b, c))
    elif (s1 == 0 and s2 == 1):
        print(f2(a, b, c))
    elif (s1 == 1 and s2 == 0):
        print(f3(a, b, c))
    elif (s1 == 1 and s2 == 1):
        print(f4(a, b, c))
    else:
        print("Error")
    
    
    
exec(input().strip()) # DON'T remove this line

# 1640175, 2022-09-24 09:50:24, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    l = [a,b,c]
    if (a<=0):
        l.pop(l.index(a))
    if (b<=0):
        l.pop(l.index(b))
    if (c<=0):
        l.pop(l.index(c))
    return min(l)
    

def f2(a, b, c):
    l = [a,b,c]
    if (a>=0):
        l.pop(l.index(a))
    if (b>=0):
        l.pop(l.index(b))
    if (c>=0):
        l.pop(l.index(c))
    return max(l)

def f3(a, b, c):
    sumn = abs(a+b+c)
    sumn = str(sumn)
    return int(sumn[0])
def f4(a, b, c):
    sumn = abs(a+b+c)
    sumn = str(sumn)
    return int(sumn[-1])

def main():
    s1,s2,a,b,c = [int(k) for k in input().split()]
    if (s1 == 0 and s2 == 0):
        print(f1(a, b, c))
    elif (s1 == 0 and s2 == 1):
        print(f2(a, b, c))
    elif (s1 == 1 and s2 == 0):
        print(f3(a, b, c))
    elif (s1 == 1 and s2 == 1):
        print(f4(a, b, c))
    else:
        print("Error")
    
    
    
exec(input().strip()) # DON'T remove this line


6530137021
# 1639578, 2022-09-24 09:33:51, --PP[PP][PPPP] (67%)

import math
def f1(a, b, c):
    k = []
    k.append(a)
    k.append(b)
    k.append(c)
    for e in k:
        if e <= 0:
            k.remove(e)
    d = min(k)
    return d

def f2(a, b, c):
    k = []
    k.append(a)
    k.append(b)
    k.append(c)
    for e in k:
        if e >= 0:
            k.remove(e)
    d = max(k)
    return d

def f3(a, b, c):
    g = str(int(a) + int(b) + int(c))
    if g[0] == '-':
        return int(g[1])
    else:
        return int(g[0])
    
def f4(a, b, c):
    g = str(int(a) + int(b) + int(c))
    return int(g[-1])

def main():
    k = [int(e) for e in input().split()]
    if k[0] ==0 and k[1] ==0:
        print(f1(k[2],k[3],k[4]))
    elif k[0] ==0 and k[1] ==1:
        print(f2(k[2],k[3],k[4]))
    elif k[0] ==1 and k[1] ==0:
        print(f3(k[2],k[3],k[4]))
    elif k[0] ==1 and k[1] ==1:
        print(f4(k[2],k[3],k[4]))
    else:
        print('Error')
        
    
    






exec(input().strip()) # DON'T remove this line


# 1640172, 2022-09-24 09:50:22, P-PP[PP][PPPP] (83%)

import math
def f1(a, b, c):
    k = []
    k.append(a)
    k.append(b)
    k.append(c)
    d = []
    for e in k:
        if e >0:
            d.append(e)
            
    p = min(d)
    return p

def f2(a, b, c):
    k = []
    k.append(a)
    k.append(b)
    k.append(c)
    for e in k:
        if e >= 0:
            k.remove(e)
    d = max(k)
    return d

def f3(a, b, c):
    g = str(int(a) + int(b) + int(c))
    if g[0] == '-':
        return int(g[1])
    else:
        return int(g[0])
    
def f4(a, b, c):
    g = str(int(a) + int(b) + int(c))
    return int(g[-1])

def main():
    k = [int(e) for e in input().split()]
    if k[0] ==0 and k[1] ==0:
        print(f1(k[2],k[3],k[4]))
    elif k[0] ==0 and k[1] ==1:
        print(f2(k[2],k[3],k[4]))
    elif k[0] ==1 and k[1] ==0:
        print(f3(k[2],k[3],k[4]))
    elif k[0] ==1 and k[1] ==1:
        print(f4(k[2],k[3],k[4]))
    else:
        print('Error')
        
    
    






exec(input().strip()) # DON'T remove this line







# 1640209, 2022-09-24 09:51:10, PPPP[PP][PPPP] (100%)

import math
def f1(a, b, c):
    k = []
    k.append(a)
    k.append(b)
    k.append(c)
    d = []
    for e in k:
        if e >0:
            d.append(e)
            
    p = min(d)
    return p

def f2(a, b, c):
    k = []
    k.append(a)
    k.append(b)
    k.append(c)
    d = []
    for e in k:
        if e <0:
            d.append(e)
            
    p = max(d)
    return p

def f3(a, b, c):
    g = str(int(a) + int(b) + int(c))
    if g[0] == '-':
        return int(g[1])
    else:
        return int(g[0])
    
def f4(a, b, c):
    g = str(int(a) + int(b) + int(c))
    return int(g[-1])

def main():
    k = [int(e) for e in input().split()]
    if k[0] ==0 and k[1] ==0:
        print(f1(k[2],k[3],k[4]))
    elif k[0] ==0 and k[1] ==1:
        print(f2(k[2],k[3],k[4]))
    elif k[0] ==1 and k[1] ==0:
        print(f3(k[2],k[3],k[4]))
    elif k[0] ==1 and k[1] ==1:
        print(f4(k[2],k[3],k[4]))
    else:
        print('Error')
        
    
    






exec(input().strip()) # DON'T remove this line



6530138621
# 1641353, 2022-09-24 10:20:33, ----[--][----] (0%)

def f1(a,b,c):
    A = []
    for i in [a,b,c]:
        if i > 0:
            A.append(i)
    return (min(A))
def f2(a,b,c):
    A = []
    for i in [a,b,c]:
        if i < 0:
            A.append(i)
    return (max(A))
def f3(a,b,c):
    B = list(str(abs(a+b+c)))
    return int(B[0])
def f4(a,b,c):
    B = list(str(abs(a+b+c)))
    return int(B[-1])
def main():
    f = input().split()
    f = list(map(int,f))
    if f[0] == 0 and f[1] == 0:
       return print(f1(f[2], f[3], f[4]))
    elif f[0] == 0 and f[1] == 1:
       return print(f2(f[2], f[3], f[4]))
    elif f[0] == 1 and f[1] == 0:
       return print(f3(f[2], f[3], f[4]))
    elif f[0] == 1 and f[1] == 1:
       return print(f4(f[2], f[3], f[4]))
    else:
       return('Error')
# 1641475, 2022-09-24 10:23:12, PPPP[PP][-P-P] (83%)

def f1(a,b,c):
    A = []
    for i in [a,b,c]:
        if i > 0:
            A.append(i)
    return (min(A))
def f2(a,b,c):
    A = []
    for i in [a,b,c]:
        if i < 0:
            A.append(i)
    return (max(A))
def f3(a,b,c):
    B = list(str(abs(a+b+c)))
    return int(B[0])
def f4(a,b,c):
    B = list(str(abs(a+b+c)))
    return int(B[-1])
def main():
    f = input().split()
    f = list(map(int,f))
    if f[0] == 0 and f[1] == 0:
       return print(f1(f[2], f[3], f[4]))
    elif f[0] == 0 and f[1] == 1:
       return print(f2(f[2], f[3], f[4]))
    elif f[0] == 1 and f[1] == 0:
       return print(f3(f[2], f[3], f[4]))
    elif f[0] == 1 and f[1] == 1:
       return print(f4(f[2], f[3], f[4]))
    else:
       return('Error')
    
exec(input().strip())
# 1642220, 2022-09-24 10:36:04, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    A = []
    for i in [a,b,c]:
        if i > 0:
            A.append(i)
    return (min(A))
def f2(a,b,c):
    A = []
    for i in [a,b,c]:
        if i < 0:
            A.append(i)
    return (max(A))
def f3(a,b,c):
    B = list(str(abs(a+b+c)))
    return int(B[0])
def f4(a,b,c):
    B = list(str(abs(a+b+c)))
    return int(B[-1])
def main():
    f = input().split()
    f = list(map(int,f))
    if f[0] == 0 and f[1] == 0:
       return print(f1(f[2], f[3], f[4]))
    elif f[0] == 0 and f[1] == 1:
       return print(f2(f[2], f[3], f[4]))
    elif f[0] == 1 and f[1] == 0:
       return print(f3(f[2], f[3], f[4]))
    elif f[0] == 1 and f[1] == 1:
       return print(f4(f[2], f[3], f[4]))
    else:
       return print('Error')
    
exec(input().strip())

6530187321
# 1639156, 2022-09-24 09:23:23, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for e in x:
        if e > 0:
            y.append(e)
    y = min(y)
    return y
def f2(a, b, c):
    x = [a,b,c]
    y = []
    for e in x:
        if e < 0:
            y.append(e)
    y = max(y)
    return y
def f3(a, b, c):
    x = a+b+c
    if x < 0:
        x *= -1
    x = str(x)
    x = x[0]
    return x
def f4(a, b, c):
    x = a+b+c
    if x < 0:
        x *= -1
    x = str(x)
    x = x[-1]
    return x
def main():
    s1,s2,a,b,c = input().split()
    a,b,c = int(a),int(b),int(c)
    if s1 == '0' and s2 == '0':
        print(f1(a, b, c))
    elif s1 == '0' and s2 == '1':
        print(f2(a, b, c))
    elif s1 == '1' and s2 == '0':
        print(f3(a, b, c))
    elif s1 == '1' and s2 == '1':
        print(f4(a, b, c))
    else:
        print('Error')

exec(input().strip())
    
    
    


# 1640747, 2022-09-24 10:06:03, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for e in x:
        if e > 0:
            y.append(e)
    y = min(y)
    return y
def f2(a, b, c):
    x = [a,b,c]
    y = []
    for e in x:
        if e < 0:
            y.append(e)
    y = max(y)
    return y
def f3(a, b, c):
    x = a+b+c
    if x < 0:
        x *= -1
    x = str(x)
    x = x[0]
    return x
def f4(a, b, c):
    x = a+b+c
    if x < 0:
        x *= -1
    x = str(x)
    x = x[-1]
    return x
def main():
    s1,s2,a,b,c = input().split()
    a = int(a)
    b = int(b)
    c = int(c)
    if s1 == '0' and s2 == '0':
        print(f1(a, b, c))
    elif s1 == '0' and s2 == '1':
        print(f2(a, b, c))
    elif s1 == '1' and s2 == '0':
        print(f3(a, b, c))
    elif s1 == '1' and s2 == '1':
        print(f4(a, b, c))
    else:
        print('Error')

exec(input().strip())
    
    
    


# 1640844, 2022-09-24 10:08:22, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for e in x:
        if e > 0:
            y.append(e)
    y = min(y)
    return y
def f2(a, b, c):
    x = [a,b,c]
    y = []
    for e in x:
        if e < 0:
            y.append(e)
    y = max(y)
    return y
def f3(a, b, c):
    x = a+b+c
    if x < 0:
        x *= -1
    x = str(x)
    x = int(x[0])
    return x
def f4(a, b, c):
    x = a+b+c
    if x < 0:
        x *= -1
    x = str(x)
    x = int(x[-1])
    return x
def main():
    s1,s2,a,b,c = input().split()
    a = int(a)
    b = int(b)
    c = int(c)
    if s1 == '0' and s2 == '0':
        print(f1(a, b, c))
    elif s1 == '0' and s2 == '1':
        print(f2(a, b, c))
    elif s1 == '1' and s2 == '0':
        print(f3(a, b, c))
    elif s1 == '1' and s2 == '1':
        print(f4(a, b, c))
    else:
        print('Error')

exec(input().strip())
    
    
    



6530192421
# 1639397, 2022-09-24 09:29:23, --PP[--][PPPP] (50%)

def f1(a, b, c):
    m = []
    if a>0:
        m += [a]
    elif b>0:
        m += [b]
    elif c > 0:
        m += [c]
    return min(m)
def f2(a, b, c):
    m = []
    if a<0:
        m += [a]
    elif b<0:
        m += [b]
    elif c < 0:
        m += [c]
    return max(m)
def f3(a, b, c):
    m = a+b+c
    if m<0:
        m = -m
    n = int(str(m)[0])
    return n
def f4(a, b, c):
    m = a+b+c
    if m<0:
        m = -m
    n = int(str(m)[-1])
    return n
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
exec(input().strip())
# 1640487, 2022-09-24 09:59:05, P-PP[P-][PPPP] (67%)

def f1(a, b, c):
    m = []
    if a>0:
        m += [a]
    if b>0:
        m += [b]
    if c > 0:
        m += [c]
    return min(m)
def f2(a, b, c):
    m = []
    if a<0:
        m += [a]
    if b<0:
        m += [b]
    if c < 0:
        m += [c]
    print(m)
    return max(m)
def f3(a, b, c):
    m = a+b+c
    if m<0:
        m = -m
    n = int(str(m)[0])
    return n
def f4(a, b, c):
    m = a+b+c
    if m<0:
        m = -m
    n = int(str(m)[-1])
    return n
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
exec(input().strip())
# 1640499, 2022-09-24 09:59:19, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    m = []
    if a>0:
        m += [a]
    if b>0:
        m += [b]
    if c > 0:
        m += [c]
    return min(m)
def f2(a, b, c):
    m = []
    if a<0:
        m += [a]
    if b<0:
        m += [b]
    if c < 0:
        m += [c]
    return max(m)
def f3(a, b, c):
    m = a+b+c
    if m<0:
        m = -m
    n = int(str(m)[0])
    return n
def f4(a, b, c):
    m = a+b+c
    if m<0:
        m = -m
    n = int(str(m)[-1])
    return n
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
exec(input().strip())

6531330921
# 1638989, 2022-09-24 09:19:37, PPx-[PP][PPPx] (50%)

def f1(a,b,c):
    list = []
    for i in a,b,c:
        if i>0:
            list.append(i)
    return min(list)

def f2(a,b,c):
    list = []
    for i in a,b,c:
        if i<0:
            list.append(i)
    return max(list)

def f3(a,b,c):
    r = a+b+c
    return int(str(r)[0])

def f4(a,b,c):
    r = a+b+c
    return r%10

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if (s1 not in [0,1]) or (s2 not in [0,1]):
        print("Error")
    else:
        if s1:
            if s2:
                print(f4(a,b,c,))
            else:
                print(f3(a,b,c))
        else:
            if s2:
                print(f2(a,b,c))
            else:
                print(f1(a,b,c))

exec(input().strip())
# 1639149, 2022-09-24 09:23:13, PPP-[PP][PPPP] (83%)

def f1(a,b,c):
    list = []
    for i in a,b,c:
        if i>0:
            list.append(i)
    return min(list)

def f2(a,b,c):
    list = []
    for i in a,b,c:
        if i<0:
            list.append(i)
    return max(list)

def f3(a,b,c):
    r = a+b+c
    if r< 0:
        return int(str(r)[1])
    else: return int(str(r)[0])

def f4(a,b,c):
    r = a+b+c
    return r%10

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if (s1 not in [0,1]) or (s2 not in [0,1]):
        print("Error")
    else:
        if s1:
            if s2:
                print(f4(a,b,c,))
            else:
                print(f3(a,b,c))
        else:
            if s2:
                print(f2(a,b,c))
            else:
                print(f1(a,b,c))

exec(input().strip())
# 1639252, 2022-09-24 09:25:46, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    list = []
    for i in a,b,c:
        if i>0:
            list.append(i)
    return min(list)

def f2(a,b,c):
    list = []
    for i in a,b,c:
        if i<0:
            list.append(i)
    return max(list)

def f3(a,b,c):
    r = a+b+c
    return int(str(abs(r))[0])

def f4(a,b,c):
    r = a+b+c
    return abs(r)%10

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if (s1 not in [0,1]) or (s2 not in [0,1]):
        print("Error")
    else:
        if s1:
            if s2:
                print(f4(a,b,c,))
            else:
                print(f3(a,b,c))
        else:
            if s2:
                print(f2(a,b,c))
            else:
                print(f1(a,b,c))

exec(input().strip())

6531332121
# 1639299, 2022-09-24 09:26:55, xxPP[PP][PPPP] (67%)

def f1(a, b, c):
    if a > 0:
        min = a
    if b > 0:
        if b < min:
            min = b
    if c > 0:
        if c < min:
            min = c
    return min


def f2(a, b, c):
    if a < 0:
        max = a
    if b < 0:
        if b > max:
            max = b
    if c < 0:
        if c > max:
            max = c
    return max


def f3(a, b, c):
    sum = a + b + c
    if sum < 0:
        sum = sum * -1
    sum2 = str(sum)
    return int(sum2[0])


def f4(a, b, c):
    sum = a + b + c
    if sum < 0:
        sum = sum * -1
    sum2 = str(sum)
    return int(sum2[-1])


def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')


exec(input().strip())  # DON'T remove this line

# 1639523, 2022-09-24 09:32:24, xxPP[PP][PPPP] (67%)

def f1(a, b, c):
    if a > 0:
        min = a
    if b > 0:
        if b < min:
            min = b
    if c > 0:
        if c < min:
            min = c
    return min


def f2(a, b, c):
    if a < 0:
        max = a
    if b < 0:
        if b > max:
            max = b
    if c < 0:
        if c > max:
            max = c
    return max


def f3(a, b, c):
    sum = a + b + c
    if sum < 0:
        sum = sum * -1
    sum2 = str(sum)
    return int(sum2[0])


def f4(a, b, c):
    sum = a + b + c
    if sum < 0:
        sum = sum * -1
    sum2 = str(sum)
    return int(sum2[-1])


def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')


exec(input().strip())  # DON'T remove this line

# 1640366, 2022-09-24 09:55:54, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    min = 1001
    if a > 0:
        min = a
    if b > 0:
        if b < min:
            min = b
    if c > 0:
        if c < min:
            min = c
    return min


def f2(a, b, c):
    max = -1001
    if a < 0:
        max = a
    if b < 0:
        if b > max:
            max = b
    if c < 0:
        if c > max:
            max = c
    return max


def f3(a, b, c):
    sum = a + b + c
    if sum < 0:
        sum = sum * -1
    sum2 = str(sum)
    return int(sum2[0])


def f4(a, b, c):
    sum = a + b + c
    if sum < 0:
        sum = sum * -1
    sum2 = str(sum)
    return int(sum2[-1])


def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')


exec(input().strip())  # DON'T remove this line


# a, b, c = [int(e) for e in input().split()]
# print(f1(a, b, c))
# print(f2(a, b, c))
# print(f3(a, b, c))
# print(f4(a, b, c))


6531334421
# 1639757, 2022-09-24 09:38:38, ----[PP][PPPP] (33%)

def f1(a, b, c):
    n = [a,b,c]
    for i in n:
        if i<0:
            n.remove(i)
    n.sort()
    return n[0]

def f2(a, b, c):
    n = [a,b,c]
    for i in n:
        if i>0:
            n.remove(i)
    n.sort()
    return n[-1]

def f3(a, b, c):
    n = a+b+c
    if n<0:
        return str(n)[1]
    else:
        return str(n)[0]


def f4(a, b, c):
    n = a+b+c
    return str(n)[-1]

def main():
    s1,s2,a,b,c = input().split()
    s1 = int(s1)
    s2 = int(s2)
    a = int(a)
    b = int(b)
    c = int(c)
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")
    
        
exec(input().strip()) # DON'T remove this line
# 1639882, 2022-09-24 09:41:47, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    n = [a,b,c]
    for i in n:
        if i<0:
            n.remove(i)
    n.sort()
    return int(n[0])

def f2(a, b, c):
    n = [a,b,c]
    for i in n:
        if i>0:
            n.remove(i)
    n.sort()
    return int(n[-1])

def f3(a, b, c):
    n = a+b+c
    if n<0:
        return int(str(n)[1])
    else:
        return int(str(n)[0])


def f4(a, b, c):
    n = a+b+c
    return int(str(n)[-1])

def main():
    s1,s2,a,b,c = input().split()
    s1 = int(s1)
    s2 = int(s2)
    a = int(a)
    b = int(b)
    c = int(c)
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")
    
        
exec(input().strip()) # DON'T remove this line
# 1642006, 2022-09-24 10:32:52, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    min = 1000
    if a>0 and a<min:
        min = a
    if b>0 and b<min:
        min = b
    if c>0 and c<min:
        min = c
    return min

def f2(a, b, c):
    max = -1000
    if a<0 and a>max:
        max = a
    if b<0 and b>max:
        max = b
    if c<0 and c>max:
        max = c
    return max

def f3(a, b, c):
    n = a+b+c
    if n<0:
        return int(str(n)[1])
    else:
        return int(str(n)[0])


def f4(a, b, c):
    n = a+b+c
    return int(str(n)[-1])

def main():
    s1,s2,a,b,c = input().split()
    s1 = int(s1)
    s2 = int(s2)
    a = int(a)
    b = int(b)
    c = int(c)
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")
    
        
exec(input().strip()) # DON'T remove this line

6531336721
# 1639770, 2022-09-24 09:38:58, PPx-[PP][P-P-] (50%)

def f1(a, b, c):
    lst1 = []
    if a > 0:
        lst1.append(a)
    if b > 0:
        lst1.append(b)
    if c > 0:
        lst1.append(c)
    return(min(lst1))
def f2(a, b, c):
    lst2 = []
    if a < 0:
        lst2.append(a)
    if b < 0:
        lst2.append(b)
    if c < 0:
        lst2.append(c)
    return(max(lst2))
def f3(a, b, c):
    sum = a+b+c
    if sum < 0:
        sum = -sum
    sol = str(sum)[-2]
    return(sol)
def f4(a, b, c):
    sum2 = a+b+c
    if sum2 < 0:
        sum2 = -sum2
    sol2 = str(sum2)[-1]
    return(sol2)
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1639871, 2022-09-24 09:41:35, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    lst1 = []
    if a > 0:
        lst1.append(a)
    if b > 0:
        lst1.append(b)
    if c > 0:
        lst1.append(c)
    return(min(lst1))
def f2(a, b, c):
    lst2 = []
    if a < 0:
        lst2.append(a)
    if b < 0:
        lst2.append(b)
    if c < 0:
        lst2.append(c)
    return(max(lst2))
def f3(a, b, c):
    sum = a+b+c
    if sum < 0:
        sum = -sum
    sol = str(sum)[0]
    return(sol)
def f4(a, b, c):
    sum2 = a+b+c
    if sum2 < 0:
        sum2 = -sum2
    sol2 = str(sum2)[-1]
    return(sol2)
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1639968, 2022-09-24 09:44:15, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    lst1 = []
    if a > 0:
        lst1.append(a)
    if b > 0:
        lst1.append(b)
    if c > 0:
        lst1.append(c)
    return(min(lst1))
def f2(a, b, c):
    lst2 = []
    if a < 0:
        lst2.append(a)
    if b < 0:
        lst2.append(b)
    if c < 0:
        lst2.append(c)
    return(max(lst2))
def f3(a, b, c):
    sum = a+b+c
    if sum < 0:
        sum = -sum
    sol = str(sum)[0]
    return(int(sol))
def f4(a, b, c):
    sum2 = a+b+c
    if sum2 < 0:
        sum2 = -sum2
    sol2 = str(sum2)[-1]
    return(int(sol2))
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line

6531338021
# 1640635, 2022-09-24 10:03:13, PPPP[--][P-P-] (67%)

def f1(a, b, c):
    x =[]
    if a>0: x.append(a)
    if b>0: x.append(b)
    if c>0: x.append(c)
    return(min(x))

def f2(a, b, c):
    x =[]
    if a<0: x.append(a)
    if b<0: x.append(b)
    if c<0: x.append(c)
    return(max(x))

def f3(a ,b, c):
    s = a+b+c
    if s < 0:
        s *= -1
    strs = str(s)
    return(int(strs[0]))

def f4(a ,b, c):
    s = a+b+c
    if s < 0:
        s *= -1
    strs = str(s)
    return(int(strs[-1]))

def main():
    x = input().split()
    a,b,c = int(x[2]),int(x[3]),int(x[4])
    if int(x[0]) == 0 and int(x[1]) == 0:
        print(f1(a,b,c))
    if int(x[0]) == 0 and int(x[1]) == 1:
        print(f2(a,b,c))
    if int(x[0]) == 1 and int(x[1]) == 0:
        print(f3(a,b,c))
    if int(x[0]) == 1 and int(x[1]) == 1:
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip()) # DON'T remove this line
# 1640718, 2022-09-24 10:05:23, PPPP[--][P-P-] (67%)

def f1(a, b, c):
    x =[]
    if a>0: x.append(a)
    if b>0: x.append(b)
    if c>0: x.append(c)
    return(min(x))

def f2(a, b, c):
    x =[]
    if a<0: x.append(a)
    if b<0: x.append(b)
    if c<0: x.append(c)
    return(max(x))

def f3(a ,b, c):
    s = a+b+c
    if s < 0:
        s *= -1
    strs = str(s)
    return(int(strs[0]))

def f4(a ,b, c):
    s = a+b+c
    if s < 0:
        s *= -1
    strs = str(s)
    return(int(strs[-1]))

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip()) # DON'T remove this line
# 1641530, 2022-09-24 10:24:20, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    x =[]
    if a>0: x.append(a)
    if b>0: x.append(b)
    if c>0: x.append(c)
    return(min(x))

def f2(a, b, c):
    x =[]
    if a<0: x.append(a)
    if b<0: x.append(b)
    if c<0: x.append(c)
    return(max(x))

def f3(a ,b, c):
    s = a+b+c
    if s < 0:
        s *= -1
    strs = str(s)
    return(int(strs[0]))

def f4(a ,b, c):
    s = a+b+c
    if s < 0:
        s *= -1
    strs = str(s)
    return(int(strs[-1]))

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip()) # DON'T remove this line

6531340121
# 1639143, 2022-09-24 09:23:09, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    l0 = [a,b,c]
    l = []
    for i in range(3):
        if l0[i] > 0:
            l.append(l0[i])
    return min(l)
def f2(a, b, c):
    l0 = [a,b,c]
    l = []
    for i in range(3):
        if l0[i] < 0:
            l.append(l0[i])
    return max(l)
def f3(a, b, c):
    s = a +b +c
    if s < 0:
        s *= -1
    s = str(s)[0]
    return s
def f4(a, b, c):
    s = a +b +c
    if s < 0:
        s *= -1
    s = str(s)[-1]
    return s
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) 
# 1639944, 2022-09-24 09:43:46, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    l0 = [a,b,c]
    l = []
    for i in range(3):
        if l0[i] > 0:
            l.append(l0[i])
    return min(l)
def f2(a, b, c):
    l0 = [a,b,c]
    l = []
    for i in range(3):
        if l0[i] < 0:
            l.append(l0[i])
    return max(l)
def f3(a, b, c):
    s = a +b +c
    if s < 0:
        s *= -1
    d = str(s)[0]
    return d
def f4(a, b, c):
    s = a +b +c
    if s < 0:
        s *= -1
    d = str(s)[-1]
    return d
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")


exec(input().strip()) 
# 1640187, 2022-09-24 09:50:34, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    l0 = [a,b,c]
    l = []
    for i in range(3):
        if l0[i] > 0:
            l.append(l0[i])
    return min(l)
def f2(a, b, c):
    l0 = [a,b,c]
    l = []
    for i in range(3):
        if l0[i] < 0:
            l.append(l0[i])
    return max(l)
def f3(a, b, c):
    s = a +b +c
    if s < 0:
        s *= -1
    d = str(s)[0]
    return int(d)
def f4(a, b, c):
    s = a +b +c
    d = str(s)[-1]
    return int(d)
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")


exec(input().strip()) 

6532027021
# 1638787, 2022-09-24 09:15:04, PP-P[PP][PPPP] (83%)

def f1(a, b, c) :
    minimum = 10**9
    for x in [a, b, c] :
        if x > 0 :
            minimum = min(minimum, x)
    return minimum

def f2(a, b, c) :
    maximum = -10**9
    for x in [a, b, c] :
        if x < 0 :
            maximum = max(maximum, x)
    return maximum
        
def f3(a, b, c) :
    if a + b + c < 0 :
        return str(a + b + c)[1]
    return str(a + b + c)[0]

def f4(a, b, c) :
    return abs(a + b + c) % 10

def main() :
    s1, s2, a, b, c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print("Error")

exec(input().strip())
# 1638838, 2022-09-24 09:16:18, PP-P[PP][PPPP] (83%)

def f1(a, b, c) :
    minimum = 10**9
    for x in [a, b, c] :
        if x > 0 :
            minimum = min(minimum, x)
    return minimum

def f2(a, b, c) :
    maximum = -10**9
    for x in [a, b, c] :
        if x < 0 :
            maximum = max(maximum, x)
    return maximum
        
def f3(a, b, c) :
    return str(abs(a + b + c))[0]

def f4(a, b, c) :
    return abs(a + b + c) % 10

def main() :
    s1, s2, a, b, c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print("Error")

exec(input().strip())
# 1638930, 2022-09-24 09:18:18, PPPP[PP][PPPP] (100%)

def f1(a, b, c) :
    minimum = 1000
    for x in [a, b, c] :
        if x > 0 :
            minimum = min(minimum, x)
    return minimum

def f2(a, b, c) :
    maximum = -1000
    for x in [a, b, c] :
        if x < 0 :
            maximum = max(maximum, x)
    return maximum
        
def f3(a, b, c) :
    return int(str(abs(a + b + c))[0])

def f4(a, b, c) :
    return abs(a + b + c) % 10

def main() :
    s1, s2, a, b, c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print("Error")

exec(input().strip())

6532114921
# 1639172, 2022-09-24 09:23:54, PP--[PP][P-P-] (50%)

def f1(a ,b ,c):
    l = [a ,b ,c]
    mn = 1010
    for e in l:
        if mn > e and e > 0: mn = e
    return mn

def f2(a ,b ,c):
    l = [a ,b ,c]
    mx = -1010
    for e in l:
        if mx < e and e < 0: mx = e
    return mx

def f3(a ,b ,c):
    sum = str(a + b + c)
    if sum[0] == '-': return sum[1]
    else: return sum[0]

def f4(a ,b ,c):
    sum = str(a + b + c)
    return sum[len(sum)-1]

def main():
    s1 ,s2 ,a ,b ,c = [int(e) for e in input().split()]
    if s1==0 and s2==0 : print(f1(a ,b ,c))
    elif s1==0 and s2==1: print(f2(a ,b ,c))
    elif s1==1 and s1==0: print(f3(a ,b ,c))
    elif s1==1 and s1==1: print(f4(a ,b ,c))
    else: print('Error')

exec(input().strip())

# 1639826, 2022-09-24 09:40:34, PPPP[PP][P-P-] (83%)

def f1(a ,b ,c):
    l = [a ,b ,c]
    mn = 1010
    for e in l:
        if mn > e and e > 0: mn = e
    return mn

def f2(a ,b ,c):
    l = [a ,b ,c]
    mx = -1010
    for e in l:
        if mx < e and e < 0: mx = e
    return mx

def f3(a ,b ,c):
    sum = str(a + b + c)
    if sum[0] == '-': return int(sum[1])
    else: return int(sum[0])

def f4(a ,b ,c):
    sum = str(a + b + c)
    return int(sum[len(sum)-1])

def main():
    s1 ,s2 ,a ,b ,c = [int(e) for e in input().split()]
    if s1==0 and s2==0 : print(f1(a ,b ,c))
    elif s1==0 and s2==1: print(f2(a ,b ,c))
    elif s1==1 and s1==0: print(f3(a ,b ,c))
    elif s1==1 and s1==1: print(f4(a ,b ,c))
    else: print('Error')

exec(input().strip())

# 1639857, 2022-09-24 09:41:09, PPPP[PP][PPPP] (100%)

def f1(a ,b ,c):
    l = [a ,b ,c]
    mn = 1010
    for e in l:
        if mn > e and e > 0: mn = e
    return mn

def f2(a ,b ,c):
    l = [a ,b ,c]
    mx = -1010
    for e in l:
        if mx < e and e < 0: mx = e
    return mx

def f3(a ,b ,c):
    sum = str(a + b + c)
    if sum[0] == '-': return int(sum[1])
    else: return int(sum[0])

def f4(a ,b ,c):
    sum = str(a + b + c)
    return int(sum[len(sum)-1])

def main():
    s1 ,s2 ,a ,b ,c = [int(e) for e in input().split()]
    if s1==0 and s2==0 : print(f1(a ,b ,c))
    elif s1==0 and s2==1: print(f2(a ,b ,c))
    elif s1==1 and s2==0: print(f3(a ,b ,c))
    elif s1==1 and s2==1: print(f4(a ,b ,c))
    else: print('Error')

exec(input().strip())


6532148221
# 1639010, 2022-09-24 09:20:10, PP-P[PP][PPPP] (83%)

from calendar import c


def f1(a, b, c):
    min = 1e9
    if a < min and a > 0:
        min = a
    if b < min and b > 0 :
        min = b
    if c < min and c > 0:
        min = c
    return min

def f2(a, b, c):
    max = -1e9
    if a > max and a < 0:
        max = a
    if b > max and b < 0:
        max = b
    if c > max and c < 0:
        max = c
    return max

def f3(a, b, c):
    sum = abs(a + b + c)
    while sum > 10:
        sum //= 10
    return sum
 
def f4(a, b, c):
    return abs(a + b + c) % 10

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')

exec(input().strip()) # DON'T remove this lin
# 1639178, 2022-09-24 09:24:01, PPPP[PP][PPPP] (100%)

from calendar import c


def f1(a, b, c):
    min = 1e9
    if a < min and a > 0:
        min = a
    if b < min and b > 0 :
        min = b
    if c < min and c > 0:
        min = c
    return min

def f2(a, b, c):
    max = -1e9
    if a > max and a < 0:
        max = a
    if b > max and b < 0:
        max = b
    if c > max and c < 0:
        max = c
    return max

def f3(a, b, c):
    sum = abs(a + b + c)
    while sum >= 10:
        sum //= 10
    return sum
 
def f4(a, b, c):
    return abs(a + b + c) % 10

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')

exec(input().strip()) # DON'T remove this lin
# 1639217, 2022-09-24 09:24:48, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    min = 1e9
    if a < min and a > 0:
        min = a
    if b < min and b > 0 :
        min = b
    if c < min and c > 0:
        min = c
    return min

def f2(a, b, c):
    max = -1e9
    if a > max and a < 0:
        max = a
    if b > max and b < 0:
        max = b
    if c > max and c < 0:
        max = c
    return max

def f3(a, b, c):
    sum = abs(a + b + c)
    while sum >= 10:
        sum //= 10
    return sum
 
def f4(a, b, c):
    return abs(a + b + c) % 10

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')

exec(input().strip()) # DON'T remove this lin

6532201821
# 1639136, 2022-09-24 09:23:01, --x-[--][PPPx] (0%)

def f1(a,b,c) :
    x=[]
    if a>0 : x.append(a)
    if b>0 : x.append(a)
    if c>0 : x.append(a)
    x.sort()
    return x[0]

def f2(a,b,c) :
    x=[]
    if a<0 : x.append(-1*a)
    if b<0 : x.append(-1*a)
    if c<0 : x.append(-1*a)
    x.sort()
    return -1*x[0]

def f3(a,b,c) :
   s=str(a+b+c)
   return int(s[0])

def f4(a,b,c) :
   s=str(a+b+c)
   return int(s[:-1:])

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0 : print(f1(a,b,c))
    elif s1==0 and s2==1 : print(f2(a,b,c))
    elif s1==1 and s2==0 : print(f3(a,b,c))
    elif s1==1 and s2==1 : print(f4(a,b,c))
    else : print('Error')

exec(input().strip())

# 1639258, 2022-09-24 09:25:49, PPx-[PP][PPPx] (50%)

def f1(a,b,c) :
    x=[]
    if a>0 : x.append(a)
    if b>0 : x.append(b)
    if c>0 : x.append(c)
    x.sort()
    return x[0]

def f2(a,b,c) :
    x=[]
    if a<0 : x.append(-1*a)
    if b<0 : x.append(-1*b)
    if c<0 : x.append(-1*c)
    x.sort()
    return -1*x[0]

def f3(a,b,c) :
   s=str(a+b+c)
   return int(s[0])

def f4(a,b,c) :
   s=str(a+b+c)
   return int(s[:-1:])

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0 : print(f1(a,b,c))
    elif s1==0 and s2==1 : print(f2(a,b,c))
    elif s1==1 and s2==0 : print(f3(a,b,c))
    elif s1==1 and s2==1 : print(f4(a,b,c))
    else : print('Error')

exec(input().strip())

# 1639418, 2022-09-24 09:29:59, PPPP[PP][PPPP] (100%)

def f1(a,b,c) :
    x=[]
    if a>0 : x.append(a)
    if b>0 : x.append(b)
    if c>0 : x.append(c)
    x.sort()
    return x[0]

def f2(a,b,c) :
    x=[]
    if a<0 : x.append(-1*a)
    if b<0 : x.append(-1*b)
    if c<0 : x.append(-1*c)
    x.sort()
    return -1*x[0]

def f3(a,b,c) :
   s=str(abs(a+b+c))
   return int(s[0])

def f4(a,b,c) :
   s=str(abs(a+b+c))
   return int(s[len(s)-1])

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0 : print(f1(a,b,c))
    elif s1==0 and s2==1 : print(f2(a,b,c))
    elif s1==1 and s2==0 : print(f3(a,b,c))
    elif s1==1 and s2==1 : print(f4(a,b,c))
    else : print('Error')

exec(input().strip())


6230063921
# 1639019, 2022-09-24 09:20:20, PP--[PP][PPPP] (67%)

def f1(a,b,c):
    ans = []
    if a > 0:
        ans.append(a)
    if b > 0:
        ans.append(b)
    if c > 0:
        ans.append(c)
    return min(ans)
    
def f2(a,b,c):
    ans = []
    if a < 0:
        ans.append(a)
    if b < 0:
        ans.append(b)
    if c < 0:
        ans.append(c)
    return max(ans)

def f3(a,b,c):
    ans = str(abs(a+b+c))
    ans = ans[0]
    return ans

def f4(a,b,c):
    ans = str(abs(a+b+c))
    ans = ans[-1]
    return ans

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 ==0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 ==1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 ==0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 ==1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())

# 1639101, 2022-09-24 09:22:10, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    ans = []
    if a > 0:
        ans.append(a)
    if b > 0:
        ans.append(b)
    if c > 0:
        ans.append(c)
    return min(ans)
    
def f2(a,b,c):
    ans = []
    if a < 0:
        ans.append(a)
    if b < 0:
        ans.append(b)
    if c < 0:
        ans.append(c)
    return max(ans)

def f3(a,b,c):
    ans = str(abs(a+b+c))
    ans = ans[0]
    return int(ans)

def f4(a,b,c):
    ans = str(abs(a+b+c))
    ans = ans[-1]
    return int(ans)

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 ==0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 ==1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 ==0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 ==1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())

6231122421
# 1639082, 2022-09-24 09:21:43, PPxP[PP][PxPP] (67%)

def f1(a, b, c):
    temp1 = [a, b, c]
    temp2 = []
    for e in temp1:
        if e > 0:
            temp2.append(e)
    return min(temp2)

def f2(a, b, c):
    temp1 = [a, b, c]
    temp2 = []
    for e in temp1:
        if e < 0:
            temp2.append(e)
    return max(temp2)

def f3(a, b, c):
    temp = a+b+c
    if temp < 0:
        t = str(temp)
        return int(t[1])
    else:return int(temp[0])

def f4(a, b, c):
    temp = str(a+b+c)
    return int(temp[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

exec(input().strip())

# 1639253, 2022-09-24 09:25:46, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    temp1 = [a, b, c]
    temp2 = []
    for e in temp1:
        if e > 0:
            temp2.append(e)
    return min(temp2)

def f2(a, b, c):
    temp1 = [a, b, c]
    temp2 = []
    for e in temp1:
        if e < 0:
            temp2.append(e)
    return max(temp2)

def f3(a, b, c):
    temp = a+b+c
    if temp < 0:
        t = str(temp)
        return int(t[1])
    else:
        t = str(temp)
        return int(t[0])

def f4(a, b, c):
    temp = str(a+b+c)
    return int(temp[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

exec(input().strip())


6230322421
# 1639286, 2022-09-24 09:26:19, PPPP[xx][xxxx] (67%)

def f1(a,b,c):
    l = [a,b,c]
    for i in range(0,len(l)):
        if l[i] <= 0:
            l[i] = int(10000)
    m = min(l)
    return m


def f2(a,b,c) :
    l = [a,b,c]
    for i in range(0,len(l)):
        if l[i] >= 0:
            l[i] = int(-10000)
    m = max(l)
    return m

def f3(a,b,c) :
    l = a+b+c
    l = str(l)
    if l[0] == '-':
        l = l[1]
    else:
        l = l[0]
    l = int(l)
    return l

def f4(a,b,c) :
    l = a+b+c
    l = str(l)
    l = l[-1]
    l = int(l)
    return l


    
exec(input().strip())
# 1639552, 2022-09-24 09:33:09, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    l = [a,b,c]
    for i in range(0,len(l)):
        if l[i] <= 0:
            l[i] = int(10000)
    m = min(l)
    return m


def f2(a,b,c) :
    l = [a,b,c]
    for i in range(0,len(l)):
        if l[i] >= 0:
            l[i] = int(-10000)
    m = max(l)
    return m

def f3(a,b,c) :
    l = a+b+c
    l = str(l)
    if l[0] == '-':
        l = l[1]
    else:
        l = l[0]
    l = int(l)
    return l

def f4(a,b,c) :
    l = a+b+c
    l = str(l)
    l = l[-1]
    l = int(l)
    return l

def main() :
    s1,s2,a,b,c = input().split()
    s1 = int(s1)
    s2 = int(s2)
    a = int(a)
    b = int(b)
    c = int(c)
    
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    else:
        if s1 == 0 and s2 == 1 :
            print(f2(a, b, c))
        else:
            if s1 == 1 and s2 == 0 :
                print(f3(a, b, c))
            else:
                if s1 == 1 and s2 == 1 :
                   print(f4(a, b, c))
                else:
                    print('Error')
    
exec(input().strip())

6331112221
# 1640510, 2022-09-24 09:59:32, --PP[PP][PPPP] (67%)

def f1(a,b,c):
    d = a,b,c
    u = []
    
    for i in range(len(d)):
        if d[i] >= 0:
            u.append(d[i])
        else:
            pass
    m = min(u)
    return m

def f2(a,b,c):
    d = a,b,c
    u = []
    
    for i in range(len(d)):
        if d[i] <= 0:
            u.append(d[i])
        else:
            pass
    m = max(u)
    return m

def f3(a,b,c):
    d = a,b,c
    u = [a,b,c]
    y = ""
    if sum(u) < 0:
        y += str(sum(u))
        z = int(y[1])
    elif sum(u) >= 0 :
        y += str(sum(u))
        z = int(y[0])
    return z

def f4(a,b,c):
    d = a,b,c
    u = [a,b,c]
    y = ""
    if sum(u) < 0:
        y += str(sum(u))
        z = int(y[-1])
    elif sum(u) >= 0 :
        y += str(sum(u))
        z = int(y[-1])
    return z

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip())
# 1640554, 2022-09-24 10:00:50, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    d = a,b,c
    u = []
    
    for i in range(len(d)):
        if d[i] > 0:
            u.append(d[i])
        else:
            pass
    m = min(u)
    return m

def f2(a,b,c):
    d = a,b,c
    u = []
    
    for i in range(len(d)):
        if d[i] < 0:
            u.append(d[i])
        else:
            pass
    m = max(u)
    return m

def f3(a,b,c):
    d = a,b,c
    u = [a,b,c]
    y = ""
    if sum(u) < 0:
        y += str(sum(u))
        z = int(y[1])
    elif sum(u) >= 0 :
        y += str(sum(u))
        z = int(y[0])
    return z

def f4(a,b,c):
    d = a,b,c
    u = [a,b,c]
    y = ""
    if sum(u) < 0:
        y += str(sum(u))
        z = int(y[-1])
    elif sum(u) >= 0 :
        y += str(sum(u))
        z = int(y[-1])
    return z

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip())

6530006421
# 1639309, 2022-09-24 09:27:12, PP--[PP][PPPP] (67%)

# Test_01_02
# This Code was written by Korraphat Pangvutthivanich 6530006421

def main() :
    s1, s2, a, b, c = [int(x) for x in input().split()]

    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))

    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))

    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))

    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))

    else :
        print("Error")

def f1(a, b, c) :

    ls = [a, b, c]
    to_cal = [x for x in ls if x > 0]

    return min(to_cal)

def f2(a, b, c) :

    ls = [a, b, c]
    to_cal = [x for x in ls if x < 0]

    return max(to_cal)

def f3(a, b, c) :

    sum_all = a + b + c
    ans = str(abs(sum_all))

    return ans[0]

def f4(a, b, c) :
    
    sum_all = a + b + c
    ans = str(abs(sum_all))

    return ans[-1]



exec(input().strip()) # DON'T remove this line

# 1639511, 2022-09-24 09:32:04, PPPP[PP][PPPP] (100%)

# Test_01_02
# This Code was written by Korraphat Pangvutthivanich 6530006421

def main() :
    s1, s2, a, b, c = [int(x) for x in input().split()]

    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))

    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))

    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))

    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))

    else :
        print("Error")

def f1(a, b, c) :

    ls = [a, b, c]
    to_cal = [x for x in ls if x > 0]

    return min(to_cal)

def f2(a, b, c) :

    ls = [a, b, c]
    to_cal = [x for x in ls if x < 0]

    return max(to_cal)

def f3(a, b, c) :

    sum_all = a + b + c
    ans = str(abs(sum_all))

    return int(ans[0])

def f4(a, b, c) :
    
    sum_all = a + b + c
    ans = str(abs(sum_all))

    return int(ans[-1])



exec(input().strip()) # DON'T remove this line


6530007021
# 1639412, 2022-09-24 09:29:49, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    r = [a,b,c]
    a = []
    for i in r:
        if i > 0:
            a.append(i)
    return(min(a))

def f2(a, b, c):
    r = [a,b,c]
    a = []
    for i in r:
        if i < 0:
            a.append(i)
    return(max(a))

def f3(a, b, c):
    r = [a,b,c]
    a = sum(r)
    if a < 0 :
        a = -a
    return(int(str(a)[0]))

def f4(a, b, c):
    r = [a,b,c]
    a = sum(r)
    if a < 0 :
        a = -a
    return(int(str(a)[-1]))

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print( f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print( f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print( f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print( f4(a, b, c))
    else:
        print('Error')

exec(input().strip())
# 1640796, 2022-09-24 10:07:16, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    r = [a,b,c]
    s = []
    for i in r:
        if i > 0:
            s.append(i)
    return(min(s))

def f2(a, b, c):
    r = [a,b,c]
    s = []
    for i in r:
        if i < 0:
            s.append(i)
    return(max(s))

def f3(a, b, c):
    r = [a,b,c]
    s = sum(r)
    if s < 0 :
        s = -s
    return(int(str(s)[0]))

def f4(a, b, c):
    r = [a,b,c]
    s = sum(r)
    if s < 0 :
        s = -s
    return(int(str(s)[-1]))

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print( f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print( f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print( f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print( f4(a, b, c))
    else:
        print('Error')

exec(input().strip())

6530029921
# 1639591, 2022-09-24 09:34:17, P-PP[P-][PPPP] (67%)

def f1(a,b,c):
    result = []
    if a > 0:
        result.append(a)
    if b > 0:
        result.append(b)
    if c > 0:
        result.append(c)
    
    return int(min(result))
def f2(a,b,c):
    result = []
    if a > 0:
        result.append(a)
    if b > 0:
        result.append(b)
    if c > 0:
        result.append(c)
    return int(max(result))
def f3(a,b,c):
    sum = a+b+c
    
    if sum >= 0:
        sum = str(sum)
        return int(sum[0])
    elif sum < 0:
        sum = str(sum)
        return int(sum[1])
def f4(a,b,c):
    sum = a+b+c
    
    if sum >= 0:
        sum = str(sum)
        return int(sum[-1])
    elif sum < 0:
        sum = str(sum)
        return int(sum[-1])
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip()) # DON'T remove this line   
# 1639698, 2022-09-24 09:36:59, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    result = []
    if a > 0:
        result.append(a)
    if b > 0:
        result.append(b)
    if c > 0:
        result.append(c)
    
    return int(min(result))
def f2(a,b,c):
    result = []
    if a < 0:
        result.append(a)
    if b < 0:
        result.append(b)
    if c < 0:
        result.append(c)
    return int(max(result))
def f3(a,b,c):
    sum = a+b+c
    
    if sum >= 0:
        sum = str(sum)
        return int(sum[0])
    elif sum < 0:
        sum = str(sum)
        return int(sum[1])
def f4(a,b,c):
    sum = a+b+c
    
    if sum >= 0:
        sum = str(sum)
        return int(sum[-1])
    elif sum < 0:
        sum = str(sum)
        return int(sum[-1])
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip()) # DON'T remove this line

6530032721
# 1639620, 2022-09-24 09:34:52, P-PP[P-][PPPP] (67%)

def f1(a,b,c) :
    k = []
    for e in [a,b,c] :
        if e > 0 :
            k.append(e)
    m = []
    for e in k :
        if e%1 == 0 :
            m.append(e)
    result = min(m)
    return(result)
    
def f2(a,b,c) :
    k = []
    for e in [a,b,c] :
        if e > 0 :
            k.append(e)
    m = []
    for e in k :
        if e%1 == 0 :
            m.append(e)
    result = max(m)
    return(result)

def f3(a,b,c) :
    sums = a + b + c
    if sums < 0 :
        sums *= -1
    result = int(str(sums)[0])
    return(result)

def f4(a,b,c) :
    sums = a + b + c
    if sums < 0 :
        sums *= -1
    result = int(str(sums)[-1])
    return(result)

def main() :
    n = input().split()
    s1 = int(n[0])
    s2 = int(n[1])
    a = int(n[2])
    b = int(n[3])
    c = int(n[4])
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
        
exec(input().strip()) # DON'T remove this line



# 1639684, 2022-09-24 09:36:36, PPPP[PP][PPPP] (100%)

def f1(a,b,c) :
    k = []
    for e in [a,b,c] :
        if e > 0 :
            k.append(e)
    m = []
    for e in k :
        if e%1 == 0 :
            m.append(e)
    result = min(m)
    return(result)
    
def f2(a,b,c) :
    k = []
    for e in [a,b,c] :
        if e < 0 :
            k.append(e)
    m = []
    for e in k :
        if e%1 == 0 :
            m.append(e)
    result = max(m)
    return(result)

def f3(a,b,c) :
    sums = a + b + c
    if sums < 0 :
        sums *= -1
    result = int(str(sums)[0])
    return(result)

def f4(a,b,c) :
    sums = a + b + c
    if sums < 0 :
        sums *= -1
    result = int(str(sums)[-1])
    return(result)

def main() :
    n = input().split()
    s1 = int(n[0])
    s2 = int(n[1])
    a = int(n[2])
    b = int(n[3])
    c = int(n[4])
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
        
exec(input().strip()) # DON'T remove this line




6530059721
# 1639504, 2022-09-24 09:31:57, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    s = [a,b,c]
    s.sort()
    for i in range(3):
        if s[i]>0:
            return s[i]
    
def f2(a, b, c):
    s = [a,b,c]
    s.sort()
    for i in range(2,-1,-1):
        if s[i]<0:
            return s[i]
    
def f3(a, b, c):
    s = a+b+c
    if s<0:
        s *= -1
    return str(s)[0]
    
def f4(a, b, c):
    s = a+b+c
    return str(s)[-1]
    
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")
    
    
exec(input().strip()) # DON'T remove this line


# 1639569, 2022-09-24 09:33:41, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    s = [a,b,c]
    s.sort()
    for i in range(3):
        if s[i]>0:
            return s[i]
    
def f2(a, b, c):
    s = [a,b,c]
    s.sort()
    for i in range(2,-1,-1):
        if s[i]<0:
            return s[i]
    
def f3(a, b, c):
    s = a+b+c
    if s<0:
        s *= -1
    return int(str(s)[0])
    
def f4(a, b, c):
    s = a+b+c
    return int(str(s)[-1])
    
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")
    
    
exec(input().strip()) # DON'T remove this line

6530083721
# 1639416, 2022-09-24 09:29:58, PP--[PP][PPPP] (67%)


def f1(a, b, c):
    lit = []
    if a > 0:
        lit.append(a)
    if b>0:
        lit.append(b)
    if c>0:
        lit.append(c)
    return int(min(lit))

def f2(a, b, c):
    lit = []
    if a<0:
        lit.append(a)
    if b<0:
        lit.append(b)
    if c<0:
        lit.append(c)
    return int(max(lit))

    
def f3(a, b, c):
    num = abs(a+b+c)
    num = str(num)
    return num[0]

def f4(a, b, c):
    num = abs(a+b+c)
    num = str(num)
    return num[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0: print(f1(a, b, c))
    elif s1 == 0 and s2 == 1: print(f2(a, b, c))
    elif s1 == 1 and s2 == 0: print(f3(a, b, c))
    elif s1 == 1 and s2 == 1: print(f4(a, b, c))
    else: print('Error')
    
    
exec(input().strip()) # DON'T remove this line

# 1639465, 2022-09-24 09:31:05, PPPP[PP][PPPP] (100%)


def f1(a, b, c):
    lit = []
    if a > 0:
        lit.append(a)
    if b>0:
        lit.append(b)
    if c>0:
        lit.append(c)
    return int(min(lit))

def f2(a, b, c):
    lit = []
    if a<0:
        lit.append(a)
    if b<0:
        lit.append(b)
    if c<0:
        lit.append(c)
    return int(max(lit))

    
def f3(a, b, c):
    num = abs(a+b+c)
    num = str(num)
    return int(num[0])

def f4(a, b, c):
    num = abs(a+b+c)
    num = str(num)
    return int(num[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0: print(f1(a, b, c))
    elif s1 == 0 and s2 == 1: print(f2(a, b, c))
    elif s1 == 1 and s2 == 0: print(f3(a, b, c))
    elif s1 == 1 and s2 == 1: print(f4(a, b, c))
    else: print('Error')
    
    
exec(input().strip()) # DON'T remove this line


6530087221
# 1640513, 2022-09-24 09:59:34, PPPP[xx][xxxx] (67%)

def f1(a, b, c):
    total = []
    if a > 0 :
        total += [a]
    if b > 0 :
        total += [b]
    if c > 0 :
        total += [c]
    return(min(total))

def f2(a, b, c):
    total = []
    if a < 0 :
        total += [a]
    if b < 0 :
        total += [b]
    if c < 0 :
        total += [c]
    return(max(total))
def f3(a, b, c):
    total = []
    total += [a]
    total += [b]
    total += [c]
    k = sum(total)
    i = 0
    while i < 1 :
        if k >= 0 :
            if k >= 10 :
                k = k//10
            else :
                i += 1
                return(k)
        else :
            k = -k
            if k >= 10 :
                k = k//10
            else :
                i += 1
                return(k)
def f4(a, b, c):
    total = []
    total += [a]
    total += [b]
    total += [c]
    k = sum(total)
    i = 0
    if k >= 0 :
        return(k%10)
    else :
        k = -k
        return(k%10)
exec(input().strip()) # DON'T remove this line

# 1640748, 2022-09-24 10:06:08, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    total = []
    if a > 0 :
        total += [a]
    if b > 0 :
        total += [b]
    if c > 0 :
        total += [c]
    return(min(total))

def f2(a, b, c):
    total = []
    if a < 0 :
        total += [a]
    if b < 0 :
        total += [b]
    if c < 0 :
        total += [c]
    return(max(total))
def f3(a, b, c):
    total = []
    total += [a]
    total += [b]
    total += [c]
    k = sum(total)
    i = 0
    while i < 1 :
        if k >= 0 :
            if k >= 10 :
                k = k//10
            else :
                i += 1
                return(k)
        else :
            k = -k
            if k >= 10 :
                k = k//10
            else :
                i += 1
                return(k)
def f4(a, b, c):
    total = []
    total += [a]
    total += [b]
    total += [c]
    k = sum(total)
    i = 0
    if k >= 0 :
        return(k%10)
    else :
        k = -k
        return(k%10)
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
        return(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
        return(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
        return(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
        return(f4(a, b, c))
    else :
        print('Error')
        return('Error')
    
exec(input().strip()) # DON'T remove this line


6530105921
# 1639442, 2022-09-24 09:30:29, ----[--][----] (0%)

def f1(a,b,c):
    e = []
    if a > 0:
        e.append(a)
    if b > 0:
        e.append(b)
    if c > 0:
        e.append(c)
    k = min(e)
    return k
def f2(a,b,c):
    e = []
    if a < 0:
        e.append(a)
    if b < 0:
        e.append(b)
    if c < 0:
        e.append(c)
    k = max(e)
    return k
def f3(a,b,c):
    d = a + b + c
    if d < 0:
        d = str(d)
        d = d[1::]
    else:
        d = str(d)
    e = int(d[0])
    return e
def f4(a,b,c):
    d = a + b + c
    if d < 0:
        d = str(d)
        d = d[1::]
    else:
        d = str(d)
    e = int(d[-1])
    return e
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if (s1 == 0) and (s2 == 0):
        print(f1(a,b,c))
    elif (s1 == 0) and (s2 == 1):
        print(f2(a,b,c))
    elif (s1 == 1) and (s2 == 0):
        print(f3(a,b,c))
    elif (s1 == 1) and (s2 == 1):
        print(f4(a,b,c))
    else:
        print("Error")
    
    
# 1639492, 2022-09-24 09:31:38, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    e = []
    if a > 0:
        e.append(a)
    if b > 0:
        e.append(b)
    if c > 0:
        e.append(c)
    k = min(e)
    return k
def f2(a,b,c):
    e = []
    if a < 0:
        e.append(a)
    if b < 0:
        e.append(b)
    if c < 0:
        e.append(c)
    k = max(e)
    return k
def f3(a,b,c):
    d = a + b + c
    if d < 0:
        d = str(d)
        d = d[1::]
    else:
        d = str(d)
    e = int(d[0])
    return e
def f4(a,b,c):
    d = a + b + c
    if d < 0:
        d = str(d)
        d = d[1::]
    else:
        d = str(d)
    e = int(d[-1])
    return e
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if (s1 == 0) and (s2 == 0):
        print(f1(a,b,c))
    elif (s1 == 0) and (s2 == 1):
        print(f2(a,b,c))
    elif (s1 == 1) and (s2 == 0):
        print(f3(a,b,c))
    elif (s1 == 1) and (s2 == 1):
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip())

6530113921
# 1639406, 2022-09-24 09:29:38, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    l = [a,b,c]
    c = []
    for i in l:
        if i > 0:
            c.append(i)
    return min(c)

def f2(a, b, c):
    l = [a,b,c]
    c = []
    for i in l:
        if i < 0:
            c.append(i)
    return max(c)

def f3(a, b, c):
    s = a+b+c
    if s < 0:
        s = -s
    return str(s)[0]

def f4(a, b, c):
    s = a+b+c
    if s < 0:
        s = -s
    return str(s)[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
        
exec(input().strip())
# 1640148, 2022-09-24 09:49:33, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    l = [a,b,c]
    c = []
    for i in l:
        if i > 0:
            c.append(i)
    return min(c)

def f2(a, b, c):
    l = [a,b,c]
    c = []
    for i in l:
        if i < 0:
            c.append(i)
    return max(c)

def f3(a, b, c):
    s = a+b+c
    if s < 0:
        s = -s
    return int(str(s)[0])

def f4(a, b, c):
    s = a+b+c
    if s < 0:
        s = -s
    return int(str(s)[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
        
exec(input().strip())

6530132821
# 1640091, 2022-09-24 09:47:54, xxPP[--][PPPP] (50%)

def f1(a, b, c):
    num1 = [a,b,c]
    d1 = []
    for i in range(len(num1)) :
        if num1[i] > 0:
            d1.append(int(num1[i]))
        x = min(d1)
        return x       

def f2(a, b, c):
    num2 = [a,b,c]
    d2 = []
    for i in range(len(num2)) :
        if num2[i] < 0:
            d2.append(int(num2[i]))
        y = max(d2)
        return y
                 
def f3(a, b, c):
    num3 = [a,b,c]
    x = abs(sum(num3))
    z = str(x)[0]
    return int(z)
                 

def f4(a, b, c):
    num4 = [a,b,c]
    x = abs(sum(num4))
    u = str(x)[-1]
    return int(u)

def main():
    setnum = [int(e) for e in input().split()]
    s1 = setnum[0]
    s2 = setnum[1]
    a = setnum[2]
    b = setnum[3]
    c = setnum[4]
    if s1 == 0 and s2 == 0:
        print (f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print (f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print (f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print (f4(a, b, c))
    else :
        print ("Error")
            
exec(input().strip()) # DON'T remove this line





# 1640462, 2022-09-24 09:58:36, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    num1  = []
    num1.append(int(a))
    num1.append(int(b))
    num1.append(int(c))
    d1 = []
    for i in range(len(num1)) :
        if num1[i] > 0:
            d1.append(int(num1[i]))
    x = min(d1)
    return x       

def f2(a, b, c):
    num2  = []
    num2.append(int(a))
    num2.append(int(b))
    num2.append(int(c))
    d2 = []
    for i in range(len(num2)) :
        if num2[i] < 0:
            d2.append((int(num2[i])))
    y = max(d2)
    return y

                 
def f3(a, b, c):
    num3 = [a,b,c]
    x = abs(sum(num3))
    z = str(x)[0]
    return int(z)
                 

def f4(a, b, c):
    num4 = [a,b,c]
    x = abs(sum(num4))
    u = str(x)[-1]
    return int(u)

def main():
    setnum = [int(e) for e in input().split()]
    s1 = setnum[0]
    s2 = setnum[1]
    a = setnum[2]
    b = setnum[3]
    c = setnum[4]
    if s1 == 0 and s2 == 0:
        print (f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print (f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print (f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print (f4(a, b, c))
    else :
        print ("Error")
            
exec(input().strip()) # DON'T remove this line








6530135721
# 1639447, 2022-09-24 09:30:35, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    if(a<=0):
        a=1001
    if(b<=0):
        b=1001
    if(c<=0):
        c=1001
    d = min(a,b)
    return (min(c,d))
def f2(a, b, c):
    if(a>=0):
        a=-1001
    if(b>=0):
        b=-1001
    if(c>=0):
        c=-1001
    d = max(a,b)
    return (max(c,d))
def f3(a,b,c):
    d = str(a+b+c)
    if (a+b+c)<0:
        return d[1]
    else:
        return d[0]
def f4(a,b,c):
    d = str(a+b+c)
    return d[-1]
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

# 1640743, 2022-09-24 10:06:00, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    if(a<=0):
        a=1001
    if(b<=0):
        b=1001
    if(c<=0):
        c=1001
    d = min(a,b)
    return (min(c,d))
def f2(a, b, c):
    if(a>=0):
        a=-1001
    if(b>=0):
        b=-1001
    if(c>=0):
        c=-1001
    d = max(a,b)
    return (max(c,d))
def f3(a,b,c):
    d = str(a+b+c)
    if (a+b+c)<0:
        return int(d[1])
    else:
        return int(d[0])
def f4(a,b,c):
    d = str(a+b+c)
    return int(d[-1])
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line


6530168421
# 1640492, 2022-09-24 09:59:14, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    out = [a,b,c]
    for e in out:
        if e < 0:
            out.remove(e)
    return min(out)
def f2(a, b, c):
    out = [a,b,c]
    for e in out:
        if e > 0:
            out.remove(e)
    return max(out)
def f3(a, b, c):
    out = str(a+b+c)
    if out[0] == '-':
        return int(out[1:2])
    else:
        return int(out[0:1])
def f4(a, b, c):
    out = str(a+b+c)
    return int(out[-1])
def main():
    x = input().split()
    num = []
    for e in x:
        num.append(int(e))
    if num[0] == 0 and num[1] == 0:
        print(f1(num[2], num[3], num[4]))
    elif num[0] == 0 and num[1] == 1:
        print(f2(num[2], num[3], num[4]))
    elif num[0] == 1 and num[1] == 0:
        print(f3(num[2], num[3], num[4]))
    elif num[0] == 1 and num[1] == 1:
        print(f4(num[2], num[3], num[4]))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1641003, 2022-09-24 10:12:42, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    num = [a,b,c]
    out = []
    for e in num:
        if e > 0:
            out.append(e)
    return min(out)
def f2(a, b, c):
    num = [a,b,c]
    out = []
    for e in num:
        if e < 0:
            out.append(e)
    return max(out)
def f3(a, b, c):
    out = str(a+b+c)
    if out[0] == '-':
        return int(out[1:2])
    else:
        return int(out[0:1])
def f4(a, b, c):
    out = str(a+b+c)
    return int(out[-1])
def main():
    x = input().split()
    num = []
    for e in x:
        num.append(int(e))
    if num[0] == 0 and num[1] == 0:
        print(f1(num[2], num[3], num[4]))
    elif num[0] == 0 and num[1] == 1:
        print(f2(num[2], num[3], num[4]))
    elif num[0] == 1 and num[1] == 0:
        print(f3(num[2], num[3], num[4]))
    elif num[0] == 1 and num[1] == 1:
        print(f4(num[2], num[3], num[4]))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line

6530181521
# 1639456, 2022-09-24 09:30:50, PPP-[PP][PPPP] (83%)

def f1(a, b, c):
    x = [a,b,c]
    m = 0
    while m <= 0 :
        m = min(x)
        if m <= 0 :
            x.remove(m)
    return m
def f2(a, b, c):
    x = [a,b,c]
    m = 0
    while m >= 0 :
        m = max(x)
        if m >= 0 :
            x.remove(m)
    return m
def f3(a, b, c):
    x=a+b+c
    x = str(x)
    if x[0] == '-' :
        return int(x[1])
    return int(x[0])
def f4(a, b, c):
    x = str(a+b+c)
    return x[-1]
def main():
    x = input().split()
    for i in range(len(x)) :
        x[i] = int(x[i])
    s1,s2,a,b,c = x
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')

exec(input())

# 1639502, 2022-09-24 09:31:50, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    x = [a,b,c]
    m = 0
    while m <= 0 :
        m = min(x)
        if m <= 0 :
            x.remove(m)
    return m
def f2(a, b, c):
    x = [a,b,c]
    m = 0
    while m >= 0 :
        m = max(x)
        if m >= 0 :
            x.remove(m)
    return m
def f3(a, b, c):
    x=a+b+c
    x = str(x)
    if x[0] == '-' :
        return int(x[1])
    return int(x[0])
def f4(a, b, c):
    x = str(a+b+c)
    return int(x[-1])
def main():
    x = input().split()
    for i in range(len(x)) :
        x[i] = int(x[i])
    s1,s2,a,b,c = x
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')

exec(input())


6530188021
# 1639602, 2022-09-24 09:34:30, xxPP[xx][PPPP] (50%)

def f1(a, b, c):
    s = []
    if a > 0:
        s+=a
    if b > 0:
        s+=b
    if c > 0:
        s+=c
    sol = min(s)
    return(int(sol))
def f2(a, b, c):
    s = []
    if a < 0:
        s+=a
    if b < 0:
        s+=b
    if c < 0:
        s+=c
    sol = max(s)
    return(int(sol))
def f3(a, b, c):
    sol = a+b+c
    if sol < 0:
        sol = sol*(-1)
    ans = str(sol)
    return(int(ans[0]))
def f4(a, b, c):
    sol = a+b+c
    if sol < 0:
        sol = sol*(-1)
    ans = str(sol)
    return(int(ans[len(ans)-1]))
def main():
    x = input().split()
    x = [int(e) for e in x]
    s1 = x[0]
    s2 = x[1]
    a = x[2]
    b = x[3]
    c = x[4]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip()) # DON'T remove this line

# 1639661, 2022-09-24 09:35:57, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    s = []
    if a > 0:
        s+=[a]
    if b > 0:
        s+=[b]
    if c > 0:
        s+=[c]
    sol = min(s)
    return(int(sol))
def f2(a, b, c):
    s = []
    if a < 0:
        s+=[a]
    if b < 0:
        s+=[b]
    if c < 0:
        s+=[c]
    sol = max(s)
    return(int(sol))
def f3(a, b, c):
    sol = a+b+c
    if sol < 0:
        sol = sol*(-1)
    ans = str(sol)
    return(int(ans[0]))
def f4(a, b, c):
    sol = a+b+c
    if sol < 0:
        sol = sol*(-1)
    ans = str(sol)
    return(int(ans[len(ans)-1]))
def main():
    x = input().split()
    x = [int(e) for e in x]
    s1 = x[0]
    s2 = x[1]
    a = x[2]
    b = x[3]
    c = x[4]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip()) # DON'T remove this line


6530197621
# 1638998, 2022-09-24 09:19:50, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for e in x:
        if e > 0:
            y += [e]
    return min(y)

def f2(a, b, c):
    x = [a,b,c]
    y = []
    for e in x:
        if e < 0:
            y += [e]
    return max(y)

def f3(a, b, c):
    return str(abs(a+b+c))[0]

def f4(a, b, c):
    return str(abs(a+b+c))[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip())

    
# 1639113, 2022-09-24 09:22:26, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for e in x:
        if e > 0:
            y += [e]
    return min(y)

def f2(a, b, c):
    x = [a,b,c]
    y = []
    for e in x:
        if e < 0:
            y += [e]
    return max(y)

def f3(a, b, c):
    return int(str(abs(a+b+c))[0])

def f4(a, b, c):
    return int(str(abs(a+b+c))[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip())

    

6530205021
# 1639538, 2022-09-24 09:32:47, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    l = [int(a) ,int(b) ,int(c)]
    l2 = []
    for i in l :
        if i > 0 :
            l2.append(i)
    return min(l2)
    
    
def f2(a, b, c):
    l = [int(a) ,int(b) ,int(c)]
    l2 = []
    for i in l :
        if i < 0 :
            l2.append(i)
    return max(l2)
    
def f3(a, b, c):
    sum = a+b+c
    sum = abs(sum)
    return str(sum)[0]
    
 
def f4(a, b, c):
    sum = a+b+c
    sum = abs(sum)
    return str(sum)[-1]
    
def main():
    s1, s2 ,a ,b, c = input().split()
    s1 =int(s1) ; s2 =int(s2)  ; a= int(a) ; b =int(b) ; c= int(c)
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print('Error')
exec(input().strip()) # DON'T remove this line

# 1640837, 2022-09-24 10:08:10, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    l = [int(a) ,int(b) ,int(c)]
    l2 = []
    for i in l :
        if i > 0 :
            l2.append(i)
            
    return min(l2)
    
    
def f2(a, b, c):
    l = [int(a) ,int(b) ,int(c)]
    l2 = []
    for i in l :
        if i < 0 :
            l2.append(i)
    return max(l2)
    
def f3(a, b, c):
    sum = a+b+c
    sum = abs(sum)
    return int(str(sum)[0])
    
 
def f4(a, b, c):
    sum = a+b+c
    sum = abs(sum)
    return int(str(sum)[-1])
    
def main():
    s1, s2 ,a ,b, c = input().split()
    s1 =int(s1) ; s2 =int(s2)  ; a= int(a) ; b =int(b) ; c= int(c)
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print('Error')
exec(input().strip()) # DON'T remove this line


6531301721
# 1639730, 2022-09-24 09:37:57, PP--[PP][PPPP] (67%)

def f1(a, b, c):
  if (a<0) and (b<0) and (c>0):
    return c
  elif (a<0) and (c<0) and (b>0):
    return b
  elif (b<0) and (c<0) and (a>0):
    return a
  elif (a>0) and (b>0) and (c<0):
    if a < b:
      return a
    else:
      return b
  elif (a>0) and (c>0) and (b<0):
    if a < c:
      return a
    else:
      return c
  elif (b>0) and (c>0) and (a<0):
    if b < c:
      return b
    else:
      return c
  elif (a<0) and (b==0) and (c>0):
    return c
  elif (a<0) and (c==0) and (b>0):
    return b
  elif (b<0) and (a==0) and (c>0):
    return c
  elif (b<0) and (c==0) and (a>0):
    return a
  elif (c<0) and (a==0) and (b>0):
    return b
  elif (c<0) and (b==0) and (a>0):
    return a
#########
def f2(a, b, c):
  if (a>0) and (b>0) and (c<0):
    return c
  elif (a>0) and (c>0) and (b<0):
    return b
  elif (b>0) and (c>0) and (a<0):
    return a
  elif (a<0) and (b<0) and (c>0):
    if a > b:
      return a
    else:
      return b
  elif (a<0) and (c<0) and (b>0):
    if a > c:
      return a
    else:
      return c
  elif (b<0) and (c<0) and (a>0):
    if b > c:
      return b
    else:
      return c
  elif (a<0) and (b==0) and (c>0):
    return a
  elif (a<0) and (c==0) and (b>0):
    return a
  elif (b<0) and (a==0) and (c>0):
    return b
  elif (b<0) and (c==0) and (a>0):
    return b
  elif (c<0) and (a==0) and (b>0):
    return c
  elif (c<0) and (b==0) and (a>0):
    return c
#########
def f3(a, b, c):
  Sum = a + b + c
  String = str(Sum)
  if String[0] == '-':
    return String[1]
  else:
    return String[0]
#########
def f4(a, b, c):
  Sum = a + b + c
  String = str(Sum)
  return String[len(String) - 1]
#########
def main():
  s1, s2, a, b, c = [int(e) for e in input().split(' ')]
  if (s1==0) and (s2==0):
    print(f1(a, b, c))
  elif (s1==0) and (s2==1):
    print(f2(a, b, c))
  elif (s1==1) and (s2==0):
    print(f3(a, b, c))
  elif (s1==1) and (s2==1):
    print(f4(a, b, c))
  else:
    print("Error")
#########
exec(input().strip())
# 1641191, 2022-09-24 10:17:24, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
  if (a<0) and (b<0) and (c>0):
    return c
  elif (a<0) and (c<0) and (b>0):
    return b
  elif (b<0) and (c<0) and (a>0):
    return a
  elif (a>0) and (b>0) and (c<0):
    if a < b:
      return a
    else:
      return b
  elif (a>0) and (c>0) and (b<0):
    if a < c:
      return a
    else:
      return c
  elif (b>0) and (c>0) and (a<0):
    if b < c:
      return b
    else:
      return c
  elif (a<0) and (b==0) and (c>0):
    return c
  elif (a<0) and (c==0) and (b>0):
    return b
  elif (b<0) and (a==0) and (c>0):
    return c
  elif (b<0) and (c==0) and (a>0):
    return a
  elif (c<0) and (a==0) and (b>0):
    return b
  elif (c<0) and (b==0) and (a>0):
    return a
#########
def f2(a, b, c):
  if (a>0) and (b>0) and (c<0):
    return c
  elif (a>0) and (c>0) and (b<0):
    return b
  elif (b>0) and (c>0) and (a<0):
    return a
  elif (a<0) and (b<0) and (c>0):
    if a > b:
      return a
    else:
      return b
  elif (a<0) and (c<0) and (b>0):
    if a > c:
      return a
    else:
      return c
  elif (b<0) and (c<0) and (a>0):
    if b > c:
      return b
    else:
      return c
  elif (a<0) and (b==0) and (c>0):
    return a
  elif (a<0) and (c==0) and (b>0):
    return a
  elif (b<0) and (a==0) and (c>0):
    return b
  elif (b<0) and (c==0) and (a>0):
    return b
  elif (c<0) and (a==0) and (b>0):
    return c
  elif (c<0) and (b==0) and (a>0):
    return c
#########
def f3(a, b, c):
  Sum = a + b + c
  String = str(Sum)
  if String[0] == '-':
    return int(String[1])
  else:
    return int(String[0])
#########
def f4(a, b, c):
  Sum = a + b + c
  String = str(Sum)
  return int(String[len(String) - 1])
#########
def main():
  s1, s2, a, b, c = [int(e) for e in input().split(' ')]
  if (s1==0) and (s2==0):
    print(f1(a, b, c))
  elif (s1==0) and (s2==1):
    print(f2(a, b, c))
  elif (s1==1) and (s2==0):
    print(f3(a, b, c))
  elif (s1==1) and (s2==1):
    print(f4(a, b, c))
  else:
    print("Error")
#########
exec(input().strip())

6531303021
# 1639018, 2022-09-24 09:20:20, xxPP[xx][PPPP] (50%)

def f1(a, b, c):
    r = [a,b,c]
    r.sort()
    for i in r:
        if r >0:return i
    return i
def f2(a, b, c):
    r = [a,b,c]
    r.sort()
    for i in r[::-1]:
        if r <0:return i
    return i
def f3(a, b, c):
    r = a + b + c
    r = abs(r)
    return int(str(r)[0])
def f4(a, b, c):
    r = a + b + c
    r = abs(r)
    return int(str(r)[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

exec(input().strip()) # DON'T remove this line
# 1639086, 2022-09-24 09:21:48, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    r = [a,b,c]
    r.sort()
    for i in r:
        if i > 0:return i
    return i
def f2(a, b, c):
    r = [a,b,c]
    r.sort()
    for i in r[::-1]:
        if i < 0:return i
    return i
def f3(a, b, c):
    r = a + b + c
    r = abs(r)
    return int(str(r)[0])
def f4(a, b, c):
    r = a + b + c
    r = abs(r)
    return int(str(r)[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

exec(input().strip()) # DON'T remove this line

6531307521
# 1639907, 2022-09-24 09:42:38, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    d = []
    if a > 0 :
        d.append(a)
    if b > 0 :
        d.append(b)
    if c > 0 :
        d.append(c)
    return min(d) 
def f2(a, b, c):
    d = []
    if a < 0 :
        d.append(a)
    if b < 0 :
        d.append(b)
    if c < 0 :
        d.append(c)
    return max(d)
def f3(a, b, c):
    e = a + b + c
    if e < 0 :
        e = e*(-1)
    e = str(e)
    return e[0]
def f4(a, b, c):
    e = a + b + c
    e = str(e)
    return e[-1]
def main():
    b = [int(e) for e in input().split()]
    if b[0] == 0 and b[1] == 0 :
        print(f1(b[2],b[3],b[4]))
    elif b[0] == 0 and b[1] == 1 :
        print(f2(b[2],b[3],b[4]))
    elif b[0] == 1 and b[1] == 0 :
        print(f3(b[2],b[3],b[4]))
    elif b[0] == 1 and b[1] == 1 :
        print(f4(b[2],b[3],b[4]))
    else : 
        print("Error")

exec(input().strip()) # DON'T remove this line
# 1641079, 2022-09-24 10:14:41, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    d = []
    if a > 0 and a%1 == 0:
        d.append(int(a))
    if b > 0 and a%1 == 0:
        d.append(int(b))
    if c > 0 and a%1 == 0:
        d.append(int(c))
    return min(d) 
def f2(a, b, c):
    d = []
    if a < 0 and a%1 == 0:
        d.append(int(a))
    if b < 0 and a%1 == 0:
        d.append(int(b))
    if c < 0 and a%1 == 0:
        d.append(int(c))
    return max(d)
def f3(a, b, c):
    e = a + b + c
    if e < 0 :
        e = e*(-1)
    e = str(e)
    return int(e[0])
def f4(a, b, c):
    e = a + b + c
    e = str(e)
    return int(e[-1])
def main():
    b = [int(e) for e in input().split()]
    if b[0] == 0 and b[1] == 0 :
        print(f1(b[2],b[3],b[4]))
    elif b[0] == 0 and b[1] == 1 :
        print(f2(b[2],b[3],b[4]))
    elif b[0] == 1 and b[1] == 0 :
        print(f3(b[2],b[3],b[4]))
    elif b[0] == 1 and b[1] == 1 :
        print(f4(b[2],b[3],b[4]))
    else : 
        print("Error")

exec(input().strip()) # DON'T remove this line

6531316121
# 1639080, 2022-09-24 09:21:41, PP--[PP][PPPP] (67%)

def f1(a,b,c):
    l = []
    for e in [a,b,c]:
        if e > 0:
            l.append(e)
    mymin = min(l)
    return mymin

def f2(a,b,c):
    l = []
    for e in [a,b,c]:
        if e < 0:
            l.append(e)
    mymax = max(l)
    return mymax

def f3(a,b,c):
    sum = a + b + c
    if sum < 0:
        return str(sum)[1]
    else:
        return str(sum)[0]
    
def f4(a,b,c):
    sum = a + b + c
    return str(sum)[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip())
# 1639229, 2022-09-24 09:25:08, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    l = []
    for e in [a,b,c]:
        if e > 0:
            l.append(e)
    mymin = min(l)
    return int(mymin)

def f2(a,b,c):
    l = []
    for e in [a,b,c]:
        if e < 0:
            l.append(e)
    mymax = max(l)
    return int(mymax)

def f3(a,b,c):
    sum = a + b + c
    if sum < 0:
        return int(str(sum)[1])
    else:
        return int(str(sum)[0])
    
def f4(a,b,c):
    sum = a + b + c
    return int(str(sum)[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip())

6531320621
# 1639668, 2022-09-24 09:36:09, -PPP[PP][PPPP] (83%)

from calendar import c


def f1(a,b,c):
    lis = [int(a),int(b),int(c)]
    lis_ans = []
    for i in range(len(lis)):
        if lis[i]>=0:
            lis_ans.append(lis[i])
    ans = min(lis_ans)
    return ans

def f2(a,b,c):
    lis = [int(a),int(b),int(c)]
    lis_ans = []
    for i in range(len(lis)):
        if lis[i]<0:
            lis_ans.append(lis[i])
    ans = max(lis_ans)
    return ans

def f3(a,b,c):
    sum = int(a)+int(b)+int(c)
    ans_str = str(sum)
    ans = ans_str[0]
    if ans == '-':
        ans = ans_str[1]
        return int(ans)
    return int(ans)

def f4(a,b,c):
    sum = int(a)+int(b)+int(c)
    ans_str = str(sum)
    ans = ans_str[-1]
    return int(ans)

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0:
        if s2 == 0:
            print(f1(a,b,c))
        elif s2 == 1:
            print(f2(a,b,c))
        else:
            print('Error')
    elif s1 == 1:
        if s2 == 0:
            print(f3(a,b,c))
        elif s2 == 1:
            print(f4(a,b,c))
        else:
            print('Error')
    else:
        print('Error')

exec(input().strip()) # DON'T remove this line

# 1641327, 2022-09-24 10:20:00, PPPP[PP][PPPP] (100%)

from calendar import c


def f1(a,b,c):
    lis = [int(a),int(b),int(c)]
    lis_ans = []
    for i in range(len(lis)):
        if lis[i]>0:
            lis_ans.append(lis[i])
    ans = min(lis_ans)
    return ans

def f2(a,b,c):
    lis = [int(a),int(b),int(c)]
    lis_ans = []
    for i in range(len(lis)):
        if lis[i]<0:
            lis_ans.append(lis[i])
    ans = max(lis_ans)
    return ans

def f3(a,b,c):
    sum = int(a)+int(b)+int(c)
    ans_str = str(sum)
    ans = ans_str[0]
    if ans == '-':
        ans = ans_str[1]
        return int(ans)
    return int(ans)

def f4(a,b,c):
    sum = int(a)+int(b)+int(c)
    ans_str = str(sum)
    ans = ans_str[-1]
    return int(ans)

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0:
        if s2 == 0:
            print(f1(a,b,c))
        elif s2 == 1:
            print(f2(a,b,c))
        else:
            print('Error')
    elif s1 == 1:
        if s2 == 0:
            print(f3(a,b,c))
        elif s2 == 1:
            print(f4(a,b,c))
        else:
            print('Error')
    else:
        print('Error')

exec(input().strip()) # DON'T remove this line

6531333821
# 1639042, 2022-09-24 09:20:53, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    tempList = []
    if a > 0:
        tempList.append(a)
    if b > 0:
        tempList.append(b)
    if c > 0:
        tempList.append(c)
    return min(tempList)


def f2(a, b, c):
    tempList = []
    if a < 0:
        tempList.append(a)
    if b < 0:
        tempList.append(b)
    if c < 0:
        tempList.append(c)
    return max(tempList)


def f3(a, b, c):
    summation = a+b+c
    if(summation < 0):
        return int(str(a+b+c)[1])
    else:
        return int(str(a+b+c)[0])


def f4(a, b, c):
    return int(str(a+b+c)[-1])


def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if(s1 == 0):
        if(s2 == 0):
            print(f1(a, b, c))
            return
        elif(s2 == 1):
            print(f2(a, b, c))
            return
    if(s1 == 1):
        if(s2 == 0):
            print(f3(a, b, c))
            return
        elif(s2 == 1):
            print(f4(a, b, c))
            return

    print("Error")


exec(input().strip())
# 1641011, 2022-09-24 10:12:54, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    tempList = []
    if a > 0:
        tempList.append(a)
    if b > 0:
        tempList.append(b)
    if c > 0:
        tempList.append(c)
    return min(tempList)


def f2(a, b, c):
    tempList = []
    if a < 0:
        tempList.append(a)
    if b < 0:
        tempList.append(b)
    if c < 0:
        tempList.append(c)
    return max(tempList)


def f3(a, b, c):
    summation = a + b + c
    if(summation < 0):
        return int(str(summation)[1])
    else:
        return int(str(summation)[0])


def f4(a, b, c):
    return int(str(a + b + c)[-1])


def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if(s1 == 0):
        if(s2 == 0):
            print(f1(a, b, c))
            return
        elif(s2 == 1):
            print(f2(a, b, c))
            return
    if(s1 == 1):
        if(s2 == 0):
            print(f3(a, b, c))
            return
        elif(s2 == 1):
            print(f4(a, b, c))
            return

    print("Error")


exec(input().strip())


6531339621
# 1639038, 2022-09-24 09:20:50, PPPP[xx][xxxx] (67%)

def f1(a, b, c):
    mini = 1001
    if(a < mini and a > 0):
        mini = a
    if(b < mini and b > 0):
        mini = b
    if(c < mini and c > 0):
        mini = c
    return mini


def f2(a, b, c):
    maxi = -1001
    if(a > maxi and a < 0):
        maxi = a
    if(b > maxi and b < 0):
        maxi = b
    if(c > maxi and c < 0):
        maxi = c
    return maxi


def f3(a, b, c):
    d = str(abs(a+b+c))
    return int(d[0])


def f4(a, b, c):
    d = abs(a+b+c)
    return d % 10


exec(input().strip())

# 1639054, 2022-09-24 09:21:16, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    mini = 1001
    if(a < mini and a > 0):
        mini = a
    if(b < mini and b > 0):
        mini = b
    if(c < mini and c > 0):
        mini = c
    return mini


def f2(a, b, c):
    maxi = -1001
    if(a > maxi and a < 0):
        maxi = a
    if(b > maxi and b < 0):
        maxi = b
    if(c > maxi and c < 0):
        maxi = c
    return maxi


def f3(a, b, c):
    d = str(abs(a+b+c))
    return int(d[0])


def f4(a, b, c):
    d = abs(a+b+c)
    return d % 10


def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if(s1 == 0):
        if(s2 == 0):
            print(f1(a, b, c))
        elif(s2 == 1):
            print(f2(a, b, c))
        else:
            print("Error")
    elif(s1 == 1):
        if(s2 == 0):
            print(f3(a, b, c))
        elif(s2 == 1):
            print(f4(a, b, c))
        else:
            print("Error")
    else:
        print("Error")


exec(input().strip())


6531348221
# 1639515, 2022-09-24 09:32:08, PP--[PP][----] (50%)

def f1(a, b, c):
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000 :
        if a>0 or b>0 or c>0 :
            if a<0 or b<0 or c<0 :
                x = [a,b,c]
                x.sort()
                y= []
                for i  in range(len(x)):
                    if x[i] > 0 :
                        y.append(x[i])
                return int(y[0])
def f2(a, b, c):
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000 :
        if a>0 or b>0 or c>0 :
            if a<0 or b<0 or c<0 :
                x = [a,b,c]
                x.sort()
                y= []
                for i  in range(len(x)):
                    if x[i] < 0 :
                        y.append(x[i])
                return int(y[-1])

def f3(a, b, c):
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000 :
        if a>0 or b>0 or c>0 :
            if a<0 or b<0 or c<0 :
                x = a+b+c
                if x < 0 :
                    x = str(x)
                    y = int(x[1])
                else :
                    x = str(x)
                    y = int(x[0])
                return y

 
def f4(a, b, c):
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000 :
        if a>0 or b>0 or c>0 :
            if a<0 or b<0 or c<0 :
                x = a+b+c
                x = str(x)
                return int(x[-1])
 
def main():
    x = input().split()
    x = [int(a) for a in x]
    s1 = x[0]
    s2 = x[1]
    a = x[2]
    b = x[3]
    c = x[4]
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000 :
        if a>0 or b>0 or c>0 :
            if a<0 or b<0 or c<0 :
                if s1 == 0 and s2 == 0:
                    print(f1(a, b ,c))
                elif s1 == 0 and s2 == 1:
                    print(f2(a, b ,c))
                elif s1 == 1 and s2 == 0:
                    print(f3(a, b ,c))
                elif s1 == 1 and s2 == 1:
                    print(f4(a, b ,c))
                else:
                    print("Error")

exec(input().strip()) # DON'T remove this line

# 1641452, 2022-09-24 10:22:35, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
                x = [a,b,c]
                x.sort()
                y= []
                for i  in range(len(x)):
                    if x[i] > 0 :
                        y.append(x[i])
                return int(y[0])
def f2(a, b, c):
                x = [a,b,c]
                x.sort()
                y= []
                for i  in range(len(x)):
                    if x[i] < 0 :
                        y.append(x[i])
                return int(y[-1])

def f3(a, b, c):
                x = a+b+c
                if x < 0 :
                    x = str(x)
                    y = int(x[1])
                else :
                    x = str(x)
                    y = int(x[0])
                return y

 
def f4(a, b, c):
                x = a+b+c
                x = str(x)
                return int(x[-1])
 
def main():
    x = input().split()
    x = [int(a) for a in x]
    s1 = x[0]
    s2 = x[1]
    a = x[2]
    b = x[3]
    c = x[4]
    if s1 == 0 and s2 == 0:
        print(f1(a, b ,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b ,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b ,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b ,c))
    else:
        print("Error")

exec(input().strip()) # DON'T remove this line


6532035021
# 1639249, 2022-09-24 09:25:44, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    return min(int(x) for x in [a, b, c] if x > 0)

def f2(a, b, c):
    return max(int(x) for x in [a, b, c] if x < 0)

def f3(a, b, c):
    return str(abs(sum([a, b, c])))[0]

def f4(a, b, c):
    return str(abs(sum([a, b, c])))[-1]

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')

exec(input().strip()) # DON'T remove this line
# 1639334, 2022-09-24 09:27:48, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    return min(int(x) for x in [a, b, c] if x > 0)

def f2(a, b, c):
    return max(int(x) for x in [a, b, c] if x < 0)

def f3(a, b, c):
    return int(str(abs(sum([a, b, c])))[0])

def f4(a, b, c):
    return int(str(abs(sum([a, b, c])))[-1])

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')

exec(input().strip()) # DON'T remove this line

6532040021
# 1638837, 2022-09-24 09:16:16, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    lst = [a, b, c]
    ans = 1000
    for i in lst:
        if i > 0:
            ans = min(i, ans)
    return ans
def f2(a, b, c):
    lst = [a, b, c]
    ans = -1000
    for i in lst:
        if i < 0:
            ans = max(i, ans)
    return ans
def f3(a, b, c):
    return int(str(abs(a + b + c))[0])
def f4(a, b, c):
    s = str(abs(a + b + c))
    return int(s[len(s) - 1])
def main():
    s1, s2, a, b, c = [int(i) for i in input().split()]
    if(s1 == 0 and s2 == 0): print(f1(a, b, c))
    elif(s1 == 0 and s2 == 1): print(f2(a, b, c))
    elif(s1 == 1 and s2 == 0): print(f3(a, b, c))
    elif(s1 == 1 and s2 == 1): print(f4(a, b, c))
    else: print('Error')
exec(input().strip()) # DON'T remove this line
# 1639947, 2022-09-24 09:43:49, PPPP[PP][PPPP] (100%)

#AUTHOR : CHANATIP PATTANAPEN 6532040021
def f1(a, b, c):
    lst = [a, b, c]
    ans = 1000
    for i in lst:
        if i > 0:
            ans = min(i, ans)
    return ans
def f2(a, b, c):
    lst = [a, b, c]
    ans = -1000
    for i in lst:
        if i < 0:
            ans = max(i, ans)
    return ans
def f3(a, b, c):
    return int(str(abs(a + b + c))[0])
def f4(a, b, c):
    s = str(abs(a + b + c))
    return int(s[len(s) - 1])
def main():
    s1, s2, a, b, c = [int(i) for i in input().split()]
    if(s1 == 0 and s2 == 0): print(f1(a, b, c))
    elif(s1 == 0 and s2 == 1): print(f2(a, b, c))
    elif(s1 == 1 and s2 == 0): print(f3(a, b, c))
    elif(s1 == 1 and s2 == 1): print(f4(a, b, c))
    else: print('Error')
exec(input().strip()) # DON'T remove this line

6532092721
# 1639027, 2022-09-24 09:20:36, PP-P[PP][PPPP] (83%)

def f1(a, b, c):
    minn = 1001
    if (a > 0) : minn = min(a,minn)
    if (b > 0) : minn = min(b,minn)
    if (c > 0) : minn = min(c,minn)
    return minn
def f2(a, b, c):
    maxx = -1001
    if (a < 0) : maxx = max(a,maxx)
    if (b < 0) : maxx = max(b,maxx)
    if (c < 0) : maxx = max(c,maxx)
    return maxx
def f3(a, b, c):
    sum = abs(a + b + c)
    while (sum > 10) :
        sum //= 10
    return sum
def f4(a, b, c):
    sum = abs(a+b+c)
    return sum%10
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if (s1 == 0 and s2 == 0) :
        print(f1(a,b,c))
    elif (s1 == 0 and s2 == 1) :
        print(f2(a,b,c))
    elif (s1 == 1 and s2 == 0) :
        print(f3(a,b,c))
    elif (s1 == 1 and s2 == 1) :
        print(f4(a,b,c))
    else :
        print("Error")

exec(input().strip()) # DON'T remove this line
# 1639160, 2022-09-24 09:23:29, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    minn = 1001
    if (a > 0) : minn = min(a,minn)
    if (b > 0) : minn = min(b,minn)
    if (c > 0) : minn = min(c,minn)
    return minn
def f2(a, b, c):
    maxx = -1001
    if (a < 0) : maxx = max(a,maxx)
    if (b < 0) : maxx = max(b,maxx)
    if (c < 0) : maxx = max(c,maxx)
    return maxx
def f3(a, b, c):
    sum = abs(a + b + c)
    while (sum >= 10) :
        sum //= 10
    return sum
def f4(a, b, c):
    sum = abs(a+b+c)
    return sum%10
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if (s1 == 0 and s2 == 0) :
        print(f1(a,b,c))
    elif (s1 == 0 and s2 == 1) :
        print(f2(a,b,c))
    elif (s1 == 1 and s2 == 0) :
        print(f3(a,b,c))
    elif (s1 == 1 and s2 == 1) :
        print(f4(a,b,c))
    else :
        print("Error")

exec(input().strip()) # DON'T remove this line

6532100021
# 1640297, 2022-09-24 09:53:33, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    lst = [a, b, c]
    min = 999999999999999999999999999999999999
    for i in lst:
        if i < min and i > 0:
            min = i
    return min


def f2(a, b, c):
    lst = [a, b, c]
    max = -999999999999999999999999
    for i in lst:
        if i > max and i < 0:
            max = i
    return max


def f3(a, b, c):
    return str(abs(sum([a, b, c])))[0]


def f4(a, b, c):
    return str(abs(sum([a, b, c])))[-1]


def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip()) # DON'T remove this line

# 1640521, 2022-09-24 09:59:47, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    lst = [a, b, c]
    min = 1000
    for i in lst:
        if i < min and i > 0:
            min = i
    return min


def f2(a, b, c):
    lst = [a, b, c]
    max = -1000
    for i in lst:
        if i > max and i < 0:
            max = i
    return max


def f3(a, b, c):
    return int(str(abs(sum([a, b, c])))[0])


def f4(a, b, c):
    return int(str(abs(sum([a, b, c])))[-1])


def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())  # DON'T remove this line

6532152721
# 1639414, 2022-09-24 09:29:52, PP-P[PP][PPPP] (83%)

def f1(a, b, c):
    arr = [a, b, c]
    arr.sort()
    if (arr[1] > 0): return arr[1]
    else: return arr[2]

def f2(a, b, c):
    arr = [a, b, c]
    arr.sort()
    if (arr[1] < 0): return arr[1]
    else: return arr[0]

def f3(a, b, c):
    sum = a + b + c
    if (sum < 0): sum *= -1
    cnt = 0
    x = sum
    while (x > 0):
        x //= 10
        cnt += 1
    # print("cnt = ", cnt)
    return sum // (10 ** (cnt-1))


def f4(a, b, c):
    sum = a + b + c
    if (sum < 0): sum *= -1
    return sum % 10

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if (s1 == 0 and s2 == 0): print(f1(a, b, c))
    elif (s1 == 0 and s2 == 1): print(f2(a, b, c))
    elif (s1 == 1 and s2 == 0): print(f3(a, b, c))
    elif (s1 == 1 and s2 == 1): print(f4(a, b, c))
    else: print("Error")

exec(input().strip()) # DON'T remove this line
# 1640124, 2022-09-24 09:49:05, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    arr = [a, b, c]
    arr.sort()
    if (arr[1] > 0): return arr[1]
    else: return arr[2]

def f2(a, b, c):
    arr = [a, b, c]
    arr.sort()
    if (arr[1] < 0): return arr[1]
    else: return arr[0]

def f3(a, b, c):
    sum = a + b + c
    if (sum < 0): sum *= -1
    cnt = 0
    x = sum
    while (x > 0):
        x //= 10
        cnt += 1
    # print("cnt = ", cnt)
    if (sum == 0): return 0
    return sum // (10 ** (cnt-1))


def f4(a, b, c):
    sum = a + b + c
    if (sum < 0): sum *= -1
    return sum % 10

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if (s1 == 0 and s2 == 0): print(f1(a, b, c))
    elif (s1 == 0 and s2 == 1): print(f2(a, b, c))
    elif (s1 == 1 and s2 == 0): print(f3(a, b, c))
    elif (s1 == 1 and s2 == 1): print(f4(a, b, c))
    else: print("Error")

exec(input().strip()) # DON'T remove this line

6532155621
# 1638882, 2022-09-24 09:17:18, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    tmp = []
    if a > 0:
        tmp.append(a)
    if b > 0:
        tmp.append(b)
    if c > 0:
        tmp.append(c)
    return min(tmp)

def f2(a, b, c):
    tmp = []
    if a < 0:
        tmp.append(a)
    if b < 0:
        tmp.append(b)
    if c < 0:
        tmp.append(c)
    return max(tmp)

def f3(a, b, c):
    return str(abs(a+b+c))[0]

def f4(a, b, c):
    return str(abs(a+b+c))[-1]
    
def main():
    s1, s2, a, b, c = list(map(int, input().strip().split()))
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip()) # DON'T remove this line

# 1638923, 2022-09-24 09:18:07, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    tmp = []
    if a > 0:
        tmp.append(a)
    if b > 0:
        tmp.append(b)
    if c > 0:
        tmp.append(c)
    return min(tmp)

def f2(a, b, c):
    tmp = []
    if a < 0:
        tmp.append(a)
    if b < 0:
        tmp.append(b)
    if c < 0:
        tmp.append(c)
    return max(tmp)

def f3(a, b, c):
    return int(str(abs(a+b+c))[0])

def f4(a, b, c):
    return int(str(abs(a+b+c))[-1])
    
def main():
    s1, s2, a, b, c = list(map(int, input().strip().split()))
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip()) # DON'T remove this line

6532193421
# 1638812, 2022-09-24 09:15:41, PP--[PP][PPPP] (67%)

import math

def f1(a, b, c):
    d=[e for e in [a, b, c] if e>0]
    return min(d)
def f2(a, b, c):
    d=[e for e in [a, b, c] if e<0]
    return max(d)
def f3(a, b, c):
    s=str(abs(a+b+c))
    return s[0]
def f4(a, b, c):
    s=str(abs(a+b+c))
    return s[-1]
def main():
    s1, s2, a, b, c=[int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line
# 1638859, 2022-09-24 09:16:54, PPPP[PP][PPPP] (100%)

import math

def f1(a, b, c):
    d=[e for e in [a, b, c] if e>0]
    return min(d)
def f2(a, b, c):
    d=[e for e in [a, b, c] if e<0]
    return max(d)
def f3(a, b, c):
    s=str(abs(a+b+c))
    return int(s[0])
def f4(a, b, c):
    s=str(abs(a+b+c))
    return int(s[-1])
def main():
    s1, s2, a, b, c=[int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

6531017521
# 1640093, 2022-09-24 09:47:59, PPPP[PP][-PPP] (83%)

def f1(a,b,c):
    l = []
    if a > 0 :
        l += [int(a)]
    if b > 0 :
        l += [int(b)]
    if c > 0 :
        l += [int(c)]
    return min(l)

def f2(a,b,c):
    l = []
    if a < 0 :
        l += [int(a)]
    if b < 0 :
        l += [int(b)]
    if c < 0 :
        l += [int(c)]
    return max(l)

def f3(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    l = [a,b,c]
    ans = (str(abs(sum(l))))[0]
    return int(ans)

def f4(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    l = [a,b,c]
    ans = (str(abs(sum(l))))[-1]
    return int(ans)

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    if not s1 in [0,1] and s2 in [0,1]: 
        print("Error")
    
exec(input().strip()) # DON'T remove this line

    
    

# 1640149, 2022-09-24 09:49:33, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    l = []
    if a > 0 :
        l += [int(a)]
    if b > 0 :
        l += [int(b)]
    if c > 0 :
        l += [int(c)]
    return min(l)

def f2(a,b,c):
    l = []
    if a < 0 :
        l += [int(a)]
    if b < 0 :
        l += [int(b)]
    if c < 0 :
        l += [int(c)]
    return max(l)

def f3(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    l = [a,b,c]
    ans = (str(abs(sum(l))))[0]
    return int(ans)

def f4(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    l = [a,b,c]
    ans = (str(abs(sum(l))))[-1]
    return int(ans)

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    if s1 in [0,1] and s2 in [0,1]:
        None
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line

    
    


6531701021
# 1639158, 2022-09-24 09:23:27, PPxP[PP][P-PP] (67%)

def f1(a, b, c):
    d=[]
    if a>0:
        d.append(a)
    if b>0:
        d.append(b)
    if c>0:
        d.append(c)
    return sorted(d)[0]
def f2(a, b, c):
    e=[]
    if a<0:
        e.append(a)
    if b<0:
        e.append(b)
    if c<0:
        e.append(c)
    return sorted(e)[-1]
def f3(a, b, c):
    g=a+b+c
    return int(str(g)[1])
def f4(a, b, c):
    g=a+b+c
    return int(str(g)[-1])
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1642152, 2022-09-24 10:35:13, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    d=[]
    if a>0:
        d.append(a)
    if b>0:
        d.append(b)
    if c>0:
        d.append(c)
    return sorted(d)[0]
def f2(a, b, c):
    e=[]
    if a<0:
        e.append(a)
    if b<0:
        e.append(b)
    if c<0:
        e.append(c)
    return sorted(e)[-1]
def f3(a, b, c):
    g=a+b+c
    if g<0:
        g=g*-1
    return int(str(g)[0])
def f4(a, b, c):
    g=a+b+c
    return int(str(g)[-1])
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line

6531810821
# 1639722, 2022-09-24 09:37:42, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    ans = []
    for i in [a,b,c] :
        if i > 0 : ans.append(i)
    return min(ans)

def f2(a, b, c):
    ans = []
    for i in [a,b,c] :
        if i < 0 : ans.append(i)
    return max(ans)

def f3(a, b, c):
    ans = []
    for i in [a,b,c] :
        ans.append(i)
    return str(abs(sum(ans)))[0]

def f4(a, b, c):
    ans = []
    for i in [a,b,c] :
        ans.append(i)
    return str(abs(sum(ans)))[-1]

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 : print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 : print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 : print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 : print(f4(a, b, c))
    else : print("Error")
    
exec(input().strip()) 
# 1642351, 2022-09-24 10:37:38, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    ans = []
    for i in [a,b,c] :
        if i > 0 : ans.append(i)
    ans = int(min(ans))
    return ans

def f2(a, b, c):
    ans = []
    for i in [a,b,c] :
        if i < 0 : ans.append(i)
    ans = int(max(ans))
    return ans

def f3(a, b, c):
    ans = []
    for i in [a,b,c] :
        ans.append(i)
    return int(str(abs(sum(ans)))[0])

def f4(a, b, c):
    ans = []
    for i in [a,b,c] :
        ans.append(i)
    return int(str(abs(sum(ans)))[-1])

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 : print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 : print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 : print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 : print(f4(a, b, c))
    else : print("Error")
    
exec(input().strip()) 

6532186021
# 1639248, 2022-09-24 09:25:43, ----[--][----] (0%)

def f1(a,b,c):
    lst = []
    if a > 0:
        lst.append(a)
    if b > 0:
        lst.append(b)
    if c > 0:
        lst.append(c)
    return min(lst)

def f2(a,b,c):
    lst = []
    if a < 0:
        lst.append(a)
    if b < 0:
        lst.append(b)
    if c < 0:
        lst.append(c)
    return max(lst)

def f3(a,b,c):
    SUM = a+b+c
    return int(str(abs(SUM))[0])

def f4(a,b,c):
    SUM = a+b+c
    return int(str(SUM)[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s1 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

    

# 1639272, 2022-09-24 09:26:03, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    lst = []
    if a > 0:
        lst.append(a)
    if b > 0:
        lst.append(b)
    if c > 0:
        lst.append(c)
    return min(lst)

def f2(a,b,c):
    lst = []
    if a < 0:
        lst.append(a)
    if b < 0:
        lst.append(b)
    if c < 0:
        lst.append(c)
    return max(lst)

def f3(a,b,c):
    SUM = a+b+c
    return int(str(abs(SUM))[0])

def f4(a,b,c):
    SUM = a+b+c
    return int(str(SUM)[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s1 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

exec(input().strip()) # DON'T remove this line

6231121821
# 1639681, 2022-09-24 09:36:32, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    w = [a,b,c]
    m = []
    for i in range(len(w)):
        if w[i] > 0:
            m.append(w[i])
    return min(m)
    
def f2(a, b, c):
    w = [a,b,c]
    m = []
    for i in range(len(w)):
        if w[i] < 0:
            m.append(w[i])
    return max(m)

def f3(a, b, c):
    w = [a,b,c]
    s = sum(w)
    if s < 0:
        s *= (-1)
    s = str(s)
    return int(s[0])

def f4(a, b, c):
    w = [a,b,c]
    s = sum(w)
    if s < 0:
        s *= (-1)
    s = str(s)
    return int(s[-1])
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 ==1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
        
exec(input().strip())

6230259621
# 1639301, 2022-09-24 09:26:56, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    f=[]
    if a >0:
        f+=[a]
    if b >0:
        f+=[b]
    if c >0:
        f+=[c]
    g=int(min(f))
    return g
def f2(a, b, c):
    f=[]
    if a <0:
        f+=[a]
    if b <0:
        f+=[b]
    if c <0:
        f+=[c]
    g=int(max(f))
    return g
def f3(a, b, c):
    f=str(abs(a+b+c))
    g=int(f[0])
    return g
def f4(a, b, c):
    f=str(abs(a+b+c))
    g=int(f[-1])
    return g
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print('Error')
        
exec(input().strip()) # DON'T remove this line

6430303721
# 1639803, 2022-09-24 09:39:51, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    x = [a,b,c]
    x.sort()
    y=[]
    for i in range(len(x)):
        if x[i]>0:
            y.append(x[i])
    return int(y[0])
    
def f2(a, b, c):
    x = [a,b,c]
    x.sort()
    y=[]
    for i in range(len(x)):
        if x[i]<0:
            y.append(x[i])
    return int(y[-1])

def f3(a, b, c):
    x = [a,b,c]
    y = sum(x)
    y = str(y)
    if int(y)<0:
        return int(y[1])
    else:
        return int(y[0])

def f4(a, b, c):
    x = [a,b,c]
    y = sum(x)
    y = str(y)
    if int(y)<0:
        return int(y[-1])
    else:
        return int(y[-1])
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print('Error')

exec(input().strip())
    
    
    

    
        


6430314621
# 1639408, 2022-09-24 09:29:40, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    list=[a,b,c]
    x=[]
    for i in list:
        if int(i)>0:
            x.append(int(i))
    x.sort()
    return x[0]
            
def f2(a, b, c):
    list=[a,b,c]
    x=[]
    for i in list:
        if int(i)<0:
            x.append(int(i))
    x.sort()
    return x[-1]
      
def f3(a, b, c):
    d=abs(int(a)+int(b)+int(c))
    d=str(d)
    return int(d[0])

def f4(a, b, c):
    d=abs(int(a)+int(b)+int(c))
    d=str(d)
    return int(d[-1])


def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0:
        if s2==0:
            print(f1(a,b,c))
        elif s2==1:
            print(f2(a,b,c))
        else:
            print('Error')
        
    elif s1==1:
        if s2==0:
            print(f3(a,b,c))
        elif s2==1:
            print(f4(a,b,c))
        else:
            print('Error')
        
    else:
        print('Error')
    
    
exec(input().strip()) # DON'T remove this line



6530049421
# 1639480, 2022-09-24 09:31:26, PPPP[PP][PPPP] (100%)

#Quiz 2
def f1(a, b, c):
    lstpos = []
    if a > 0:
        lstpos.append(a)
    if b > 0:
        lstpos.append(b)
    if c > 0:
        lstpos.append(c)
    min_pos = min(lstpos)
    return int(min_pos)

def f2(a, b, c):
    lstneg = []
    if a < 0:
        lstneg.append(a)
    if b < 0:
        lstneg.append(b)
    if c < 0:
        lstneg.append(c)
    max_neg = max(lstneg)
    return int(max_neg)
    
def f3(a, b, c):
    sum_num = a + b + c
    if sum_num < 0:
        sum_num *= -1
    first_digit = str(sum_num)[0]
    return int(first_digit)

def f4(a, b, c):
    sum_num = a + b + c
    if sum_num < 0:
        sum_num *= -1
    last_digit = str(sum_num)[-1]
    return int(last_digit)

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
    
exec(input().strip()) # DON'T remove this line




6530071121
# 1640732, 2022-09-24 10:05:46, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    x = []
    if a > 0:
        x.append(a)
    if b > 0:
        x.append(b)
    if c > 0:
        x.append(c)
    return min(x)

def f2(a, b, c):
    x = []
    if a < 0:
        x.append(a)
    if b < 0:
        x.append(b)
    if c < 0:
        x.append(c)
    return max(x)
    
def f3(a, b, c):
    x = a+b+c
    z = abs(x)
    z = str(z)
    y = z[0]
    return int(y)

def f4(a, b, c):
    x = a+b+c
    z = abs(x)
    z = str(z)
    y = z[-1]
    return int(y)

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else :
        print("Error")
        
exec(input().strip()) # DON'T remove this line

6530072821
# 1638949, 2022-09-24 09:18:45, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    area  = [i for i in [a,b,c] if i >0]
    return min(area)

def f2(a,b,c):
    area  = [i for i in [a,b,c] if i <0]
    return max(area)

def f3(a,b,c):
    return int(str(abs(a+b+c))[0])

def f4(a,b,c):
    return int(str(abs(a+b+c))[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else: print("Error")
    
exec(input().strip())


6530117421
# 1639237, 2022-09-24 09:25:28, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    list = []
    if a > 0: list.append(a)
    if b > 0: list.append(b)
    if c > 0: list.append(c)
    return int(min(list))
def f2(a,b,c):
    list = []
    if a < 0: list.append(a)
    if b < 0: list.append(b)
    if c < 0: list.append(c)
    return int(max(list))

def f3(a,b,c):
    sum = a + b + c
    sum = abs(sum)
    sum = str(sum)
    return int(sum[0])

def f4(a,b,c):
    sum = a + b + c
    sum = abs(sum)
    sum = str(sum)
    return int(sum[-1])

def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0: print(f1(a,b,c))
    elif s1 == 0 and s2 == 1: print(f2(a, b, c))
    elif s1 == 1 and s2 == 0: print(f3(a, b, c))
    elif s1 == 1 and s2 == 1: print(f4(a, b, c))
    else: print("Error")
    
exec(input().strip()) # DON'T remove this line


6530139221
# 1640406, 2022-09-24 09:57:02, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    LIST = []
    if a > 0:
        LIST.append(a)
    if b > 0:
        LIST.append(b)
    if c > 0:
        LIST.append(c)

    return int(min(LIST))

def f2(a, b, c):
    LIST = []
    if a < 0:
        LIST.append(a)
    if b < 0:
        LIST.append(b)
    if c < 0:
        LIST.append(c)

    return int(max(LIST))

def f3(a, b, c):
    SUM = a + b + c
    DIGIT = str(SUM)

    if DIGIT[0] == "-":
        return int(DIGIT[1])
    else:
        return int(DIGIT[0])

def f4(a, b, c):
    SUM = a + b + c
    DIGIT = str(SUM)

    if DIGIT[-1] == "-":
        return int(DIGIT[-1])
    else:
        return int(DIGIT[-1])

def main():
    #print(f1(2, -18, 4))
    #print(f2(-20, -18, 4))
    #print(f3(2, -18, 4))
    #print(f4(2, -18, 4))
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")

#main()
exec(input().strip())

6530149521
# 1638910, 2022-09-24 09:17:53, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    more = []
    if a > 0 :
        more.append(a)
    if b > 0 :
        more.append(b)
    if c > 0 :
        more.append(c)
    return min(more)
def f2(a, b, c):
    more = []
    if a < 0 :
        more.append(a)
    if b < 0 :
        more.append(b)
    if c < 0 :
        more.append(c)
    return max(more)  
def f3(a, b, c):
    k = a + b + c
    if k > 0 :
        return int(str(k)[0])
    elif k < 0 :
        return int(str(k)[1])
    else :
        return 0
def f4(a, b, c):
    k = a + b + c
    return int(str(k)[-1])
def main():
    s1,s2,a,b,c =[int(x) for x in input().split()]
    
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print("Error")
exec(input().strip())

6530172921
# 1640816, 2022-09-24 10:07:47, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    value=[]
    sub=[]
    value.append(a)
    value.append(b)
    value.append(c)
    for e in value:
        if e>0:
            sub.append(e)
    sub.sort()
    return(sub[0])
def f2(a,b,c):
    value2=[]
    sub2=[]
    value2.append(a)
    value2.append(b)
    value2.append(c)
    for e in value2:
        if e<0:
            sub2.append(e)
        sub2.sort()
    return(sub2[-1])
def f3(a,b,c):
    add=a+b+c
    if add<0:
        add *=-1
    add=str(add)
    return(int(add[0]))
def f4(a,b,c):
    add2=a+b+c
    add2=str(add2)
    return(int(add2[-1]))
def main():
    s1,s2,a,b,c=input().split()
    s1=int(s1)
    s2=int(s2)
    a=int(a)
    b=int(b)
    c=int(c)
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())
    

    
    
    

            



6530175821
# 1639262, 2022-09-24 09:25:55, PPPP[PP][PPPP] (100%)

def f1(a,b,c) :
    x =[]
    if a > 0 :
        x += [a]
    if b > 0 :
        x += [b]
    if c > 0 :
        x += [c]
    return min(x)
def f2(a,b,c) :
    x =[]
    if a < 0 :
        x += [a]
    if b < 0 :
        x += [b]
    if c < 0 :
        x += [c]
    return max(x)
def f3(a,b,c) :
    x = a+b+c
    x = str(x)
    if x[0] == "-" :
        return int(x[1])
    else :
        return int(x[0])
def f4(a,b,c) :
    x = a+b+c
    x = str(x)
    return int(x[-1])
def main() :
    x = [int(e) for e in input().split(" ")]
    if x[0] == 0 and x[1] == 0 :
        print(f1(x[2],x[3],x[4]))
    if x[0] == 0 and x[1] == 1 :
        print(f2(x[2],x[3],x[4]))
    if x[0] == 1 and x[1] == 0 :
        print(f3(x[2],x[3],x[4]))
    if x[0] == 1 and x[1] == 1 :
        print(f4(x[2],x[3],x[4]))
    if x[0] not in range(2) or x[1] not in range(2) :
        print("Error")
exec(input().strip())

6530209521
# 1639307, 2022-09-24 09:27:08, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    l = []
    if a>0 :
        l.append(a)
    if b>0 :
        l.append(b)
    if c>0 :
        l.append(c)
    return min(l)
def f2(a, b, c):
    l = []
    if a<0 :
        l.append(a)
    if b<0 :
        l.append(b)
    if c<0 :
        l.append(c)
    return max(l)    
def f3(a, b, c):
    x = str(abs(a + b + c))
    return int(x[0])
def f4(a, b, c):
    x = str(abs(a + b + c))
    return int(x[-1])
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
exec(input().strip()) # DON'T remove this line

6531305221
# 1639051, 2022-09-24 09:21:13, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    a, b, c = int(a), int(b), int(c)
    x = [a, b, c]
    y = [a, b, c]
    for i in x:
        if i <= 0:
            y.remove(i)
    return min(y)


def f2(a, b, c):
    a, b, c = int(a), int(b), int(c)
    x = [a, b, c]
    y = [a, b, c]
    for i in x:
        if i >= 0:
            y.remove(i)
    return max(y)


def f3(a, b, c):
    a, b, c = int(a), int(b), int(c)
    x = str(abs(a+b+c))
    return int(x[0])


def f4(a, b, c):
    a, b, c = int(a), int(b), int(c)
    x = str(abs(a+b+c))
    return int(x[-1])


def main():
    s1, s2, a, b, c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')


exec(input().strip())  # DON'T remove this line


6531309821
# 1639070, 2022-09-24 09:21:32, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    l = []
    if a > 0:
        l.append(a)
    if b > 0:
        l.append(b)
    if c > 0:
        l.append(c)
    
    return min(l)

def f2(a,b,c):
    l = []
    if a < 0:
        l.append(a)
    if b < 0:
        l.append(b)
    if c < 0:
        l.append(c)
    
    return max(l)

def f3(a,b,c):
    asum = a + b + c
    s = str(asum)
    if s[0] == "-":
        ans = int(s[1])
    else:
        ans = int(s[0])
    
    return ans

def f4(a,b,c):
    asum = a + b + c
    s = str(asum)
    ans = int(s[-1])

    return ans

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip())

6531311021
# 1639643, 2022-09-24 09:35:30, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    lst = [a,b,c]
    new=[]
    for e in lst:
        if e>0:
            new.append(e)
    return int(min(new))
def f2(a, b, c):
    lst = [a,b,c]
    new=[]
    for e in lst:
        if e<0:
            new.append(e)
    return int(max(new))
def f3(a, b, c):
    s=str(abs(a+b+c))
    return int(s[0])
def f4(a, b, c):
    s=str(abs(a+b+c))
    return int(s[-1])
def main():
    s1, s2, a, b, c = input().strip().split()
    s1 = int(s1)
    s2 = int(s2)
    a = int(a)
    b = int(b)
    c = int(c)
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())

6531317821
# 1639079, 2022-09-24 09:21:41, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    g = []
    for k in [a,b,c]:
        if k > 0:
            g.append(k)
    return min(g)
def f2(a, b, c):
    g = []
    for k in [a,b,c]:
        if k < 0:
            g.append(k)
    return max(g)
def f3(a, b, c):
    s = str(abs(a+b+c))
    return int(s[0])
def f4(a, b, c):
    s = str(abs(a+b+c))
    return int(s[-1])
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip())

6531323521
# 1639250, 2022-09-24 09:25:44, PPPP[PP][PPPP] (100%)

def f1(a,b,c):
    min_ = []
    if a > 0:
        min_.append(a)
    if b> 0 :
        min_.append(b)
    if c> 0:
        min_.append(c)
    return min(min_)
def f2(a,b,c):
    max_ = []
    if a < 0:
        max_.append(a)
    if b < 0 :
        max_.append(b)
    if c < 0:
        max_.append(c)
    return max(max_)
def f3(a, b, c): 
    x = a+b+c 
    if x< 0:
        x *= -1
    x = str(x)
    return int(x[0])
def f4(a, b, c) :
    x = a+b+c 
    if x< 0 :
        x *= -1
    x = str(x)
    x = x[-1]
    return int(x)
def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2==1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1==1 and s2 ==1 :
        print(f4(a, b, c))
    else :
        print("Error")













exec(input().strip()) # DON'T remove this line

6531326421
# 1639196, 2022-09-24 09:24:19, PPPP[PP][PPPP] (100%)

def f1(a, b, c) :
    f1 = []
    if a > 0 :
        f1.append(a)
    if b > 0 :
        f1.append(b)
    if c > 0 :
        f1.append(c)
    return min(f1)

def f2(a, b, c) :
    f2 = []
    if a < 0 :
        f2.append(a)
    if b < 0 :
        f2.append(b)
    if c < 0 :
        f2.append(c)
    return max(f2)

def f3(a, b, c) :
    added_abc = abs(a + b +c)
    first_digit = str(added_abc)[0]
    return int(first_digit)

def f4(a, b, c) :
    added_abc = abs(a + b +c)
    last_digit = added_abc % 10
    return last_digit

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print('Error')
        
exec(input().strip())


6531329321
# 1639168, 2022-09-24 09:23:44, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    s = [a,b,c]
    for i in range(3) :
        if s[i] <= 0 :
            s[i] = max(s)
    return min(s)

def f2(a, b, c):
    s = [a,b,c]
    for i in range(3) :
        if s[i] >= 0 :
            s[i] = min(s)
    return max(s)

def f3(a, b, c):
    s = str(abs(a+b+c))
    return int(s[0])

def f4(a, b, c):
    s = str(abs(a+b+c))
    return int(s[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 == s2:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 ==s2 :
        print(f4(a,b,c))
    else :
        print('Error')

exec(input().strip()) # DON'T remove this line

6531337321
# 1639223, 2022-09-24 09:24:57, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    return min([i for i in [a, b, c] if i > 0])

def f2(a, b, c):
    return max([i for i in [a, b, c] if i < 0])

def f3(a, b, c):
    tmp = a + b + c
    if tmp >= 0:
        return int(str(tmp)[0])
    else:
        return int(str(tmp)[1])

def f4(a, b, c):
    return int(str(a + b + c)[-1])

def main():
    s1, s2, a, b, c = map(int, input().split())

    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')


exec(input().strip()) # DON'T remove this line

6531343021
# 1639045, 2022-09-24 09:20:58, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    minf = 1000
    for i in [a, b, c]:
        if 0 < i < minf:
            minf = i
    return minf
def f2(a, b, c):
    maxf = -1000
    for i in [a, b, c]:
        if maxf < i < 0:
            maxf = i
    return maxf
def f3(a, b, c):
    sumf = a + b + c
    if sumf < 0:
        sumf *= -1
    sumf = str(sumf)
    return int(sumf[0])
def f4(a, b, c):
    sumf = str(a + b + c)
    return int(sumf[-1])
def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line


6532011921
# 1638966, 2022-09-24 09:19:06, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    ans = -1
    if a > 0 and (ans == -1 or a < ans):
        ans = a
    if b > 0 and (ans == -1 or b < ans):
        ans = b
    if c > 0 and (ans == -1 or c < ans):
        ans = c
    return ans
 
def f2(a, b, c):
    ans = 1
    if a < 0 and (ans == 1 or a > ans):
        ans = a
    if b < 0 and (ans == 1 or b > ans):
        ans = b
    if c < 0 and (ans == 1 or c > ans):
        ans = c
    return ans

def f3(a, b, c):
    return int(str(abs(a+b+c))[0])
 
def f4(a, b, c):
    return abs(a+b+c) % 10
 
def main():
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

exec(input().strip()) # DON'T remove this line


6532054921
# 1639055, 2022-09-24 09:21:16, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    get_min = 10000000
    if a > 0 :
        get_min = min(get_min,a)
    if b > 0: 
        get_min = min(get_min,b)
    if c > 0 :
        get_min = min(get_min,c)
    return get_min
def f2(a, b, c):
    get_max = -10000000
    if a < 0 :
        get_max = max(get_max,a)
    if b < 0 :
        get_max = max(get_max,b)
    if c < 0 :
        get_max = max(get_max,c)
    return get_max
def f3(a, b, c):
    sum = a + b + c
    return int(str(abs(sum))[0])
def f4(a, b, c):
    sum  = a + b + c
    return abs(sum) % 10
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if(s1 == 0 and s2 == 0) :
        print(f1(a,b,c))
    elif(s1 == 0 and s2 == 1) :
        print(f2(a,b,c))
    elif(s1 == 1 and s2 == 0) :
        print(f3(a,b,c))
    elif(s1 == 1 and s2 == 1) :
        print(f4(a,b,c))
    else :
        print("Error")
exec(input().strip()) # DON'T remove this line

6532068721
# 1638983, 2022-09-24 09:19:31, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    return min(filter(lambda x: x > 0, (a, b, c)))


def f2(a, b, c):
    return max(filter(lambda x: x < 0, (a, b, c)))


def f3(a, b, c):
    return int(str(abs(a + b + c))[0])


def f4(a, b, c):
    return int(str(a + b + c)[-1])


def main():
    s1, s2, a, b, c = (int(k) for k in input().split(' '))

    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())


6532118421
# 1639741, 2022-09-24 09:38:18, PPPP[PP][PPPP] (100%)

def f1(a, b, c) :
    mix = max(a,b,c)
    if a>0 : mix=min(mix,a)
    if b>0 : mix=min(mix,b)
    if c>0 : mix=min(mix,c)
    return mix

def f2(a, b, c) :
    mix = min(a,b,c)
    if a<0 : mix=max(mix,a)
    if b<0 : mix=max(mix,b)
    if c<0 : mix=max(mix,c)
    return mix

def f3(a, b, c) :
    sum = a+b+c
    if sum==0 : return 0
    x = -1
    while int(sum)!=0 :
        sum /= 10
        x += 1
    return int(abs(a+b+c)/(10**x))

def f4(a, b, c) :
    return int(abs(a+b+c)%10)

def main() :
    n = list(map(int,input().split(" ")))
    s1,s2,a,b,c = [x for x in n]
    if s1==0 :
        if s2==0 : print(f1(a, b, c))
        elif s2==1 : print(f2(a, b, c))
        else : print("Error")
    elif s1==1 :
        if s2==0 : print(f3(a, b, c))
        elif s2==1 : print(f4(a, b, c))
        else : print("Error")
    else : print("Error")

exec(input().strip())

6532120621
# 1638828, 2022-09-24 09:16:09, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกําหนดข้างบน
    # คืนจํานวนเต็มที่มีค่าเท่ากับค่าน้อยท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    m = 100000
    for x in [a,b,c]:
        if x > 0:
            m = min(x, m)
    return m
    
def f2(a, b, c):
    # a, b และ c มีค่าตามข้อกําหนดข้างบน
    # คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    m = -100000
    for x in [a,b,c]:
        if x < 0:
            m = max(m, x)
    return m
def f3(a, b, c):
    # a, b และ c มีค่าตามข้อกําหนดข้างบน
    # คืนจํานวนเต็ม (ไม่มีเคร่ืองหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
    return int(str(abs(a + b + c))[0])
def f4(a, b, c):
    # a, b และ c มีค่าตามข้อกําหนดข้างบน
    # คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    return abs(a + b + c)%10
def main():
    # รับข้อมูลจากคีย์บอร์ดเป็นจํานวนเต็ม 5 จํานวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
    # ค่าของ a, b และ c เป็นไปตามข้อกําหนดข้างบน
    # ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c) # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c) # ถ้าs1 หรือs2 เป็นค่าอ่ืนให้แสดงคําว่าError
    s1, s2, a, b, c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip()) # DON'T remove this line

6532141821
# 1639422, 2022-09-24 09:30:03, PPPP[PP][PPPP] (100%)

def f1(a,b,c) :
    ans = []
    for e in [a,b,c] :
        if e > 0 :
            ans.append(e)
    return min(ans)

def f2(a,b,c) :
    ans = []
    for e in [a,b,c] :
        if e < 0 :
            ans.append(e)
    return max(ans)

def f3(a,b,c) :
    ans = a+b+c
    ans = abs(ans)
    first = str(ans)[0]
    return int(first)

def f4(a,b,c) :
    ans = a+b+c
    ans = abs(ans)
    last = str(ans)[-1]
    return int(last)

def main() :
    [s1,s2,a,b,c] = input().strip().split()
    if int(s1) == 0 and int(s2) == 0 :
        print(f1(int(a),int(b),int(c)))
    elif int(s1) == 0 and int(s2) == 1 :
        print(f2(int(a),int(b),int(c)))
    elif int(s1) == 1 and int(s2) == 0 :
        print(f3(int(a),int(b),int(c)))
    elif int(s1) == 1 and int(s2) == 1 :
        print(f4(int(a),int(b),int(c)))
    else :
        print("Error")

exec(input().strip())

6532187721
# 1638948, 2022-09-24 09:18:43, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    ans = 1001
    if ans>a and a>0:ans=a
    if ans>b and b>0:ans=b
    if ans>c and c>0:ans=c
    return ans

def f2(a, b, c):
    ans = -1001
    if ans<a and a<0:ans=a
    if ans<b and b<0:ans=b
    if ans<c and c<0:ans=c
    return ans

def f3(a, b, c):
    ans = a+b+c
    if ans<0:
        ans=-ans
    ans = str(ans)
    return int(ans[0])

def f4(a, b, c):
    ans = a+b+c
    ans = str(ans)
    return int(ans[-1])

def main():
    s1,s2,a,b,c = input().split()
    s1 = int(s1)
    s2= int(s2)
    a = int(a)
    b = int(b)
    c = int(c)
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip())

6532203021
# 1639031, 2022-09-24 09:20:40, PPPP[PP][PPPP] (100%)

def f1(a, b, c):
    choose = []
    if a>0:
        choose.append(a)
    if b>0:
        choose.append(b)
    if c>0:
        choose.append(c)
    choose.sort()
    return choose[0]
def f2(a, b, c):
    choose = []
    if a<0:
        choose.append(a)
    if b<0:
        choose.append(b)
    if c<0:
        choose.append(c)
    choose.sort()
    return choose[-1]
def f3(a, b, c):
    sum = a+b+c
    sum = int(str(abs(sum))[0])
    return sum
def f4(a, b, c):
    sum = a+b+c
    sum = int(str(abs(sum))[-1])
    return sum
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip()) # DON'T remove this line

Max Score = 83


6530037921
# 1641115, 2022-09-24 10:15:44, xxxx[xx][xxxx] (0%)

def f1(a,b,c):
    x =[a,b,c]
    z = []
    for i in x:
        if i > 0:
            z.append(i)
    return min(z)

def f2(a,b,c):
    x =[a,b,c]
    z = []
    for i in x:
        if i > 0:
            z.append(i)
    return max(z)

def f3(a,b,c):
    z = a+b+c
    sz=len(str(abs(z)))
    z = int(abs(z)/10**(sz-1))
    return z
    
def f4(a,b,c):
    z = a+b+c
    z = abs(z)%10
    return z

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    print(s1,s2,a,b,c)
    if s1 == 0 and s2 == 0:
        result = f1(a,b,c)
        print(result)
    elif s1 == 0 and s2 == 1:
        result = f2(a,b,c)
        print(result)
    elif s1 == 1 and s2 == 0:
        result = f3(a,b,c)
        print(result)
    elif s1 == 1 and s2 == 1:
        result = f4(a,b,c)
        print(result)
    else:
        print("Error")
        
main()
        
exec(input().strip()) 
# 1641382, 2022-09-24 10:21:03, xxxx[xx][xxxx] (0%)

def f1(a,b,c):
    x =[a,b,c]
    z = []
    for i in x:
        if i > 0:
            z.append(i)
    return min(z)

def f2(a,b,c):
    x =[a,b,c]
    z = []
    for i in x:
        if i > 0:
            z.append(i)
    return max(z)

def f3(a,b,c):
    z = a+b+c
    sz=len(str(abs(z)))
    z = int(abs(z)/10**(sz-1))
    return z
    
def f4(a,b,c):
    z = a+b+c
    z = abs(z)%10
    return z

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000:
        print(s1,s2,a,b,c)
        if s1 == 0 and s2 == 0:
            result = f1(a,b,c)
            print(result)
        elif s1 == 0 and s2 == 1:
            result = f2(a,b,c)
            print(result)
        elif s1 == 1 and s2 == 0:
            result = f3(a,b,c)
            print(result)
        elif s1 == 1 and s2 == 1:
            result = f4(a,b,c)
            print(result)
        else:
            print("Error")
        
main()
        
exec(input().strip()) 
    

# 1641432, 2022-09-24 10:22:05, xxxx[xx][xxxx] (0%)

def f1(a,b,c):
    x =[a,b,c]
    z = []
    for i in x:
        if i > 0:
            z.append(i)
    return min(z)

def f2(a,b,c):
    x =[a,b,c]
    z = []
    for i in x:
        if i > 0:
            z.append(i)
    return max(z)

def f3(a,b,c):
    z = a+b+c
    sz=len(str(abs(z)))
    z = int(abs(z)/10**(sz-1))
    return z
    
def f4(a,b,c):
    z = a+b+c
    z = abs(z)%10
    return z

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000:
        if s1 == 0 and s2 == 0:
            result = f1(a,b,c)
            print(result)
        elif s1 == 0 and s2 == 1:
            result = f2(a,b,c)
            print(result)
        elif s1 == 1 and s2 == 0:
            result = f3(a,b,c)
            print(result)
        elif s1 == 1 and s2 == 1:
            result = f4(a,b,c)
            print(result)
        else:
            print("Error")
        
main()
        
exec(input().strip()) 
    

# 1641734, 2022-09-24 10:27:55, P-PP[P-][----] (50%)

def f1(a,b,c):
    x =[a,b,c]
    z = []
    for i in x:
        if i > 0:
            z.append(i)
    return min(z)

def f2(a,b,c):
    x =[a,b,c]
    z = []
    for i in x:
        if i > 0:
            z.append(i)
    return max(z)

def f3(a,b,c):
    z = a+b+c
    sz=len(str(abs(z)))
    z = int(abs(z)/10**(sz-1))
    return z
    
def f4(a,b,c):
    z = a+b+c
    z = abs(z)%10
    return z

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000:
        if s1 == 0 and s2 == 0:
            result = f1(a,b,c)
            print(result)
        elif s1 == 0 and s2 == 1:
            result = f2(a,b,c)
            print(result)
        elif s1 == 1 and s2 == 0:
            result = f3(a,b,c)
            print(result)
        elif s1 == 1 and s2 == 1:
            result = f4(a,b,c)
            print(result)
        else:
            print("Error")
        
        
exec(input().strip()) 
    

# 1641812, 2022-09-24 10:29:23, PPPP[PP][----] (83%)

def f1(a,b,c):
    x =[a,b,c]
    z = []
    for i in x:
        if i > 0:
            z.append(i)
    return min(z)

def f2(a,b,c):
    x =[a,b,c]
    z = []
    for i in x:
        if i < 0:
            z.append(i)
    return max(z)

def f3(a,b,c):
    z = a+b+c
    sz=len(str(abs(z)))
    z = int(abs(z)/10**(sz-1))
    return z
    
def f4(a,b,c):
    z = a+b+c
    z = abs(z)%10
    return z

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000:
        if s1 == 0 and s2 == 0:
            result = f1(a,b,c)
            print(result)
        elif s1 == 0 and s2 == 1:
            result = f2(a,b,c)
            print(result)
        elif s1 == 1 and s2 == 0:
            result = f3(a,b,c)
            print(result)
        elif s1 == 1 and s2 == 1:
            result = f4(a,b,c)
            print(result)
        else:
            print("Error")
        
        
exec(input().strip()) 
    

# 1641998, 2022-09-24 10:32:40, PPPP[PP][----] (83%)

def f1(a,b,c):
    x =[a,b,c]
    z = []
    for i in x:
        if i > 0:
            z.append(i)
    return min(z)

def f2(a,b,c):
    x =[a,b,c]
    z = []
    for i in x:
        if i < 0:
            z.append(i)
    return max(z)

def f3(a,b,c):
    z = a+b+c
    sz=len(str(abs(z)))
    z = int(abs(z)/10**(sz-1))
    return z
    
def f4(a,b,c):
    z = a+b+c
    z = abs(z)%10
    return z

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000:
        if (a<0 or b<0 or c<0)and(a>0 or b>0 or c>0):
            if s1 == 0 and s2 == 0:
                result = f1(a,b,c)
                print(result)
            elif s1 == 0 and s2 == 1:
                result = f2(a,b,c)
                print(result)
            elif s1 == 1 and s2 == 0:
                result = f3(a,b,c)
                print(result)
            elif s1 == 1 and s2 == 1:
                result = f4(a,b,c)
                print(result)
            else:
                print("Error")
        
        
exec(input().strip()) 
# 1642236, 2022-09-24 10:36:17, PPPP[PP][----] (83%)

def f1(a,b,c):
    x =[a,b,c]
    z = []
    for i in x:
        if i > 0:
            z.append(i)
    return min(z)

def f2(a,b,c):
    x =[a,b,c]
    z = []
    for i in x:
        if i < 0:
            z.append(i)
    return max(z)

def f3(a,b,c):
    z = a+b+c
    sz=len(str(abs(z)))
    z = int(abs(z)/10**(sz-1))
    return z
    
def f4(a,b,c):
    z = a+b+c
    z = abs(z)%10
    return z

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000:
        if s1 == 0 and s2 == 0:
            result = f1(a,b,c)
            print(result)
        elif s1 == 0 and s2 == 1:
            result = f2(a,b,c)
            print(result)
        elif s1 == 1 and s2 == 0:
            result = f3(a,b,c)
            print(result)
        elif s1 == 1 and s2 == 1:
            result = f4(a,b,c)
            print(result)
        else:
            print("Error")
        
        
exec(input().strip()) 
    

# 1642390, 2022-09-24 10:38:11, PPPP[PP][----] (83%)

def f1(a,b,c):
    x =[a,b,c]
    z = []
    for i in x:
        if i > 0:
            z.append(i)
    return min(z)

def f2(a,b,c):
    x =[a,b,c]
    z = []
    for i in x:
        if i < 0:
            z.append(i)
    return max(z)

def f3(a,b,c):
    z = a+b+c
    sz=len(str(abs(z)))
    z = int(abs(z)/10**(sz-1))
    return z
    
def f4(a,b,c):
    z = a+b+c
    z = abs(z)%10
    return z

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000:
        if s1 == 0 and s2 == 0:
            result = f1(a,b,c)
            print(result)
        elif s1 == 0 and s2 == 1:
            result = f2(a,b,c)
            print(result)
        elif s1 == 1 and s2 == 0:
            result = f3(a,b,c)
            print(result)
        elif s1 == 1 and s2 == 1:
            result = f4(a,b,c)
            print(result)
        else:
            print("Error")
        
        
exec(input().strip()) 
    



6530014421
# 1639792, 2022-09-24 09:39:22, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x=[]
    if a>0:
        x+=[a]
    if b>0:
        x+=[b]
    if c>0:
        x+=[c]
    return min(x)

def f2(a, b, c):
    x=[]
    if a<0:
        x+=[a]
    if b<0:
        x+=[b]
    if c<0:
        x+=[c]
    return max(x)
    
def f3(a, b, c):
    s=a+b+c
    if -10<s<10:
        return abs(s)
    elif -100<s<=-10 or 10<=s<100:
        return abs(s)//10
    elif -1000<s<=-100 or 100<=s<1000:
        return abs(s)//100
    else:
        return abs(s)//1000

def f4(a, b, c):
    s=a+b+c
    if -10<s<10:
        return abs(s)
    elif -100<s<=-10 or 10<=s<100:
        return abs(s)%10
    elif -1000<s<=-100 or 100<=s<1000:
        return abs(s)%100
    else:
        return abs(s)%1000

def main():
    s1,s2,a,b,c=[int(i) for i in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
        
exec(input().strip()) # DON'T remove this line

# 1640185, 2022-09-24 09:50:32, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x=[]
    if a>0:
        x+=[a]
    if b>0:
        x+=[b]
    if c>0:
        x+=[c]
    return min(x)

def f2(a, b, c):
    x=[]
    if a<0:
        x+=[a]
    if b<0:
        x+=[b]
    if c<0:
        x+=[c]
    return max(x)
    
def f3(a, b, c):
    s=abs(a+b+c)
    if s<10:
        return s
    elif 10<=s<100:
        return s//10
    elif 100<=s<1000:
        return s//100
    else:
        return s//1000

def f4(a, b, c):
    s=abs(a+b+c)
    if s<10:
        return s
    elif 10<=s<100:
        return s%10
    elif 100<=s<1000:
        return (s%100)//10
    else:
        return (s%1000)//100

def main():
    s1,s2,a,b,c=[int(i) for i in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
        
exec(input().strip()) # DON'T remove this line

# 1641264, 2022-09-24 10:18:54, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x=[]
    if a>0:
        x+=[a]
    if b>0:
        x+=[b]
    if c>0:
        x+=[c]
    return min(x)

def f2(a, b, c):
    x=[]
    if a<0:
        x+=[a]
    if b<0:
        x+=[b]
    if c<0:
        x+=[c]
    return max(x)
    
def f3(a, b, c):
    s=abs(a+b+c)
    if s<10:
        return s
    elif 10<=s<100:
        return s//10
    elif 100<=s<1000:
        return s//100
    else:
        return s//1000

def f4(a, b, c):
    s=abs(a+b+c)
    if s<10:
        return s
    elif 10<=s<100:
        return s%10
    elif 100<=s<1000:
        return (s%100)//10
    else:
        return (s%1000)//100

def main():
    s1,s2,a,b,c=[int(i) for i in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
        
exec(input().strip()) # DON'T remove this line

# 1641765, 2022-09-24 10:28:30, PP-P[PP][PPPP] (83%)

def f1(a, b, c):
    x=[]
    if a>0:
        x+=[a]
    if b>0:
        x+=[b]
    if c>0:
        x+=[c]
    return min(x)

def f2(a, b, c):
    x=[]
    if a<0:
        x+=[a]
    if b<0:
        x+=[b]
    if c<0:
        x+=[c]
    return max(x)
    
def f3(a, b, c):
    s=abs(a+b+c)
    if s<10:
        return s
    elif 10<=s<100:
        return s//10
    elif 100<=s<1000:
        return s//100
    else:
        return s//1000

def f4(a, b, c):
    s=abs(a+b+c)
    return s%10

def main():
    s1,s2,a,b,c=[int(i) for i in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
        
exec(input().strip()) # DON'T remove this line

# 1642192, 2022-09-24 10:35:40, PP-P[PP][PPPP] (83%)

def f1(a, b, c):
    x=[]
    if a>0:
        x+=[a]
    if b>0:
        x+=[b]
    if c>0:
        x+=[c]
    return min(x)

def f2(a, b, c):
    x=[]
    if a<0:
        x+=[a]
    if b<0:
        x+=[b]
    if c<0:
        x+=[c]
    return max(x)
    
def f3(a, b, c):
    s=abs(a+b+c)
    if s<10:
        return s
    elif 10<=s<100:
        return s//10
    elif 100<=s<1000:
        return s//100
    else:
        return s//1000

def f4(a, b, c):
    s=abs(a+b+c)
    return s%10

def main():
    s1,s2,a,b,c=[int(i) for i in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
        
exec(input().strip()) # DON'T remove this line

# 1642327, 2022-09-24 10:37:26, PP-P[PP][-P-P] (67%)

def f1(a, b, c):
    x=[]
    if a>0:
        x+=[a]
    if b>0:
        x+=[b]
    if c>0:
        x+=[c]
    return min(x)

def f2(a, b, c):
    x=[]
    if a<0:
        x+=[a]
    if b<0:
        x+=[b]
    if c<0:
        x+=[c]
    return max(x)
    
def f3(a, b, c):
    s=abs(a+b+c)
    if s<10:
        return s
    elif 10<=s<100:
        return s//10
    elif 100<=s<1000:
        return s//100
    else:
        return s//1000

def f4(a, b, c):
    s=abs(a+b+c)
    return s%10

def main():
    s1,s2,a,b,c=[int(i) for i in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('error')
        
exec(input().strip()) # DON'T remove this line
# 1642362, 2022-09-24 10:37:46, PP-P[PP][PPPP] (83%)

def f1(a, b, c):
    x=[]
    if a>0:
        x+=[a]
    if b>0:
        x+=[b]
    if c>0:
        x+=[c]
    return min(x)

def f2(a, b, c):
    x=[]
    if a<0:
        x+=[a]
    if b<0:
        x+=[b]
    if c<0:
        x+=[c]
    return max(x)
    
def f3(a, b, c):
    s=abs(a+b+c)
    if s<10:
        return s
    elif 10<=s<100:
        return s//10
    elif 100<=s<1000:
        return s//100
    else:
        return s//1000

def f4(a, b, c):
    s=abs(a+b+c)
    return s%10

def main():
    s1,s2,a,b,c=[int(i) for i in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
        
exec(input().strip()) # DON'T remove this line

6530088921
# 1639662, 2022-09-24 09:35:58, PP-P[PP][PPPP] (83%)

def f1(a, b, c):
    data = [a,b,c]
    result = []
    for i in data :
        if i > 0 :
            result += [i]
    return min(result)
def f2(a, b, c):
    data = [a,b,c]
    result = []
    for i in data :
        if i < 0 :
            result += [i]
    return max(result)
def f3(a, b, c):
    x = a+b+c
    x = abs(x)
    if x >= 1000 :
        x //= 1000
    elif x >= 100:
        x//=100
    elif x >= 10 :
        x//=10
    else :
        x = x
    return x
def f4(a, b, c):
    x = a+b+c
    x = abs(x)
    x %= 10
    return x
def main():
    data = input().split(' ')
    if data[0] == '0' and data[1] == '0' :
        print(f1(int(data[2]),int(data[3]),int(data[4])))
    elif data[0] == '0' and data[1] == '1' :
        print(f2(int(data[2]),int(data[3]),int(data[4])))
    elif data[0] == '1' and data[1] == '0' :
        print(f3(int(data[2]),int(data[3]),int(data[4])))
    elif data[0] == '1' and data[1] == '1' :
        print(f4(int(data[2]),int(data[3]),int(data[4])))
    else :
        print('Error')
exec(input().strip()) # DON'T remove this line 
# 1641594, 2022-09-24 10:25:26, PP-P[PP][PPPP] (83%)

def f1(a, b, c):
    data = [a,b,c]
    result = []
    for i in data :
        if i > 0 :
            result += [i]
    return min(result)
def f2(a, b, c):
    data = [a,b,c]
    result = []
    for i in data :
        if i < 0 :
            result += [i]
    return max(result)
def f3(a, b, c):
    x = a+b+c
    x = abs(x)
    y = str(x)
    if x >= 1000 :
        x //= 1000
    else:
        if x >= 100:
            x //=100
        else :
            if x >= 10 :
                x //=10
            else :
                x = x
    return x
def f4(a, b, c):
    x = a+b+c
    x = abs(x)
    x %= 10
    return x
def main():
    data = input().split(' ')
    if data[0] == '0' and data[1] == '0' :
        print(f1(int(data[2]),int(data[3]),int(data[4])))
    elif data[0] == '0' and data[1] == '1' :
        print(f2(int(data[2]),int(data[3]),int(data[4])))
    elif data[0] == '1' and data[1] == '0' :
        print(f3(int(data[2]),int(data[3]),int(data[4])))
    elif data[0] == '1' and data[1] == '1' :
        print(f4(int(data[2]),int(data[3]),int(data[4])))
    else :
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1641807, 2022-09-24 10:29:18, PP-P[PP][PPPP] (83%)

def f1(a, b, c):
    data = [a,b,c]
    result = []
    for i in data :
        if i > 0 :
            result += [i]
    return min(result)
def f2(a, b, c):
    data = [a,b,c]
    result = []
    for i in data :
        if i < 0 :
            result += [i]
    return max(result)
def f3(a, b, c):
    x = a+b+c
    x = abs(x)
    y = str(x)
    if x >= 1000 :
        x //= 1000
    elif x >= 100:
        x //=100
    elif x >= 10 :
        x //=10
    else :
        pass
    return x
def f4(a, b, c):
    x = a+b+c
    x = abs(x)
    x %= 10
    return x
def main():
    data = input().split(' ')
    if data[0] == '0' and data[1] == '0' :
        print(f1(int(data[2]),int(data[3]),int(data[4])))
    elif data[0] == '0' and data[1] == '1' :
        print(f2(int(data[2]),int(data[3]),int(data[4])))
    elif data[0] == '1' and data[1] == '0' :
        print(f3(int(data[2]),int(data[3]),int(data[4])))
    elif data[0] == '1' and data[1] == '1' :
        print(f4(int(data[2]),int(data[3]),int(data[4])))
    else :
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1641836, 2022-09-24 10:29:47, P--P[P-][PPPP] (50%)

def f1(a, b, c):
    data = [a,b,c]
    result = []
    for i in data :
        if i > 0 :
            result += [i]
    return min(result)
def f2(a, b, c):
    data = [a,b,c]
    result = []
    for i in data :
        if i < 0 :
            result += [i]
    return min(result)
def f3(a, b, c):
    x = a+b+c
    x = abs(x)
    y = str(x)
    if x >= 1000 :
        x //= 1000
    elif x >= 100:
        x //=100
    elif x >= 10 :
        x //=10
    else :
        pass
    return x
def f4(a, b, c):
    x = a+b+c
    x = abs(x)
    x %= 10
    return x
def main():
    data = input().split(' ')
    if data[0] == '0' and data[1] == '0' :
        print(f1(int(data[2]),int(data[3]),int(data[4])))
    elif data[0] == '0' and data[1] == '1' :
        print(f2(int(data[2]),int(data[3]),int(data[4])))
    elif data[0] == '1' and data[1] == '0' :
        print(f3(int(data[2]),int(data[3]),int(data[4])))
    elif data[0] == '1' and data[1] == '1' :
        print(f4(int(data[2]),int(data[3]),int(data[4])))
    else :
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1641857, 2022-09-24 10:30:06, PP-P[PP][PPPP] (83%)

def f1(a, b, c):
    data = [a,b,c]
    result = []
    for i in data :
        if i > 0 :
            result += [i]
    return min(result)
def f2(a, b, c):
    data = [a,b,c]
    result = []
    for i in data :
        if i < 0 :
            result += [i]
    return max(result)
def f3(a, b, c):
    x = a+b+c
    x = abs(x)
    y = str(x)
    if x >= 1000 :
        x //= 1000
    elif x >= 100:
        x //=100
    elif x >= 10 :
        x //=10
    else :
        pass
    return x
def f4(a, b, c):
    x = a+b+c
    x = abs(x)
    x %= 10
    return x
def main():
    data = input().split(' ')
    if data[0] == '0' and data[1] == '0' :
        print(f1(int(data[2]),int(data[3]),int(data[4])))
    elif data[0] == '0' and data[1] == '1' :
        print(f2(int(data[2]),int(data[3]),int(data[4])))
    elif data[0] == '1' and data[1] == '0' :
        print(f3(int(data[2]),int(data[3]),int(data[4])))
    elif data[0] == '1' and data[1] == '1' :
        print(f4(int(data[2]),int(data[3]),int(data[4])))
    else :
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1641871, 2022-09-24 10:30:18, PP-P[PP][PPPP] (83%)

def f1(a, b, c):
    data = [a,b,c]
    result = []
    for i in data :
        if i > 0 :
            result += [i]
    return min(result)
def f2(a, b, c):
    data = [a,b,c]
    result = []
    for i in data :
        if i < 0 :
            result += [i]
    return max(result)
def f3(a, b, c):
    x = a+b+c
    x = abs(x)
    if x >= 1000 :
        x //= 1000
    elif x >= 100:
        x //=100
    elif x >= 10 :
        x //=10
    else :
        pass
    return x
def f4(a, b, c):
    x = a+b+c
    x = abs(x)
    x %= 10
    return x
def main():
    data = input().split(' ')
    if data[0] == '0' and data[1] == '0' :
        print(f1(int(data[2]),int(data[3]),int(data[4])))
    elif data[0] == '0' and data[1] == '1' :
        print(f2(int(data[2]),int(data[3]),int(data[4])))
    elif data[0] == '1' and data[1] == '0' :
        print(f3(int(data[2]),int(data[3]),int(data[4])))
    elif data[0] == '1' and data[1] == '1' :
        print(f4(int(data[2]),int(data[3]),int(data[4])))
    else :
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1642118, 2022-09-24 10:34:35, PP-P[PP][PPPP] (83%)

def f1(a, b, c):
    data = [a,b,c]
    result = []
    for i in data :
        if i > 0 :
            result += [i]
    return min(result)
def f2(a, b, c):
    data = [a,b,c]
    result = []
    for i in data :
        if i < 0 :
            result += [i]
    return max(result)
def f3(a, b, c):
    x = a+b+c
    x = abs(x)
    if x >= 1000 :
        x //= 1000
    elif x >= 100:
        x //=100
    elif x >= 10 :
        x //=10
    else :
        x //= 1
    return x
def f4(a, b, c):
    x = a+b+c
    x = abs(x)
    x %= 10
    return x
def main():
    data = input().split(' ')
    if data[0] == '0' and data[1] == '0' :
        print(f1(int(data[2]),int(data[3]),int(data[4])))
    elif data[0] == '0' and data[1] == '1' :
        print(f2(int(data[2]),int(data[3]),int(data[4])))
    elif data[0] == '1' and data[1] == '0' :
        print(f3(int(data[2]),int(data[3]),int(data[4])))
    elif data[0] == '1' and data[1] == '1' :
        print(f4(int(data[2]),int(data[3]),int(data[4])))
    else :
        print('Error')
exec(input().strip()) # DON'T remove this line

6531319021
# 1639139, 2022-09-24 09:23:03, --xP[--][PxPx] (17%)

def f1(a, b, c):
    x = []
    if a > 0:
        x.append(a)
    if b>0:
        x.append(b)
    if c>0:
        x.append(c)
    y = max(x)
    return int(y)

def f2(a, b, c):
    x = []
    if a < 0:
        x.append(a)
    if b<0:
        x.append(b)
    if c<0:
        x.append(c)
    y = min(x)
    return int(y)
    
def f3(a, b, c):
    x = abs(a+b+c)
    return x[0]

def f4(a, b, c):
    x = abs(a+b+c)
    y = int(x)%10
    return y

def main():
    s1 ,s2 ,a ,b ,c = [int(e) for e in input().split()]
    if s1 ==0 and s2 == 0:
        print(f1(a, b, c))
    if s1 ==0 and s2 == 1:
        print(f2(a, b, c))
    if s1 ==1 and s2 == 0:
        print(f3(a, b, c))
    if s1 ==1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip())
# 1639188, 2022-09-24 09:24:13, PPxP[--][PxPx] (50%)

def f1(a, b, c):
    x = []
    if a > 0:
        x.append(a)
    if b>0:
        x.append(b)
    if c>0:
        x.append(c)
    y = min(x)
    return int(y)

def f2(a, b, c):
    x = []
    if a < 0:
        x.append(a)
    if b<0:
        x.append(b)
    if c<0:
        x.append(c)
    y = max(x)
    return int(y)
    
def f3(a, b, c):
    x = abs(a+b+c)
    return x[0]

def f4(a, b, c):
    x = abs(a+b+c)
    y = int(x)%10
    return y

def main():
    s1 ,s2 ,a ,b ,c = [int(e) for e in input().split()]
    if s1 ==0 and s2 == 0:
        print(f1(a, b, c))
    if s1 ==0 and s2 == 1:
        print(f2(a, b, c))
    if s1 ==1 and s2 == 0:
        print(f3(a, b, c))
    if s1 ==1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip())
# 1639233, 2022-09-24 09:25:20, PP-P[--][P-P-] (50%)

def f1(a, b, c):
    x = []
    if a > 0:
        x.append(a)
    if b>0:
        x.append(b)
    if c>0:
        x.append(c)
    y = min(x)
    return int(y)

def f2(a, b, c):
    x = []
    if a < 0:
        x.append(a)
    if b<0:
        x.append(b)
    if c<0:
        x.append(c)
    y = max(x)
    return int(y)
    
def f3(a, b, c):
    x = abs(a+b+c)
    y = str(x)
    return y[0]

def f4(a, b, c):
    x = abs(a+b+c)
    y = int(x)%10
    return y

def main():
    s1 ,s2 ,a ,b ,c = [int(e) for e in input().split()]
    if s1 ==0 and s2 == 0:
        print(f1(a, b, c))
    if s1 ==0 and s2 == 1:
        print(f2(a, b, c))
    if s1 ==1 and s2 == 0:
        print(f3(a, b, c))
    if s1 ==1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip())
# 1640912, 2022-09-24 10:10:13, compilation error (0%)

def f1(a, b, c):
    if a < -1000 and a> 1000:
        break
    if b < -1000 and b> 1000:
        break
    if b < -1000 and b> 1000:
        break
    x = []
    if a > 0:
        x.append(a)
    if b>0:
        x.append(b)
    if c>0:
        x.append(c)
    y = min(x)
    return int(y)

def f2(a, b, c):
    if a < -1000 and a> 1000:
        break
    if b < -1000 and b> 1000:
        break
    if b < -1000 and b> 1000:
        break
    x = []
    if a < 0:
        x.append(a)
    if b<0:
        x.append(b)
    if c<0:
        x.append(c)
    y = max(x)
    return int(y)
    
def f3(a, b, c):
    if a < -1000 and a> 1000:
        break
    if b < -1000 and b> 1000:
        break
    if b < -1000 and b> 1000:
        break
    x = abs(a+b+c)
    y = str(x)
    return y[0]

def f4(a, b, c):
    if a < -1000 and a> 1000:
        break
    if b < -1000 and b> 1000:
        break
    if b < -1000 and b> 1000:
        break
    x = abs(a+b+c)
    y = int(x)%10
    return y

def main():
    if a < -1000 and a> 1000:
        break
    if b < -1000 and b> 1000:
        break
    if b < -1000 and b> 1000:
        break
    s1 ,s2 ,a ,b ,c = [int(e) for e in input().split()]
    if s1 ==0 and s2 == 0:
        print(f1(a, b, c))
    if s1 ==0 and s2 == 1:
        print(f2(a, b, c))
    if s1 ==1 and s2 == 0:
        print(f3(a, b, c))
    if s1 ==1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip())
# 1640927, 2022-09-24 10:10:34, PP-P[--][P-P-] (50%)

def f1(a, b, c):
    x = []
    if a > 0:
        x.append(a)
    if b>0:
        x.append(b)
    if c>0:
        x.append(c)
    y = min(x)
    return int(y)

def f2(a, b, c):
    x = []
    if a < 0:
        x.append(a)
    if b<0:
        x.append(b)
    if c<0:
        x.append(c)
    y = max(x)
    return int(y)
    
def f3(a, b, c):
    x = abs(a+b+c)
    y = str(x)
    return y[0]

def f4(a, b, c):
    x = abs(a+b+c)
    y = int(x)%10
    return y

def main():
    s1 ,s2 ,a ,b ,c = [int(e) for e in input().split()]
    if s1 ==0 and s2 == 0:
        print(f1(a, b, c))
    if s1 ==0 and s2 == 1:
        print(f2(a, b, c))
    if s1 ==1 and s2 == 0:
        print(f3(a, b, c))
    if s1 ==1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip())
# 1642235, 2022-09-24 10:36:15, PP-P[PP][PPPP] (83%)

def f1(a, b, c):
    x = []
    if a > 0:
        x.append(a)
    if b>0:
        x.append(b)
    if c>0:
        x.append(c)
    y = min(x)
    return int(y)

def f2(a, b, c):
    x = []
    if a < 0:
        x.append(a)
    if b<0:
        x.append(b)
    if c<0:
        x.append(c)
    y = max(x)
    return int(y)
    
def f3(a, b, c):
    x = abs(a+b+c)
    y = str(x)
    return y[0]

def f4(a, b, c):
    x = abs(a+b+c)
    y = int(x)%10
    return y

def main():
    s1 ,s2 ,a ,b ,c = [int(e) for e in input().split()]
    if s1 ==0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 ==0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 ==1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 ==1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip())

6231404421
# 1639592, 2022-09-24 09:34:17, compilation error (0%)

def f1(a,b,c):
    a = str(a)
    b = str(b)
    c = str(c)
    x = []
    if a[0] = '-' :
        a = 0
    else :
        a = int(a)
        x.append(a)
    if b[0] == '-' :
        b = 0
    else :
        b = int(b)
        x.append(b)
    if c[0] == '-' :
        c = 0
    else :
        c = int(c)
        x.append(c)
    return min(x)
# 1639621, 2022-09-24 09:34:52, ----[--][----] (0%)

def f1(a,b,c):
    a = str(a)
    b = str(b)
    c = str(c)
    x = []
    if a[0] == '-' :
        a = 0
    else :
        a = int(a)
        x.append(a)
    if b[0] == '-' :
        b = 0
    else :
        b = int(b)
        x.append(b)
    if c[0] == '-' :
        c = 0
    else :
        c = int(c)
        x.append(c)
    return min(x)
# 1639791, 2022-09-24 09:39:21, ----[--][----] (0%)

def f1(a,b,c):
    a = str(a)
    b = str(b)
    c = str(c)
    x = []
    if a[0] != '-' :
        x.append(int(a))
    if b[0] != '-' :
        x.append(int(b))
    if c[0] != '-' :
        x.append(int(c))
    return min(x)
# 1640625, 2022-09-24 10:02:47, -PPP[--][P-P-] (50%)

def f1(a,b,c):
    a = str(a)
    b = str(b)
    c = str(c)
    x = []
    if a[0] != '-' :
        x.append(int(a))
    if b[0] != '-' :
        x.append(int(b))
    if c[0] != '-' :
        x.append(int(c))
    return min(x)
def f2(a,b,c):
    a = str(a)
    b = str(b)
    c = str(c)
    x = []
    if a[0] == '-' :
        x.append(int(a))
    if b[0] == '-' :
        x.append(int(b))
    if c[0] == '-' :
        x.append(int(c))
    return max(x)
def f3(a,b,c):
    x = a + b + c
    x = str(x)
    if x[0] == '-':
        y = int(x[1])
    else:
        y = int(x[0])
    return y
def f4(a,b,c):
    x = a + b + c
    x = str(x)
    y = int(x[-1])
    return y
def main():
    s1,s2,a,b,c = input().split()
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
exec(input().strip())
    
# 1641211, 2022-09-24 10:17:50, -PPP[PP][PPPP] (83%)

def f1(a,b,c):
    a = str(a)
    b = str(b)
    c = str(c)
    x = []
    if a[0] != '-' :
        x.append(int(a))
    if b[0] != '-' :
        x.append(int(b))
    if c[0] != '-' :
        x.append(int(c))
    return min(x)
def f2(a,b,c):
    a = str(a)
    b = str(b)
    c = str(c)
    x = []
    if a[0] == '-' :
        x.append(int(a))
    if b[0] == '-' :
        x.append(int(b))
    if c[0] == '-' :
        x.append(int(c))
    return max(x)
def f3(a,b,c):
    x = a + b + c
    x = str(x)
    if x[0] == '-':
        y = int(x[1])
    else:
        y = int(x[0])
    return y
def f4(a,b,c):
    x = a + b + c
    x = str(x)
    y = int(x[-1])
    return y
def main():
    x = input().split()
    s1 = int(x[0])
    s2 = int(x[1])
    a = int(x[2])
    b = int(x[3])
    c = int(x[4])
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
exec(input().strip())
    

6531019821
# 1639785, 2022-09-24 09:39:13, ----[xx][PPPP] (17%)

def f1(a, b, c):
    if a <= 0:
        x = [b,c]
    elif b <= 0:
        x = [a,c]
    else:
        x = [a,b]
    y = min(x)
    return y
def f2(a, b, c):
    if a >= 0:
        x = [b,c]
    elif b >= 0:
        x = [a,c]
    else:
        x = [a,b]
    ma = max(x)
    return(ma)
def f3(a, b, c):
    p = int(a) + int(b) + int(c)
    o = str(abs(p))
    return o[0]
def f4(a, b, c):
    j = int(a) + int(b) + int(c)
    k = str(abs(j))
    return k[-1]
def main():
    s1,s2,a,b,c = [e for e in input().split()]
    if s1 == "0" and s2 == "0":
        print(f1(a, b, c))
    elif s1 == '0' and s2 == '1':
        print(f2(a, b, c))
    elif s1 == '1' and s2 == '0':
        print(f3(a, b, c)
)
    elif s1 == '1' and s2 == '1':
        print(f4(a, b, c))
    else:
        print('Error')
exec(input().strip())

# 1639849, 2022-09-24 09:40:59, ----[xx][PPPP] (17%)

def f1(a, b, c):
    if a <= 0:
        x = [b,c]
    elif b <= 0:
        x = [a,c]
    else:
        x = [a,b]
    y = min(x)
    return y
def f2(a, b, c):
    if a >= 0:
        x = [b,c]
    elif b >= 0:
        x = [a,c]
    else:
        x = [a,b]
    ma = max(x)
    return(ma)
def f3(a, b, c):
    p = int(a) + int(b) + int(c)
    o = str(abs(p))
    return o[0]
def f4(a, b, c):
    j = int(a) + int(b) + int(c)
    k = str(abs(j))
    return k[-1]
def main():
    s1,s2,a,b,c = [e for e in input().split()]
    if s1 == "0" and s2 == "0":
        print(f1(a, b, c))
    elif s1 == '0' and s2 == '1':
        print(f2(a, b, c))
    elif s1 == '1' and s2 == '0':
        print(f3(a, b, c))
    elif s1 == '1' and s2 == '1':
        print(f4(a, b, c))
    else:
        print('Error')
exec(input().strip())
# 1639972, 2022-09-24 09:44:19, ----[xx][PPPP] (17%)

def f1(a, b, c):
    if a <= 0:
        x = [b,c]
    elif b <= 0:
        x = [a,c]
    else:
        x = [a,b]
    y = min(x)
    return y
def f2(a, b, c):
    if a >= 0:
        x = [b,c]
    elif b >= 0:
        x = [a,c]
    else:
        x = [a,b]
    ma = max(x)
    return(ma)
def f3(a, b, c):
    p = int(a) + int(b) + int(c)
    o = str(abs(p))
    return o[0]
def f4(a, b, c):
    j = int(a) + int(b) + int(c)
    k = str(abs(j))
    return k[-1]
def main():
    s1,s2,a,b,c = [e for e in input().split()]
    if s1 == "0" and s2 == "0":
        print(f1(a, b, c))
    elif s1 == '0' and s2 == '1':
        print(f2(a, b, c))
    elif s1 == '1' and s2 == '0':
        print(f3(a, b, c))
    elif s1 == '1' and s2 == '1':
        print(f4(a, b, c))
    else:
        print('Error')
exec(input().strip())
# 1640211, 2022-09-24 09:51:13, PP--[xx][PPPP] (50%)

def f1(a, b, c):
    v = [a,b,c]
    x = []
    for e in v:
        if e > 0:
            x.append(e)
        
    y = min(x)
    return y
def f2(a, b, c):
    v = [a,b,c]
    x = []
    for e in v:
        if e < 0:
            x.append(e)
    ma = max(x)
    return(ma)
def f3(a, b, c):
    p = int(a) + int(b) + int(c)
    o = str(abs(p))
    return o[0]
def f4(a, b, c):
    j = int(a) + int(b) + int(c)
    k = str(abs(j))
    return k[-1]
def main():
    s1,s2,a,b,c = [e for e in input().split()]
    if s1 == "0" and s2 == "0":
        print(f1(a, b, c))
    elif s1 == '0' and s2 == '1':
        print(f2(a, b, c))
    elif s1 == '1' and s2 == '0':
        print(f3(a, b, c))
    elif s1 == '1' and s2 == '1':
        print(f4(a, b, c))
    else:
        print('Error')
exec(input().strip())
# 1640438, 2022-09-24 09:57:52, PPPP[xx][PPPP] (83%)

def f1(a, b, c):
    v = [a,b,c]
    x = []
    for e in v:
        if e > 0:
            x.append(e)        
    y = min(x)
    return int(y)
def f2(a, b, c):
    v = [a,b,c]
    x = []
    for e in v:
        if e < 0:
            x.append(e)
    ma = max(x)
    return int(ma)
def f3(a, b, c):
    p = int(a) + int(b) + int(c)
    o = str(abs(p))
    return int(o[0])
def f4(a, b, c):
    j = int(a) + int(b) + int(c)
    k = str(abs(j))
    return int(k[-1])
def main():
    s1,s2,a,b,c = [e for e in input().split()]
    if s1 == "0" and s2 == "0":
        print(f1(a, b, c))
    elif s1 == '0' and s2 == '1':
        print(f2(a, b, c))
    elif s1 == '1' and s2 == '0':
        print(f3(a, b, c))
    elif s1 == '1' and s2 == '1':
        print(f4(a, b, c))
    else:
        print('Error')
exec(input().strip())

6530398421
# 1641138, 2022-09-24 10:16:17, ----[--][P-P-] (0%)

def f1(a,b,c):
    d = []
    if a>=0:
        d.append(a)
    if b>=0:
        d.append(b)
    if c >=0:
        d.append(c)
    minimum = d[0]
    for i in range(len(d)):
        if d[i]<minimum:
            minimum = d[i]
    print(minimum)
    
def f2(a,b,c):
    d = []
    if a<0:
        d.append(a)
    if b<0:
        d.append(b)
    if c<0:
        d.append(c)
    maximum = d[0]
    for i in range(len(d)):
        if d[i]>maximum:
            maximum = d[i]
    print(maximum)


def f3(a, b, c):
    d = abs(a+b+c)
    k = str(d)
    print(int(k[0]))
    
def f4(a, b, c):
    d = abs(a+b+c)
    k = str(d)
    print(int(k[-1]))
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1 == 1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2 ==1:
        print(f4(a,b,c))
    else:
        print("Error")
    

exec(input().strip())
# 1641286, 2022-09-24 10:19:16, -PPP[PP][PPPP] (83%)

def f1(a,b,c):
    d = []
    if a>=0:
        d.append(a)
    if b>=0:
        d.append(b)
    if c >=0:
        d.append(c)
    minimum = d[0]
    for i in range(len(d)):
        if d[i]<minimum:
            minimum = d[i]
    return minimum
    
def f2(a,b,c):
    d = []
    if a<0:
        d.append(a)
    if b<0:
        d.append(b)
    if c<0:
        d.append(c)
    maximum = d[0]
    for i in range(len(d)):
        if d[i]>maximum:
            maximum = d[i]
    return maximum


def f3(a, b, c):
    d = abs(a+b+c)
    k = str(d)
    return int(k[0])
    
def f4(a, b, c):
    d = abs(a+b+c)
    k = str(d)
    return int(k[-1])
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1 == 1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2 ==1:
        print(f4(a,b,c))
    else:
        print("Error")
    

exec(input().strip())
# 1642157, 2022-09-24 10:35:17, -PPP[--][----] (50%)

def f1(a,b,c):
    d = []
    if a>=0:
        d.append(a)
    if b>=0:
        d.append(b)
    if c >=0:
        d.append(c)
    minimum = d[0]
    for i in range(len(d)):
        if d[i]<minimum:
            minimum = d[i]
    return minimum
    
def f2(a,b,c):
    d = []
    if a<0:
        d.append(a)
    if b<0:
        d.append(b)
    if c<0:
        d.append(c)
    maximum = d[0]
    for i in range(len(d)):
        if d[i]>maximum:
            maximum = d[i]
    return maximum


def f3(a, b, c):
    d = abs(a+b+c)
    k = str(d)
    return int(k[0])
    
def f4(a, b, c):
    d = abs(a+b+c)
    k = str(d)
    return int(k[-1])
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        return f1(a,b,c)
    elif s1==0 and s2==1:
        return f2(a,b,c)
    elif s1 == 1 and s2==0:
        return f3(a,b,c)
    elif s1==1 and s2 ==1:
        return f4(a,b,c)
    else:
        return "Error"
    

exec(input().strip())


# 1642208, 2022-09-24 10:35:55, -PPP[PP][PPPP] (83%)

def f1(a,b,c):
    d = []
    if a>=0:
        d.append(a)
    if b>=0:
        d.append(b)
    if c >=0:
        d.append(c)
    minimum = d[0]
    for i in range(len(d)):
        if d[i]<minimum:
            minimum = d[i]
    return minimum
    
def f2(a,b,c):
    d = []
    if a<0:
        d.append(a)
    if b<0:
        d.append(b)
    if c<0:
        d.append(c)
    maximum = d[0]
    for i in range(len(d)):
        if d[i]>maximum:
            maximum = d[i]
    return maximum


def f3(a, b, c):
    d = abs(a+b+c)
    k = str(d)
    return int(k[0])
    
def f4(a, b, c):
    d = abs(a+b+c)
    k = str(d)
    return int(k[-1])
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1 == 1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2 ==1:
        print(f4(a,b,c))
    else:
        print("Error")
    

exec(input().strip())

6530020121
# 1639928, 2022-09-24 09:43:22, ----[--][----] (0%)

def f1(a, b, c):
    x = []
    for i in (a,b,c):
        if i > 0:
            x.append(i)
    val = min(x)
    return val
def f2(a, b, c):
    x = []
    for i in (a,b,c):
        if i < 0:
            x.append(i)
    val = max(x)
    return val
def f3(a, b, c):
    plus = a+b+c
    long = len(str(plus))
    digit = plus//10**(long-1)
    digit = abs(digit)
    return digit
def f4(a, b, c):
    plus = a+b+c
    plus = abs(plus)
    digit = plus % 10
    return digit
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")


# 1639956, 2022-09-24 09:44:03, PPPP[PP][PPP-] (83%)

def f1(a, b, c):
    x = []
    for i in (a,b,c):
        if i > 0:
            x.append(i)
    val = min(x)
    return val
def f2(a, b, c):
    x = []
    for i in (a,b,c):
        if i < 0:
            x.append(i)
    val = max(x)
    return val
def f3(a, b, c):
    plus = a+b+c
    long = len(str(plus))
    digit = plus//10**(long-1)
    digit = abs(digit)
    return digit
def f4(a, b, c):
    plus = a+b+c
    plus = abs(plus)
    digit = plus % 10
    return digit
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
        
        
exec(input().strip()) # DON'T remove this line
# 1640267, 2022-09-24 09:52:33, PPPP[PP][PPP-] (83%)

def f1(a, b, c):
    x = []
    for i in (a,b,c):
        if i > 0:
            x.append(i)
    if x != []:
        val = min(x)
        return val
def f2(a, b, c):
    x = []
    for i in (a,b,c):
        if i < 0:
            x.append(i)
    if x != []:
        val = max(x)
        return val
def f3(a, b, c):
    plus = a+b+c
    long = len(str(plus))
    digit = plus//10**(long-1)
    digit = abs(digit)
    return digit

def f4(a, b, c):
    plus = a+b+c
    plus = abs(plus)
    digit = plus % 10
    return digit
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
        
        
exec(input().strip()) # DON'T remove this line

6530124821
# 1641301, 2022-09-24 10:19:33, PP-P[PP][PPPP] (83%)

def f1(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    A = []
    A.append(a)
    A.append(b)
    A.append(c)
    B=[]
    for i  in range(3):
        if A[i] > 0:
            B.append(A[i])
    
    D = min(B)
    return D

def f2(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    A = []
    A.append(a)
    A.append(b)
    A.append(c)
    B=[]
    for i  in range(3):
        if A[i] < 0:
            B.append(A[i])
    
    D = max(B)
    return D
    
def f3(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    A = []
    A.append(a)
    A.append(b)
    A.append(c)
    D = sum(A)
    E = abs(D)
    F = str(E)
    G = F[0]
    return G

def f4(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    A = []
    A.append(a)
    A.append(b)
    A.append(c)
    D = sum(A)
    E = abs(D)
    F = E % 10
    return F

def main():
    s1,s2,a,b,c = [ int(e) for e in input().split() ]
    if s1 == 0 and s2 == 0:
        print( f1(a,b,c) )
    elif s1 == 0 and s2 == 1:
        print( f2(a,b,c) )
    elif s1 == 1 and s2 == 0:
        print( f3(a,b,c) )
    elif s1 == 1 and s2 == 1:
        print( f4(a,b,c) )
    else:
        print('Error')
        
exec(input().strip())
# 1641410, 2022-09-24 10:21:43, PP-P[PP][PPPP] (83%)

def f1(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    A = []
    A.append(a)
    A.append(b)
    A.append(c)
    B=[]
    for i  in range(3):
        if A[i] > 0:
            B.append(A[i])
    
    D = min(B)
    return D

def f2(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    A = []
    A.append(a)
    A.append(b)
    A.append(c)
    B=[]
    for i  in range(3):
        if A[i] < 0:
            B.append(A[i])
    
    D = max(B)
    return D
    
def f3(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    A = []
    A.append(a)
    A.append(b)
    A.append(c)
    D = sum(A)
    E = abs(D)
    F = str(E)
    G = F[0]
    return G

def f4(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    A = []
    A.append(a)
    A.append(b)
    A.append(c)
    D = sum(A)
    E = abs(D)
    F = E % 10
    return F

def main():
    s1,s2,a,b,c = [ int(e) for e in input().split() ]
    if s1 == 0 and s2 == 0:
        print( f1(a,b,c) )
    elif s1 == 0 and s2 == 1:
        print( f2(a,b,c) )
    elif s1 == 1 and s2 == 0:
        print( f3(a,b,c) )
    elif s1 == 1 and s2 == 1:
        print( f4(a,b,c) )
    else:
        print('Error')
        
exec(input().strip())
# 1641483, 2022-09-24 10:23:22, PP-P[PP][PPPP] (83%)

def f1(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    A = []
    A.append(a)
    A.append(b)
    A.append(c)
    B=[]
    for i in range(3):
        if A[i] > 0:
            B.append(A[i])
    
    D = min(B)
    return D

def f2(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    A = []
    A.append(a)
    A.append(b)
    A.append(c)
    B=[]
    for i in range(3):
        if A[i] < 0:
            B.append(A[i])
    
    D = max(B)
    return D
    
def f3(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    A = []
    A.append(a)
    A.append(b)
    A.append(c)
    D = sum(A)
    E = abs(D)
    F = str(E)
    G = F[0]
    return G

def f4(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    A = []
    A.append(a)
    A.append(b)
    A.append(c)
    D = sum(A)
    E = abs(D)
    F = E % 10
    return F

def main():
    s1,s2,a,b,c = [ int(e) for e in input().split() ]
    if s1 == 0 and s2 == 0:
        print( f1(a,b,c) )
    elif s1 == 0 and s2 == 1:
        print( f2(a,b,c) )
    elif s1 == 1 and s2 == 0:
        print( f3(a,b,c) )
    elif s1 == 1 and s2 == 1:
        print( f4(a,b,c) )
    else:
        print('Error')
        
exec(input().strip())

6530155221
# 1639987, 2022-09-24 09:44:45, PPx-[PP][PPPP] (67%)

def f1(a, b, c):
    d = [int(a),int(b),int(c)]
    p=[]
    for i in range(len(d)):
        if d[i]>0:
            p.append(d[i])
    p.sort()
    e = p[0]
    return(e)
def f2(a, b, c):
    d = [int(a),int(b),int(c)]
    p = []
    for i in range(len(d)):
        if d[i]<0:
            p.append(d[i])
    p.sort()
    e = p[-1]
    return(e)
    
def f3(a, b, c):
    d = a+b+c
    if d<0:
        d = -d
    else:
        d = d
    p = (d**2)/d
    o = str(p)
    e = o[0]
    return(int(e))

def f4(a, b, c):
    d = a+b+c
    if d<0:
        d = -d
    else:
        d = d
    p = (d**2)/d
    o = str(p)
    e = o[-1]
    return(int(e))

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
    
exec(input().strip()) # DON'T remove this line
# 1640144, 2022-09-24 09:49:23, PPxP[PP][PPPP] (83%)

def f1(a, b, c):
    d = [int(a),int(b),int(c)]
    p=[]
    for i in range(len(d)):
        if d[i]>0:
            p.append(d[i])
    p.sort()
    e = p[0]
    return(e)
def f2(a, b, c):
    d = [int(a),int(b),int(c)]
    p = []
    for i in range(len(d)):
        if d[i]<0:
            p.append(d[i])
    p.sort()
    e = p[-1]
    return(e)
    
def f3(a, b, c):
    d = a+b+c
    if d<0:
        d = -d
    else:
        d = d
    p = (d**2)/d
    o = str(p)
    e = o[0]
    return(int(e))

def f4(a, b, c):
    d = a+b+c
    if d<0:
        d = -d
    else:
        d = d
    p = (d**2)/d
    e = p%10
    return(int(e))

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
    
exec(input().strip()) # DON'T remove this line

6530210021
# 1639759, 2022-09-24 09:38:39, PPP-[PP][PPP-] (67%)

def f1(a,b,c):
    x = a,b,c
    sorted(x)
    x_min = []
    for i in range(3):
        if x[i] > 0:
            x_min.append(x[i])
    x_min.sort()
    return x_min[0]
        
        
def f2(a,b,c):
    x = a,b,c
    sorted(x)
    x_max = []
    for i in range(3):
        if x[i] < 0:
            x_max.append(x[i])
    x_max.sort()
    return x_max[-1]

def f3(a,b,c):
    sum_all = a+b+c
    return abs(sum_all//10**(len(str(sum_all))-1))

def f4(a,b,c):
    sum_all = a+b+c
    x = str(sum_all)
    return x[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

exec(input().strip())


# 1639867, 2022-09-24 09:41:28, PPPP[PP][PPP-] (83%)

def f1(a,b,c):
    x = a,b,c
    sorted(x)
    x_min = []
    for i in range(3):
        if x[i] > 0:
            x_min.append(x[i])
    x_min.sort()
    return int(x_min[0])
        
        
def f2(a,b,c):
    x = a,b,c
    sorted(x)
    x_max = []
    for i in range(3):
        if x[i] < 0:
            x_max.append(x[i])
    x_max.sort()
    return int(x_max[-1])

def f3(a,b,c):
    sum_all = a+b+c
    return int(abs(sum_all//10**(len(str(sum_all))-1)))

def f4(a,b,c):
    sum_all = a+b+c
    x = str(sum_all)
    return int(x[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

exec(input().strip())

6430450221
# 1639572, 2022-09-24 09:33:44, PPxP[PP][PPPP] (83%)

def f1(a, b, c):
    s=[]
    if int(a)>0:
        s.append(int(a))
    if int(b)>0:
        s.append(int(b))
    if int(c)>0:
        s.append(int(c))
    k = min(s)
    return k

def f2(a, b, c):
    s=[]
    if int(a)<0:
        s.append(int(a))
    if int(b)<0:
        s.append(int(b))
    if int(c)<0:
        s.append(int(c))
    k = max(s)
    return k

def f3(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    s=[a,b,c]
    k=sum(s)
    q=0
    if k>0:
        k=str(k)
        q+=int(k[0])
    else:
        k=str(k)
        q+=int(k[1])
    return q
def f4(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    s=[a,b,c]
    k=sum(s)
    k=str(k)
    q=int(k[-1])
    return q

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print('Error')
    
exec(input().strip()) # DON'T remove this line

6530045921
# 1640278, 2022-09-24 09:53:00, PP-P[PP][PPPP] (83%)

def f1(a,b,c):
    s = [a,b,c]
    s = [int(i) for i in s]
    d = []
    for i in range (len(s)) :
        if s[i] > 0 :
            d += [s[i]]
    mi = min(d)
    return mi

def f2(a, b, c):
    s = [a,b,c]
    s = [int(i) for i in s]
    d = []
    for i in range (len(s)) :
        if s[i] < 0 :
            d += [s[i]]
    ma = max(d)
    return ma

def f3(a, b, c):
    s = [a,b,c]
    s = [int(i) for i in s]
    d = s[0]+s[1]+s[2]
    d = abs(d)
    if d < 100 :
        d = d//10
    if 100 <= d < 1000:
        d = d//100
    if 1000 <= d < 10000:
        d = d//1000
    return d


def f4(a, b, c):
    s = [a,b,c]
    s = [int(i) for i in s]
    x = s[0] +s[1] +s[2]
    x = abs(x)
    x = x%10
    return x

def main() :
    n = input().split()
    n = [int(i) for i in n]
    if n[0] == 0 and n[1] == 0 :
        print(f1(n[2],n[3],n[4]))
    elif n[0] == 0 and n[1] == 1 :
        print(f2(n[2],n[3],n[4]))
    elif n[0] == 1 and n[1] == 0 :
        print(f3(n[2],n[3],n[4]))
    elif n[0] == 1 and n[1] == 1 :
        print(f4(n[2],n[3],n[4]))
    else :
        print("Error")
    
exec(input().strip())

Max Score = 67


6530019621
# 1638902, 2022-09-24 09:17:42, compilation error (0%)

def f1(a, b, c):
    P=[]
    if a>0:
        P.append(a)
    if b>0:
        P.append(b)
    if c>0:
        P.append(c)
    Ans=min(P)
    return Ans

def f2(a, b, c):
    P=[]
    if a<0:
        P.append(a)
    if b<0:
        P.append(b)
    if c<0:
        P.append(c)
    Ans=min(P)
    return Ans
    
def f3(a, b, c):
    sum=a+b+c
    Ans=sum[0]
    if Ans<0:
        Ans=-Ans
    return Ans

def f4(a, b, c):
        s1,s2,a,b,c=(int(e) for e in input().split())
        if s1==0 and s2==0:
            print(f1(a,b,c))
        elif s1==0 and s2==1:
            print(f2(a,b,c))
        elif s1==1 and s2==0:
            print(f3(a,b,c))
        elif s1==1 and s2==1:
            print(f4(a,b,c))
        elif s1!=1 or s1!=0 or s2!=1 or s2!=0:
            print('Error')

def main():
exec(input().strip()) # DON'T remove this line

# 1638947, 2022-09-24 09:18:41, compilation error (0%)

def f1(a, b, c):
    P=[]
    if a>0:
        P.append(a)
    if b>0:
        P.append(b)
    if c>0:
        P.append(c)
    Ans=min(P)
    return Ans

def f2(a, b, c):
    P=[]
    if a<0:
        P.append(a)
    if b<0:
        P.append(b)
    if c<0:
        P.append(c)
    Ans=min(P)
    return Ans
    
def f3(a, b, c):
    sum=a+b+c
    Ans=sum[0]
    if Ans<0:
        Ans=-Ans
    return Ans

def f4(a, b, c):
    sum=a+b+c
    Ans=sum[-1]
    if Ans<0:
        Ans=-Ans
    return Ans
    
        
def main():
    s1,s2,a,b,c=(int(e) for e in input().split())
        if s1==0 and s2==0:
            print(f1(a,b,c))
        elif s1==0 and s2==1:
            print(f2(a,b,c))
        elif s1==1 and s2==0:
            print(f3(a,b,c))
        elif s1==1 and s2==1:
            print(f4(a,b,c))
        elif s1!=1 or s1!=0 or s2!=1 or s2!=0:
            print('Error')
    
exec(input().strip()) # DON'T remove this line

# 1638964, 2022-09-24 09:19:06, P-xx[P-][PxPx] (17%)

def f1(a, b, c):
    P=[]
    if a>0:
        P.append(a)
    if b>0:
        P.append(b)
    if c>0:
        P.append(c)
    Ans=min(P)
    return Ans

def f2(a, b, c):
    P=[]
    if a<0:
        P.append(a)
    if b<0:
        P.append(b)
    if c<0:
        P.append(c)
    Ans=min(P)
    return Ans
    
def f3(a, b, c):
    sum=a+b+c
    Ans=sum[0]
    if Ans<0:
        Ans=-Ans
    return Ans

def f4(a, b, c):
    sum=a+b+c
    Ans=sum[-1]
    if Ans<0:
        Ans=-Ans
    return Ans
    
        
def main():
    s1,s2,a,b,c=(int(e) for e in input().split())
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    elif s1!=1 or s1!=0 or s2!=1 or s2!=0:
        print('Error')
    
exec(input().strip()) # DON'T remove this line

# 1638997, 2022-09-24 09:19:49, PPxx[PP][PxPx] (50%)

def f1(a, b, c):
    P=[]
    if a>0:
        P.append(a)
    if b>0:
        P.append(b)
    if c>0:
        P.append(c)
    Ans=min(P)
    return Ans

def f2(a, b, c):
    P=[]
    if a<0:
        P.append(a)
    if b<0:
        P.append(b)
    if c<0:
        P.append(c)
    Ans=max(P)
    return Ans
    
def f3(a, b, c):
    sum=a+b+c
    Ans=sum[0]
    if Ans<0:
        Ans=-Ans
    return Ans

def f4(a, b, c):
    sum=a+b+c
    Ans=sum[-1]
    if Ans<0:
        Ans=-Ans
    return Ans
    
        
def main():
    s1,s2,a,b,c=(int(e) for e in input().split())
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    elif s1!=1 or s1!=0 or s2!=1 or s2!=0:
        print('Error')
    
exec(input().strip()) # DON'T remove this line

# 1639021, 2022-09-24 09:20:22, PPxx[PP][PxPx] (50%)

def f1(a, b, c):
    P=[]
    if a>0:
        P.append(a)
    if b>0:
        P.append(b)
    if c>0:
        P.append(c)
    Ans=min(P)
    return Ans

def f2(a, b, c):
    P=[]
    if a<0:
        P.append(a)
    if b<0:
        P.append(b)
    if c<0:
        P.append(c)
    Ans=max(P)
    return Ans
    
def f3(a, b, c):
    sum=a+b+c
    Ans=str(sum[0])
    if Ans<0:
        Ans=-Ans
    return Ans

def f4(a, b, c):
    sum=a+b+c
    Ans=str(sum[-1])
    if Ans<0:
        Ans=-Ans
    return Ans
    
        
def main():
    s1,s2,a,b,c=(int(e) for e in input().split())
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    elif s1!=1 or s1!=0 or s2!=1 or s2!=0:
        print('Error')
    
exec(input().strip()) # DON'T remove this line

# 1639050, 2022-09-24 09:21:09, PPxx[PP][PxPx] (50%)

def f1(a, b, c):
    P=[]
    if a>0:
        P.append(a)
    if b>0:
        P.append(b)
    if c>0:
        P.append(c)
    Ans=min(P)
    return Ans

def f2(a, b, c):
    P=[]
    if a<0:
        P.append(a)
    if b<0:
        P.append(b)
    if c<0:
        P.append(c)
    Ans=max(P)
    return Ans
    
def f3(a, b, c):
    summ=a+b+c
    summ=str(summ)
    Ans=summ[0]
    if Ans<0:
        Ans=-Ans
    return Ans

def f4(a, b, c):
    summ=a+b+c
    summ=str(summ)
    Ans=summ[-1]
    if Ans<0:
        Ans=-Ans
    return Ans
    
        
def main():
    s1,s2,a,b,c=(int(e) for e in input().split())
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    elif s1!=1 or s1!=0 or s2!=1 or s2!=0:
        print('Error')
    
exec(input().strip()) # DON'T remove this line

# 1639153, 2022-09-24 09:23:19, compilation error (0%)

def f1(a, b, c):
    P=[]
    if a>0:
        P.append(a)
    if b>0:
        P.append(b)
    if c>0:
        P.append(c)
    Ans=min(P)
    return Ans

def f2(a, b, c):
    P=[]
    if a<0:
        P.append(a)
    if b<0:
        P.append(b)
    if c<0:
        P.append(c)
    Ans=max(P)
    return Ans
    
def f3(a, b, c):
    A=str(a+b+c)
    if A[0]=='-':
        A.remove('-')
    Ans=A[0]
    return Ans

def f4(a, b, c):
    
    
        
def main():
    s1,s2,a,b,c=(int(e) for e in input().split())
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    elif s1!=1 or s1!=0 or s2!=1 or s2!=0:
        print('Error')
    
exec(input().strip()) # DON'T remove this line

# 1639226, 2022-09-24 09:25:05, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    P=[]
    if a>0:
        P.append(a)
    if b>0:
        P.append(b)
    if c>0:
        P.append(c)
    Ans=min(P)
    return Ans

def f2(a, b, c):
    P=[]
    if a<0:
        P.append(a)
    if b<0:
        P.append(b)
    if c<0:
        P.append(c)
    Ans=max(P)
    return Ans
    
def f3(a, b, c):
    A=str(a+b+c)
    if A[0]=='-':
        A=A[1:]
    Ans=A[0]
    return Ans

def f4(a, b, c):
    A=str(a+b+c)
    Ans=A[-1]
    return Ans
    
    
        
def main():
    s1,s2,a,b,c=(int(e) for e in input().split())
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    elif s1!=1 or s1!=0 or s2!=1 or s2!=0:
        print('Error')
    
exec(input().strip()) # DON'T remove this line

# 1641299, 2022-09-24 10:19:29, ----[--][PPPP] (17%)

def f1(a, b, c):
    P=[0]
    if a>0:
        P.append(a)
    if b>0:
        P.append(b)
    if c>0:
        P.append(c)
    Ans=min(P)
    return Ans

def f2(a, b, c):
    P=[0]
    if a<0:
        P.append(a)
    if b<0:
        P.append(b)
    if c<0:
        P.append(c)
    Ans=max(P)
    return Ans
    
def f3(a, b, c):
    A=str(a+b+c)
    if A[0]=='-':
        A=A[1:]
    Ans=A[0]
    return Ans

def f4(a, b, c):
    A=str(a+b+c)
    Ans=A[-1]
    return Ans
    
    
        
def main():
    s1,s2,a,b,c=(int(e) for e in input().split())
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    elif s1!=1 or s1!=0 or s2!=1 or s2!=0:
        print('Error')
    
exec(input().strip()) # DON'T remove this line

# 1641308, 2022-09-24 10:19:40, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    P=[]
    if a>0:
        P.append(a)
    if b>0:
        P.append(b)
    if c>0:
        P.append(c)
    Ans=min(P)
    return Ans

def f2(a, b, c):
    P=[]
    if a<0:
        P.append(a)
    if b<0:
        P.append(b)
    if c<0:
        P.append(c)
    Ans=max(P)
    return Ans
    
def f3(a, b, c):
    A=str(a+b+c)
    if A[0]=='-':
        A=A[1:]
    Ans=A[0]
    return Ans

def f4(a, b, c):
    A=str(a+b+c)
    Ans=A[-1]
    return Ans
    
    
        
def main():
    s1,s2,a,b,c=(int(e) for e in input().split())
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    elif s1!=1 or s1!=0 or s2!=1 or s2!=0:
        print('Error')
    
exec(input().strip()) # DON'T remove this line
# 1641487, 2022-09-24 10:23:26, P---[P-][PPPP] (33%)

def f1(a, b, c):
    P=[]
    if a>0:
        P.append(a)
    if b>0:
        P.append(b)
    if c>0:
        P.append(c)
    if len(P)>0:
        Ans=min(P)
    else:
        Ans='Error'
    return Ans

def f2(a, b, c):
    P=[]
    if a<0:
        P.append(a)
    if b<0:
        P.append(b)
    if c<0:
        P.append(c)
    if len(P)>0:
        Ans=max(P)
    else:
        Ans='Error'
    
def f3(a, b, c):
    A=str(a+b+c)
    if A[0]=='-':
        A=A[1:]
    Ans=A[0]
    return Ans

def f4(a, b, c):
    A=str(a+b+c)
    Ans=A[-1]
    return Ans
    
    
        
def main():
    s1,s2,a,b,c=(int(e) for e in input().split())
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    elif s1!=1 or s1!=0 or s2!=1 or s2!=0:
        print('Error')
    
exec(input().strip()) # DON'T remove this line

# 1641602, 2022-09-24 10:25:33, PP--[PP][P-P-] (50%)

def f1(a, b, c):
    P=[]
    if a>0:
        P.append(a)
    if b>0:
        P.append(b)
    if c>0:
        P.append(c)
    Ans=min(P)
    return Ans

def f2(a, b, c):
    P=[]
    if a<0:
        P.append(a)
    if b<0:
        P.append(b)
    if c<0:
        P.append(c)
    Ans=max(P)
    return Ans
    
def f3(a, b, c):
    A=0
    return 0

def f4(a, b, c):
    A=str(a+b+c)
    Ans=A[-1]
    return Ans
    
    
        
def main():
    s1,s2,a,b,c=(int(e) for e in input().split())
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    elif s1!=1 or s1!=0 or s2!=1 or s2!=0:
        print('Error')
    
exec(input().strip()) # DON'T remove this line

# 1641620, 2022-09-24 10:25:51, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    P=[]
    if a>0:
        P.append(a)
    if b>0:
        P.append(b)
    if c>0:
        P.append(c)
    Ans=min(P)
    return Ans

def f2(a, b, c):
    P=[]
    if a<0:
        P.append(a)
    if b<0:
        P.append(b)
    if c<0:
        P.append(c)
    Ans=max(P)
    return Ans
    
def f3(a, b, c):
    A=str(a+b+c)
    if A[0]=='-':
        A=A[1:]
    Ans=A[0]
    return Ans

def f4(a, b, c):
    Ans=0
    return Ans
    
    
        
def main():
    s1,s2,a,b,c=(int(e) for e in input().split())
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    elif s1!=1 or s1!=0 or s2!=1 or s2!=0:
        print('Error')
    
exec(input().strip()) # DON'T remove this line

# 1641721, 2022-09-24 10:27:45, PP--[PP][PPP-] (50%)

def f1(a, b, c):
    P=[]
    if a>0:
        P.append(a)
    if b>0:
        P.append(b)
    if c>0:
        P.append(c)
    Ans=min(P)
    return Ans

def f2(a, b, c):
    P=[]
    if a<0:
        P.append(a)
    if b<0:
        P.append(b)
    if c<0:
        P.append(c)
    Ans=max(P)
    return Ans
    
def f3(a, b, c):
    A=str(a+b+c)
    #if A[0]=='-':
    #    A=A[1:]
    Ans=A[0]
    return Ans

def f4(a, b, c):
    A=str(a+b+c)
    Ans=A[-1]
    return Ans
    
    
        
def main():
    s1,s2,a,b,c=(int(e) for e in input().split())
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    elif s1!=1 or s1!=0 or s2!=1 or s2!=0:
        print('Error')
    
exec(input().strip()) # DON'T remove this line

# 1641726, 2022-09-24 10:27:52, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    P=[]
    if a>0:
        P.append(a)
    if b>0:
        P.append(b)
    if c>0:
        P.append(c)
    Ans=min(P)
    return Ans

def f2(a, b, c):
    P=[]
    if a<0:
        P.append(a)
    if b<0:
        P.append(b)
    if c<0:
        P.append(c)
    Ans=max(P)
    return Ans
    
def f3(a, b, c):
    A=str(a+b+c)
    if A[0]=='-':
        A=A[1:]
    Ans=A[0]
    return Ans

def f4(a, b, c):
    A=str(a+b+c)
    Ans=A[-1]
    return Ans
    
    
        
def main():
    s1,s2,a,b,c=(int(e) for e in input().split())
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    elif s1!=1 or s1!=0 or s2!=1 or s2!=0:
        print('Error')
    
exec(input().strip()) # DON'T remove this line
# 1641739, 2022-09-24 10:28:01, PP--[PP][-P-P] (50%)

def f1(a, b, c):
    P=[]
    if a>0:
        P.append(a)
    if b>0:
        P.append(b)
    if c>0:
        P.append(c)
    Ans=min(P)
    return Ans

def f2(a, b, c):
    P=[]
    if a<0:
        P.append(a)
    if b<0:
        P.append(b)
    if c<0:
        P.append(c)
    Ans=max(P)
    return Ans
    
def f3(a, b, c):
    A=str(a+b+c)
    if A[0]=='-':
        A=A[1:]
    Ans=A[0]
    return Ans

def f4(a, b, c):
    A=str(a+b+c)
    Ans=A[-1]
    return Ans
    
    
        
def main():
    s1,s2,a,b,c=(int(e) for e in input().split())
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    #elif s1!=1 or s1!=0 or s2!=1 or s2!=0:
        print('Error')
    
exec(input().strip()) # DON'T remove this line
# 1641745, 2022-09-24 10:28:09, PP--[PP][P-P-] (50%)

def f1(a, b, c):
    P=[]
    if a>0:
        P.append(a)
    if b>0:
        P.append(b)
    if c>0:
        P.append(c)
    Ans=min(P)
    return Ans

def f2(a, b, c):
    P=[]
    if a<0:
        P.append(a)
    if b<0:
        P.append(b)
    if c<0:
        P.append(c)
    Ans=max(P)
    return Ans
    
def f3(a, b, c):
    A=str(a+b+c)
    if A[0]=='-':
        A=A[1:]
    Ans=A[0]
    return Ans

def f4(a, b, c):
    A=str(a+b+c)
    Ans=A[-1]
    return Ans
    
    
        
def main():
    s1,s2,a,b,c=(int(e) for e in input().split())
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    #elif s1==1 and s2==1:
        print(f4(a,b,c))
    elif s1!=1 or s1!=0 or s2!=1 or s2!=0:
        print('Error')
    
exec(input().strip()) # DON'T remove this line
# 1641754, 2022-09-24 10:28:19, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    P=[]
    if a>0:
        P.append(a)
    if b>0:
        P.append(b)
    if c>0:
        P.append(c)
    Ans=min(P)
    return Ans

def f2(a, b, c):
    P=[]
    if a<0:
        P.append(a)
    if b<0:
        P.append(b)
    if c<0:
        P.append(c)
    Ans=max(P)
    return Ans
    
def f3(a, b, c):
    A=str(a+b+c)
    if A[0]=='-':
        A=A[1:]
    Ans=A[0]
    return Ans

def f4(a, b, c):
    A=str(a+b+c)
    Ans=A[-1]
    return Ans
    
    
        
def main():
    s1,s2,a,b,c=(int(e) for e in input().split())
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    elif s1!=1 or s1!=0 or s2!=1 or s2!=0:
        print('Error')
    
exec(input().strip()) # DON'T remove this line
# 1641757, 2022-09-24 10:28:24, PP--[P-][P-P-] (33%)

def f1(a, b, c):
    P=[]
    if a>0:
        P.append(a)
    if b>0:
        P.append(b)
    if c>0:
        P.append(c)
    Ans=min(P)
    return Ans

def f2(a, b, c):
    P=[]
    if a<0:
        P.append(a)
    if b<0:
        P.append(b)
    if c<0:
        P.append(c)
    Ans=max(P)
    return Ans
    
def f3(a, b, c):
    A=str(a+b+c)
    if A[0]=='-':
        A=A[1:]
    Ans=A[0]
    return Ans

def f4(a, b, c):
    A=str(a+b+c)
    Ans=A[-1]
    return Ans
    
    
        
def main():
    s1,s2,a,b,c=(int(e) for e in input().split())
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    #elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    elif s1!=1 or s1!=0 or s2!=1 or s2!=0:
        print('Error')
    
exec(input().strip()) # DON'T remove this line
# 1641767, 2022-09-24 10:28:35, PP--[--][PPPP] (50%)

def f1(a, b, c):
    P=[]
    if a>0:
        P.append(a)
    if b>0:
        P.append(b)
    if c>0:
        P.append(c)
    Ans=min(P)
    return Ans

def f2(a, b, c):
    P=[]
    if a<0:
        P.append(a)
    if b<0:
        P.append(b)
    if c<0:
        P.append(c)
    Ans=max(P)
    return Ans
    
def f3(a, b, c):
    A=str(a+b+c)
    if A[0]=='-':
        A=A[1:]
    Ans=A[0]
    return Ans

def f4(a, b, c):
    A=str(a+b+c)
    Ans=A[-1]
    return Ans
    
    
        
def main():
    s1,s2,a,b,c=(int(e) for e in input().split())
    if s1==0 and s2==0:
        print(f1(a,b,c))
    #elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    elif s1!=1 or s1!=0 or s2!=1 or s2!=0:
        print('Error')
    
exec(input().strip()) # DON'T remove this line
# 1641775, 2022-09-24 10:28:45, compilation error (0%)

def f1(a, b, c):
    P=[]
    if a>0:
        P.append(a)
    if b>0:
        P.append(b)
    if c>0:
        P.append(c)
    Ans=min(P)
    return Ans

def f2(a, b, c):
    P=[]
    if a<0:
        P.append(a)
    if b<0:
        P.append(b)
    if c<0:
        P.append(c)
    Ans=max(P)
    return Ans
    
def f3(a, b, c):
    A=str(a+b+c)
    if A[0]=='-':
        A=A[1:]
    Ans=A[0]
    return Ans

def f4(a, b, c):
    A=str(a+b+c)
    Ans=A[-1]
    return Ans
    
    
        
def main():
    s1,s2,a,b,c=(int(e) for e in input().split())
    #if s1==0 and s2==0:
        print(f1(a,b,c))
    if s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    elif s1!=1 or s1!=0 or s2!=1 or s2!=0:
        print('Error')
    
exec(input().strip()) # DON'T remove this line
# 1641777, 2022-09-24 10:28:52, PP--[-P][PPPP] (50%)

def f1(a, b, c):
    P=[]
    if a>0:
        P.append(a)
    if b>0:
        P.append(b)
    if c>0:
        P.append(c)
    Ans=min(P)
    return Ans

def f2(a, b, c):
    P=[]
    if a<0:
        P.append(a)
    if b<0:
        P.append(b)
    if c<0:
        P.append(c)
    Ans=max(P)
    return Ans
    
def f3(a, b, c):
    A=str(a+b+c)
    if A[0]=='-':
        A=A[1:]
    Ans=A[0]
    return Ans

def f4(a, b, c):
    A=str(a+b+c)
    Ans=A[-1]
    return Ans
    
    
        
def main():
    s1,s2,a,b,c=(int(e) for e in input().split())
    #if s1==0 and s2==0:
        #print(f1(a,b,c))
    if s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    elif s1!=1 or s1!=0 or s2!=1 or s2!=0:
        print('Error')
    
exec(input().strip()) # DON'T remove this line
# 1641913, 2022-09-24 10:30:59, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    P=[]
    if a>0:
        P.append(a)
    if b>0:
        P.append(b)
    if c>0:
        P.append(c)
    Ans=min(P)
    return Ans

def f2(a, b, c):
    P=[]
    if a<0:
        P.append(a)
    if b<0:
        P.append(b)
    if c<0:
        P.append(c)
    Ans=max(P)
    return Ans
    
def f3(a, b, c):
    s=a+b+c
    A=str(s)
    if A[0]=='-':
        A=A[1:]
    Ans=A[0]
    return Ans

def f4(a, b, c):
    s=a+b+c
    A=str(s)
    Ans=A[-1]
    return Ans
    
    
        
def main():
    s1,s2,a,b,c=(int(e) for e in input().split())
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    elif s1!=1 or s1!=0 or s2!=1 or s2!=0:
        print('Error')
    
exec(input().strip()) # DON'T remove this line

# 1642126, 2022-09-24 10:34:42, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    P=[]
    if a>0:
        P.append(a)
    if b>0:
        P.append(b)
    if c>0:
        P.append(c)
    Ans=min(P)
    return Ans

def f2(a, b, c):
    P=[]
    if a<0:
        P.append(a)
    if b<0:
        P.append(b)
    if c<0:
        P.append(c)
    Ans=max(P)
    return Ans
    
def f3(a, b, c):
    s=a+b+c
    A=str(s)
    if A[0]=='-':
        A=A[1:]
    Ans=A[0]
    return Ans

def f4(a, b, c):
    s=a+b+c
    A=str(s)
    Ans=A[-1]
    return Ans
    
    
        
def main():
    s1,s2,a,b,c=(int(e) for e in input().split())
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    #elif s1!=1 or s1!=0 or s2!=1 or s2!=0:
    else:
        print('Error')
    
exec(input().strip()) # DON'T remove this line

# 1642154, 2022-09-24 10:35:15, -P--[-P][PPPP] (33%)

def f1(a, b, c):
    print('A')

def f2(a, b, c):
    P=[]
    if a<0:
        P.append(a)
    if b<0:
        P.append(b)
    if c<0:
        P.append(c)
    Ans=max(P)
    return Ans
    
def f3(a, b, c):
    s=a+b+c
    A=str(s)
    if A[0]=='-':
        A=A[1:]
    Ans=A[0]
    return Ans

def f4(a, b, c):
    s=a+b+c
    A=str(s)
    Ans=A[-1]
    return Ans
    
    
        
def main():
    s1,s2,a,b,c=(int(e) for e in input().split())
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    #elif s1!=1 or s1!=0 or s2!=1 or s2!=0:
    else:
        print('Error')
    
exec(input().strip()) # DON'T remove this line
# 1642180, 2022-09-24 10:35:29, Px--[Px][PPPP] (33%)

def f1(a, b, c):
    P=[]
    if a>0:
        P.append(a)
    if b>0:
        P.append(b)
    if c>0:
        P.append(c)
    Ans=min(P)
    return Ans

def f2(a, b, c):
    print(A)
    
def f3(a, b, c):
    s=a+b+c
    A=str(s)
    if A[0]=='-':
        A=A[1:]
    Ans=A[0]
    return Ans

def f4(a, b, c):
    s=a+b+c
    A=str(s)
    Ans=A[-1]
    return Ans
    
    
        
def main():
    s1,s2,a,b,c=(int(e) for e in input().split())
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    #elif s1!=1 or s1!=0 or s2!=1 or s2!=0:
    else:
        print('Error')
    
exec(input().strip()) # DON'T remove this line
# 1642203, 2022-09-24 10:35:49, PPx-[PP][PxPx] (50%)

def f1(a, b, c):
    P=[]
    if a>0:
        P.append(a)
    if b>0:
        P.append(b)
    if c>0:
        P.append(c)
    Ans=min(P)
    return Ans

def f2(a, b, c):
    P=[]
    if a<0:
        P.append(a)
    if b<0:
        P.append(b)
    if c<0:
        P.append(c)
    Ans=max(P)
    return Ans
    
def f3(a, b, c):
    print(A)

def f4(a, b, c):
    s=a+b+c
    A=str(s)
    Ans=A[-1]
    return Ans
    
    
        
def main():
    s1,s2,a,b,c=(int(e) for e in input().split())
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    #elif s1!=1 or s1!=0 or s2!=1 or s2!=0:
    else:
        print('Error')
    
exec(input().strip()) # DON'T remove this line
# 1642218, 2022-09-24 10:36:03, PP-x[PP][PPPP] (67%)

def f1(a, b, c):
    P=[]
    if a>0:
        P.append(a)
    if b>0:
        P.append(b)
    if c>0:
        P.append(c)
    Ans=min(P)
    return Ans

def f2(a, b, c):
    P=[]
    if a<0:
        P.append(a)
    if b<0:
        P.append(b)
    if c<0:
        P.append(c)
    Ans=max(P)
    return Ans
    
def f3(a, b, c):
    s=a+b+c
    A=str(s)
    if A[0]=='-':
        A=A[1:]
    Ans=A[0]
    return Ans

def f4(a, b, c):
    print(A)
    
    
        
def main():
    s1,s2,a,b,c=(int(e) for e in input().split())
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    #elif s1!=1 or s1!=0 or s2!=1 or s2!=0:
    else:
        print('Error')
    
exec(input().strip()) # DON'T remove this line
# 1642291, 2022-09-24 10:36:59, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    P=[]
    if a>0:
        P.append(a)
    if b>0:
        P.append(b)
    if c>0:
        P.append(c)
    Ans=min(P)
    return Ans

def f2(a, b, c):
    P=[]
    if a<0:
        P.append(a)
    if b<0:
        P.append(b)
    if c<0:
        P.append(c)
    Ans=max(P)
    return Ans
    
def f3(a, b, c):
    s=a+b+c
    A=str(s)
    if A[0]=='-':
        A=A[1:]
    Ans=A[0]
    return Ans

def f4(a, b, c):
    s=a+b+c
    A=s%10
    Ans=A
    return Ans
    
    
        
def main():
    s1,s2,a,b,c=(int(e) for e in input().split())
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    #elif s1!=1 or s1!=0 or s2!=1 or s2!=0:
    else:
        print('Error')
    
exec(input().strip()) # DON'T remove this line

# 1642309, 2022-09-24 10:37:12, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    P=[]
    if a>0:
        P.append(a)
    if b>0:
        P.append(b)
    if c>0:
        P.append(c)
    Ans=min(P)
    return Ans

def f2(a, b, c):
    P=[]
    if a<0:
        P.append(a)
    if b<0:
        P.append(b)
    if c<0:
        P.append(c)
    Ans=max(P)
    return Ans
    
def f3(a, b, c):
    s=a+b+c
    A=str(s)
    if A[0]=='-':
        A=A[1:]
    Ans=A[0]
    return Ans

def f4(a, b, c):
    s=a+b+c
    A=s%10
    Ans=A
    return Ans
    
    
        
def main():
    s1,s2,a,b,c=(int(e) for e in input().split())
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    elif s1!=1 or s1!=0 or s2!=1 or s2!=0:
        print('Error')
    
exec(input().strip()) # DON'T remove this line

6231715621
# 1639348, 2022-09-24 09:28:10, P---[xx][xxxx] (17%)

def f1(a, b, c):
    x = [a,b,c]
    out = []
    minx = ''
    for i in x:
        if i > 0:
            out.append(i)
    minx = min(out)
    return int(minx)
            
    

def f2(a, b, c):
    
    pass
def f3(a, b, c):
    pass

def f4(a, b, c):
    pass

def main():
    s1,s2,a,b,c = input()
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print((f3(a,b,c)))
    if s1 == 1 and s2 == 0:
        print((f4(a,b,c)))
    else:
        print("ERROR")
    
exec(input().strip()) # DON'T remove this line

# 1639417, 2022-09-24 09:29:59, P---[--][----] (17%)

def f1(a, b, c):
    x = [a,b,c]
    out = []
    minx = ''
    for i in x:
        if i > 0:
            out.append(i)
    minx = min(out)
    return int(minx)
            
    

def f2(a, b, c):
    
    
    pass
def f3(a, b, c):
    pass

def f4(a, b, c):
    pass

def main():
    s1,s2,a,b,c = input().split()
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print((f3(a,b,c)))
    if s1 == 1 and s2 == 0:
        print((f4(a,b,c)))
    else:
        print("ERROR")
    
exec(input().strip()) # DON'T remove this line

# 1639517, 2022-09-24 09:32:13, PP--[--][----] (33%)

def f1(a, b, c):
    x = [a,b,c]
    out = []
    min_x = ''
    for i in x:
        if i > 0:
            out.append(i)
    min_x = min(out)
    return int(min_x)
            
    

def f2(a, b, c):
    x = [a,b,c]
    out = []
    max_x = ''
    for i in x:
        if i < 0:
            out.append(i)
    max_x = max(out)
    return int(max_x)
    
    
    
def f3(a, b, c):
    pass

def f4(a, b, c):
    pass

def main():
    s1,s2,a,b,c = input().split()
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print((f3(a,b,c)))
    if s1 == 1 and s2 == 0:
        print((f4(a,b,c)))
    else:
        print("ERROR")
    
exec(input().strip()) # DON'T remove this line

# 1639625, 2022-09-24 09:34:56, PP--[--][----] (33%)

def f1(a, b, c):
    x = [a,b,c]
    out = []
    min_x = ''
    for i in x:
        if i > 0:
            out.append(i)
    min_x = min(out)
    return int(min_x)
            
    

def f2(a, b, c):
    x = [a,b,c]
    out = []
    max_x = ''
    for i in x:
        if i < 0:
            out.append(i)
    max_x = max(out)
    return int(max_x)
    
    
    
def f3(a, b, c):
    sum_x = a+b+c
    total = (abs(sum_x))
    total_str = (str(total))[0]
    return total_str

def f4(a, b, c):
    pass

def main():
    s1,s2,a,b,c = input().split()
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print((f3(a,b,c)))
    if s1 == 1 and s2 == 0:
        print((f4(a,b,c)))
    else:
        print("ERROR")
    
exec(input().strip()) # DON'T remove this line

# 1639675, 2022-09-24 09:36:19, PP--[--][----] (33%)

def f1(a, b, c):
    x = [a,b,c]
    out = []
    min_x = ''
    for i in x:
        if i > 0:
            out.append(i)
    min_x = min(out)
    return int(min_x)
            
    

def f2(a, b, c):
    x = [a,b,c]
    out = []
    max_x = ''
    for i in x:
        if i < 0:
            out.append(i)
    max_x = max(out)
    return int(max_x)
    
    
    
def f3(a, b, c):
    sum_x = a+b+c
    total = (abs(sum_x))
    total_str = (str(total))[0]
    return total_str

def f4(a, b, c):
    sum_x = a+b+c
    total = (abs(sum_x))
    total_str = (str(total))[-1]
    return total_str
    

def main():
    s1,s2,a,b,c = input().split()
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print((f3(a,b,c)))
    if s1 == 1 and s2 == 0:
        print((f4(a,b,c)))
    else:
        print("ERROR")
    
exec(input().strip()) # DON'T remove this line

# 1639699, 2022-09-24 09:37:01, PP--[--][----] (33%)

def f1(a, b, c):
    x = [a,b,c]
    out = []
    min_x = ''
    for i in x:
        if i > 0:
            out.append(i)
    min_x = min(out)
    return int(min_x)
            
    

def f2(a, b, c):
    x = [a,b,c]
    out = []
    max_x = ''
    for i in x:
        if i < 0:
            out.append(i)
    max_x = max(out)
    return int(max_x)
    
    
    
def f3(a, b, c):
    sum_x = a+b+c
    total = (abs(sum_x))
    total_str = (str(total))[0]
    return total_str

def f4(a, b, c):
    sum_x = a+b+c
    total = (abs(sum_x))
    total_str = (str(total))[-1]
    return total_str
    

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print((f3(a,b,c)))
    if s1 == 1 and s2 == 0:
        print((f4(a,b,c)))
    else:
        print("ERROR")
    
exec(input().strip()) # DON'T remove this line

# 1639721, 2022-09-24 09:37:41, PP--[--][----] (33%)

def f1(a, b, c):
    x = [a,b,c]
    out = []
    min_x = ''
    for i in x:
        if i > 0:
            out.append(i)
    min_x = min(out)
    return int(min_x)
            
    

def f2(a, b, c):
    x = [a,b,c]
    out = []
    max_x = ''
    for i in x:
        if i < 0:
            out.append(i)
    max_x = max(out)
    return int(max_x)
    
    
    
def f3(a, b, c):
    sum_x = a+b+c
    total = (abs(sum_x))
    total_str = (str(total))[0]
    return total_str

def f4(a, b, c):
    sum_x = a+b+c
    total = (abs(sum_x))
    total_str = (str(total))[-1]
    return total_str
    

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print((f3(a,b,c)))
    if s1 == 1 and s2 == 0:
        print((f4(a,b,c)))
    else:
        print("ERROR")
    
exec(input().strip()) # DON'T remove this line

# 1639800, 2022-09-24 09:39:37, PP--[PP][----] (50%)

def f1(a, b, c):
    x = [a,b,c]
    out = []
    min_x = ''
    for i in x:
        if i > 0:
            out.append(i)
    min_x = min(out)
    return int(min_x)
            
    

def f2(a, b, c):
    x = [a,b,c]
    out = []
    max_x = ''
    for i in x:
        if i < 0:
            out.append(i)
    max_x = max(out)
    return int(max_x)
    
    
    
def f3(a, b, c):
    sum_x = a+b+c
    total = (abs(sum_x))
    total_str = (str(total))[0]
    return total_str

def f4(a, b, c):
    sum_x = a+b+c
    total = (abs(sum_x))
    total_str = (str(total))[-1]
    return total_str
    

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print((f3(a,b,c)))
    if s1 == 1 and s2 == 0:
        print((f4(a,b,c)))
    elif s1 not in [0,1] or s2 not in [0,1]:
        print("ERROR")
    
exec(input().strip()) # DON'T remove this line

# 1639936, 2022-09-24 09:43:37, PP--[PP][-P-P] (50%)

def f1(a, b, c):
    x = [a,b,c]
    out = []
    min_x = ''
    for i in x:
        if i > 0:
            out.append(i)
    min_x = min(out)
    return int(min_x)
            
    

def f2(a, b, c):
    x = [a,b,c]
    out = []
    max_x = ''
    for i in x:
        if i < 0:
            out.append(i)
    max_x = max(out)
    return int(max_x)
    
    
    
def f3(a, b, c):
    sum_x = a+b+c
    total = (abs(sum_x))
    total_str = (str(total))[0]
    return total_str

def f4(a, b, c):
    sum_x = a+b+c
    total = (abs(sum_x))
    total_str = (str(total))[-1]
    return total_str
    

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print((f3(a,b,c)))
    elif s1 == 1 and s2 == 0:
        print((f4(a,b,c)))
    else:# s1 not in [0,1] or s2 not in [0,1]:
        print("ERROR")
    
exec(input().strip()) # DON'T remove this line

# 1640026, 2022-09-24 09:46:14, PP--[PP][-P-P] (50%)

def f1(a, b, c):
    x = [a,b,c]
    out = []
    min_x = ''
    for i in x:
        if i > 0:
            out.append(i)
    min_x = min(out)
    return int(min_x)
            
    

def f2(a, b, c):
    x = [a,b,c]
    out = []
    max_x = ''
    for i in x:
        if i < 0:
            out.append(i)
    max_x = max(out)
    return int(max_x)
    
    
    
def f3(a, b, c):
    sum_x = a+b+c
    total = (abs(sum_x))
    total_str = (str(total))[0]
    return total_str

def f4(a, b, c):
    sum_x = a+b+c
    total = (abs(sum_x))
    total_str = (str(total))[-1]
    return total_str
    

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print((f3(a,b,c)))
    elif s1 == 1 and s2 == 1 :
        print((f4(a,b,c)))
    elif s1 not in [0,1] or s2 not in [0,1]:
        print("ERROR")
    
exec(input().strip()) # DON'T remove this line

# 1640058, 2022-09-24 09:47:06, PP--[PP][-P-P] (50%)

def f1(a, b, c):
    x = [a,b,c]
    out = []
    min_x = ''
    for i in x:
        if i > 0:
            out.append(i)
    min_x = min(out)
    return int(min_x)
            
    

def f2(a, b, c):
    x = [a,b,c]
    out = []
    max_x = ''
    for i in x:
        if i < 0:
            out.append(i)
    max_x = max(out)
    return int(max_x)
    
    
    
def f3(a, b, c):
    sum_x = a+b+c
    total = (abs(sum_x))
    total_str = (str(total))[0]
    return total_str

def f4(a, b, c):
    sum_x = a+b+c
    total = (abs(sum_x))
    total_str = (str(total))[-1]
    return total_str
    

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print((f3(a,b,c)))
    elif s1 == 1 and s2 == 1 :
        print((f4(a,b,c)))
    elif s1 not in [0,1] or s2 not in [0,1]:
        print("ERROR")
    
exec(input().strip()) # DON'T remove this line

# 1640503, 2022-09-24 09:59:22, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x = [a,b,c]
    out = []
    min_x = ''
    for i in x:
        if i > 0:
            out.append(i)
    min_x = min(out)
    return int(min_x)
            
    

def f2(a, b, c):
    x = [a,b,c]
    out = []
    max_x = ''
    for i in x:
        if i < 0:
            out.append(i)
    max_x = max(out)
    return int(max_x)
    
    
    
def f3(a, b, c):
    sum_x = a+b+c
    total = (abs(sum_x))
    total_str = (str(total))[0]
    return total_str

def f4(a, b, c):
    sum_x = a+b+c
    total = (abs(sum_x))
    total_str = (str(total))[-1]
    return total_str
    

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print((f3(a,b,c)))
    elif s1 == 1 and s2 == 1 :
        print((f4(a,b,c)))
    elif s1 not in [0,1] or s2 not in [0,1]:
        print("Error")
    
exec(input().strip()) # DON'T remove this line


# 1641168, 2022-09-24 10:16:52, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x = [a,b,c]
    out = []
    min_x = ''
    for i in x:
        if i > 0:
            out.append(i)
    min_x = min(out)
    return int(min_x)
            
    

def f2(a, b, c):
    x = [a,b,c]
    out = []
    max_x = ''
    for i in x:
        if i < 0:
            out.append(i)
    max_x = max(out)
    return int(max_x)
    
    
    
def f3(a, b, c):
    sum_x = a+b+c
    total = (abs(sum_x))
    total_str = (str(total))[0]
    return total_str


def f4(a, b, c):
    sum_x = a+b+c
    total = (abs(sum_x))
    total_str = (str(total))[-1]
    return total_str
    

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print((f3(a,b,c)))
    elif s1 == 1 and s2 == 1 :
        print((f4(a,b,c)))
    elif s1 not in [0,1] or s2 not in [0,1]:
        print("Error")
    
exec(input().strip()) # DON'T remove this line


# 1641358, 2022-09-24 10:20:39, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x = [a,b,c]
    out = []
    min_x = ''
    for i in x:
        if i > 0:
            out.append(i)
    min_x = min(out)
    return int(min_x)
            
    

def f2(a, b, c):
    x = [a,b,c]
    out = []
    max_x = ''
    for i in x:
        if i < 0:
            out.append(i)
    max_x = max(out)
    return int(max_x)
    
    
    
def f3(a, b, c):
    sum_x = a+b+c
    total = (abs(sum_x))
    total_str = (str(total))[0]
    return total_str


def f4(a, b, c):
    sum_x = a+b+c
    total = (abs(sum_x))
    total_str = (str(total))[-1]
    return total_str
    

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    elif s1 not in [0,1] or s2 not in [0,1]:
        print("Error")
    
exec(input().strip()) # DON'T remove this line


# 1641406, 2022-09-24 10:21:34, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x = [a,b,c]
    out = []
    min_x = ''
    for i in x:
        if i > 0:
            out.append(i)
    min_x = min(out)
    return int(min_x)
            
    

def f2(a, b, c):
    x = [a,b,c]
    out = []
    max_x = ''
    for i in x:
        if i < 0:
            out.append(i)
    max_x = max(out)
    return int(max_x)
    
    
    
def f3(a, b, c):
    sum_x = a+b+c
    total = (abs(sum_x))
    total_str = (str(total))[0]
    return total_str


def f4(a, b, c):
    sum_x = a+b+c
    total = (abs(sum_x))
    total_str = (str(total))[-1]
    return total_str
    

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    if s1 not in [0,1] or s2 not in [0,1]:
        print("Error")
    
exec(input().strip()) # DON'T remove this line


# 1641421, 2022-09-24 10:21:57, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x = [a,b,c]
    out = []
    min_x = ''
    for i in x:
        if i > 0:
            out.append(i)
    min_x = min(out)
    return int(min_x)
            
    

def f2(a, b, c):
    x = [a,b,c]
    out = []
    max_x = ''
    for i in x:
        if i < 0:
            out.append(i)
    max_x = max(out)
    return int(max_x)
    
    
    
def f3(a, b, c):
    sum_x = a+b+c
    total = (abs(sum_x))
    total_str = (str(total))[0]
    return total_str


def f4(a, b, c):
    sum_x = a+b+c
    total = (abs(sum_x))
    total_str = (str(total))[-1]
    return total_str
    

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    elif s1 not in [0,1] or s2 not in [0,1]:
        print("Error")
    
exec(input().strip()) # DON'T remove this line
# 1641424, 2022-09-24 10:22:01, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x = [a,b,c]
    out = []
    min_x = ''
    for i in x:
        if i > 0:
            out.append(i)
    min_x = min(out)
    return int(min_x)
            
    

def f2(a, b, c):
    x = [a,b,c]
    out = []
    max_x = ''
    for i in x:
        if i < 0:
            out.append(i)
    max_x = max(out)
    return int(max_x)
    
    
    
def f3(a, b, c):
    sum_x = a+b+c
    total = (abs(sum_x))
    total_str = (str(total))[0]
    return total_str


def f4(a, b, c):
    sum_x = a+b+c
    total = (abs(sum_x))
    total_str = (str(total))[-1]
    return total_str
    

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    elif s1 not in [0,1] or s2 not in [0,1]:
        print("Error")
    
exec(input().strip()) # DON'T remove this line

6530194721
# 1640242, 2022-09-24 09:51:56, ----[PP][PPPP] (33%)

def f1(a, b, c):
    if a<0:
        a=1001
    if b<0:
        b=1001
    if c<0:
        c=1001
    if int(a)<int(b) and int(a)<int(c) and int(a)>0:
        return(a)
    elif int(b)<int(a) and int(b)<int(c) and int(b)>0:
        return(b)
    elif int(c)<int(b) and int(c)<int(a) and int(c)>0:
        return(c)
def f2(a, b, c):
    if a>0:
        a=-1001
    if b>0:
        b=-1001
    if c>0:
        c=-1001
    if int(b)<int(a) and int(c)<int(a) and int(a)<0:
        return(a)
    elif int(a)<int(b) and int(c)<int(b) and int(b)<0:
        return(b)
    elif int(b)<int(c) and int(a)<int(c) and int(c)<0:
        return(c)
def f3(a, b, c):
    l = abs(a+b+c)
    l = str(l)
    return(l[0])
def f4(a, b, c):
    l = abs(a+b+c)
    l = str(l)
    return(l[-1])
def main():
    s1,s2,a,b,c= [int(i) for i in input().split()]
    if s1 == 0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2 ==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1640348, 2022-09-24 09:55:18, ----[PP][PPPP] (33%)

def f1(a, b, c):
    if a<0:
        a=1001
    if b<0:
        b=1001
    if c<0:
        c=1001
    if int(a)<=int(b) and int(a)<=int(c) and int(a)>0:
        return(a)
    elif int(b)<=int(a) and int(b)<=int(c) and int(b)>0:
        return(b)
    elif int(c)<=int(b) and int(c)<=int(a) and int(c)>0:
        return(c)
def f2(a, b, c):
    if a>0:
        a=-1001
    if b>0:
        b=-1001
    if c>0:
        c=-1001
    if int(b)<int(a) and int(c)<int(a) and int(a)<0:
        return(a)
    elif int(a)<int(b) and int(c)<int(b) and int(b)<0:
        return(b)
    elif int(b)<int(c) and int(a)<int(c) and int(c)<0:
        return(c)
def f3(a, b, c):
    l = abs(a+b+c)
    l = str(l)
    return(l[0])
def f4(a, b, c):
    l = abs(a+b+c)
    l = str(l)
    return(l[-1])
def main():
    s1,s2,a,b,c= [int(i) for i in input().split()]
    if s1 == 0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2 ==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this
# 1640373, 2022-09-24 09:55:58, ----[PP][PPPP] (33%)

def f1(a, b, c):
    if a<0:
        a=1000
    if b<0:
        b=1000
    if c<0:
        c=1000
    if int(a)<=int(b) and int(a)<=int(c) and int(a)>0:
        return(a)
    elif int(b)<=int(a) and int(b)<=int(c) and int(b)>0:
        return(b)
    elif int(c)<=int(b) and int(c)<=int(a) and int(c)>0:
        return(c)
def f2(a, b, c):
    if a>0:
        a=-1000
    if b>0:
        b=-1000
    if c>0:
        c=-1000
    if int(b)<int(a) and int(c)<int(a) and int(a)<0:
        return(a)
    elif int(a)<int(b) and int(c)<int(b) and int(b)<0:
        return(b)
    elif int(b)<int(c) and int(a)<int(c) and int(c)<0:
        return(c)
def f3(a, b, c):
    l = abs(a+b+c)
    l = str(l)
    return(l[0])
def f4(a, b, c):
    l = abs(a+b+c)
    l = str(l)
    return(l[-1])
def main():
    s1,s2,a,b,c= [int(i) for i in input().split()]
    if s1 == 0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2 ==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this
# 1640955, 2022-09-24 10:11:19, ----[PP][PPPP] (33%)

def f1(a, b, c):
    if int(a)<0:
        a=1000
    if int(b)<0:
        b=1000
    if int(c)<0:
        c=1000
    if int(a)<=int(b) and int(a)<=int(c) and int(a)>0:
        return(a)
    elif int(b)<=int(a) and int(b)<=int(c) and int(b)>0:
        return(b)
    elif int(c)<=int(b) and int(c)<=int(a) and int(c)>0:
        return(c)
def f2(a, b, c):
    if a>0:
        a=-1000
    if b>0:
        b=-1000
    if c>0:
        c=-1000
    if int(b)<int(a) and int(c)<int(a) and int(a)<0:
        return(a)
    elif int(a)<int(b) and int(c)<int(b) and int(b)<0:
        return(b)
    elif int(b)<int(c) and int(a)<int(c) and int(c)<0:
        return(c)
def f3(a, b, c):
    l = abs(a+b+c)
    l = str(l)
    return(l[0])
def f4(a, b, c):
    l = abs(a+b+c)
    l = str(l)
    return(l[-1])
def main():
    s1,s2,a,b,c= [int(i) for i in input().split()]
    if s1 == 0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2 ==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this
# 1640975, 2022-09-24 10:11:52, ----[PP][PPPP] (33%)

def f1(a, b, c):
    if int(a)<0:
        a=1000
    if int(b)<0:
        b=1000
    if int(c)<0:
        c=1000
    if int(a)<=int(b) and int(a)<=int(c) and int(a)>0:
        return(a)
    elif int(b)<=int(a) and int(b)<=int(c) and int(b)>0:
        return(b)
    elif int(c)<=int(b) and int(c)<=int(a) and int(c)>0:
        return(c)
def f2(a, b, c):
    if int(a)>0:
        a=-1000
    if int(b)>0:
        b=-1000
    if int(c)>0:
        c=-1000
    if int(b)<int(a) and int(c)<int(a) and int(a)<0:
        return(a)
    elif int(a)<int(b) and int(c)<int(b) and int(b)<0:
        return(b)
    elif int(b)<int(c) and int(a)<int(c) and int(c)<0:
        return(c)
def f3(a, b, c):
    l = abs(a+b+c)
    l = str(l)
    return(l[0])
def f4(a, b, c):
    l = abs(a+b+c)
    l = str(l)
    return(l[-1])
def main():
    s1,s2,a,b,c= [int(i) for i in input().split()]
    if s1 == 0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2 ==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this
# 1641700, 2022-09-24 10:27:17, ----[-P][PPPP] (17%)

def f1(a, b, c):
    if int(a)<0:
        a=1000
    elif int(b)<0:
        b=1000
    elif int(c)<0:
        c=1000
    elif int(a)<=int(b) and int(a)<=int(c) and int(a)>0:
        return(a)
    elif int(b)<=int(a) and int(b)<=int(c) and int(b)>0:
        return(b)
    elif int(c)<=int(b) and int(c)<=int(a) and int(c)>0:
        return(c)
def f2(a, b, c):
    if int(a)>0:
        a=-1000
    if int(b)>0:
        b=-1000
    if int(c)>0:
        c=-1000
    if int(b)<int(a) and int(c)<int(a) and int(a)<0:
        return(a)
    elif int(a)<int(b) and int(c)<int(b) and int(b)<0:
        return(b)
    elif int(b)<int(c) and int(a)<int(c) and int(c)<0:
        return(c)
def f3(a, b, c):
    l = abs(a+b+c)
    l = str(l)
    return(l[0])
def f4(a, b, c):
    l = abs(a+b+c)
    l = str(l)
    return(l[-1])
def main():
    s1,s2,a,b,c= [int(i) for i in input().split()]
    if s1 == 0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2 ==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this
# 1641729, 2022-09-24 10:27:53, compilation error (0%)

def f1(a, b, c):

    
def f2(a, b, c):
    if int(a)>0:
        a=-1000
    if int(b)>0:
        b=-1000
    if int(c)>0:
        c=-1000
    if int(b)<int(a) and int(c)<int(a) and int(a)<0:
        return(a)
    elif int(a)<int(b) and int(c)<int(b) and int(b)<0:
        return(b)
    elif int(b)<int(c) and int(a)<int(c) and int(c)<0:
        return(c)
def f3(a, b, c):
    l = abs(a+b+c)
    l = str(l)
    return(l[0])
def f4(a, b, c):
    l = abs(a+b+c)
    l = str(l)
    return(l[-1])
def main():
    s1,s2,a,b,c= [int(i) for i in input().split()]
    if s1 == 0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2 ==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this
# 1641822, 2022-09-24 10:29:34, compilation error (0%)

 f1(a, b, c):
    if a<0:
        a=1001
    if b<0:
        b=1001
    if c<0:
        c=1001
    if int(a)<=int(b) and int(a)<=int(c) and int(a)>0:
        return(a)
    elif int(b)<=int(a) and int(b)<=int(c) and int(b)>0:
        return(b)
    elif int(c)<=int(b) and int(c)<=int(a) and int(c)>0:
        return(c)
def f2(a, b, c):
    if a>0:
        a=-1001
    if b>0:
        b=-1001
    if c>0:
        c=-1001
    if int(b)<int(a) and int(c)<int(a) and int(a)<0:
        return(a)
    elif int(a)<int(b) and int(c)<int(b) and int(b)<0:
        return(b)
    elif int(b)<int(c) and int(a)<int(c) and int(c)<0:
        return(c)
def f3(a, b, c):
    l = abs(a+b+c)
    l = str(l)
    return(l[0])
def f4(a, b, c):
    l = abs(a+b+c)
    l = str(l)
    return(l[-1])
def main():
    s1,s2,a,b,c= [int(i) for i in input().split()]
    if s1 == 0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2 ==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1641851, 2022-09-24 10:29:58, ----[PP][PPPP] (33%)

def f1(a, b, c):
    if a<0:
        a=1001
    if b<0:
        b=1001
    if c<0:
        c=1001
    if int(a)<=int(b) and int(a)<=int(c) and int(a)>0:
        return(a)
    elif int(b)<=int(a) and int(b)<=int(c) and int(b)>0:
        return(b)
    elif int(c)<=int(b) and int(c)<=int(a) and int(c)>0:
        return(c)
def f2(a, b, c):
    if a>0:
        a=-1001
    if b>0:
        b=-1001
    if c>0:
        c=-1001
    if int(b)<int(a) and int(c)<int(a) and int(a)<0:
        return(a)
    elif int(a)<int(b) and int(c)<int(b) and int(b)<0:
        return(b)
    elif int(b)<int(c) and int(a)<int(c) and int(c)<0:
        return(c)
def f3(a, b, c):
    l = abs(a+b+c)
    l = str(l)
    return(l[0])
def f4(a, b, c):
    l = abs(a+b+c)
    l = str(l)
    return(l[-1])
def main():
    s1,s2,a,b,c= [int(i) for i in input().split()]
    if s1 == 0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2 ==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1641870, 2022-09-24 10:30:16, ----[P-][PPPP] (17%)

def f1(a, b, c):
    if a<0:
        a=1001
    if b<0:
        b=1001
    if c<0:
        c=1001
    if int(a)<=int(b) and int(a)<=int(c) and int(a)>0:
        return(a)
    elif int(b)<=int(a) and int(b)<=int(c) and int(b)>0:
        return(b)
    elif int(c)<=int(b) and int(c)<=int(a) and int(c)>0:
        return(c)
def f2(a, b, c):
    if a>0:
        a=-1001
    if b>0:
        b=-1001
    if c>0:
        c=-1001
    if int(b)<int(a) and int(c)<int(a) and int(a)<0:
        return(a)
    elif int(a)<int(b) and int(c)<int(b) and int(b)<0:

        return(c)
def f3(a, b, c):
    l = abs(a+b+c)
    l = str(l)
    return(l[0])
def f4(a, b, c):
    l = abs(a+b+c)
    l = str(l)
    return(l[-1])
def main():
    s1,s2,a,b,c= [int(i) for i in input().split()]
    if s1 == 0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2 ==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1641941, 2022-09-24 10:31:29, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    if a<0:
        a=1001
    if b<0:
        b=1001
    if c<0:
        c=1001
    if int(a)<=int(b) and int(a)<=int(c) and int(a)>0:
        return(a)
    elif int(b)<=int(a) and int(b)<=int(c) and int(b)>0:
        return(b)
    elif int(c)<=int(b) and int(c)<=int(a) and int(c)>0:
        return(c)
def f2(a, b, c):
    if a>0:
        a=-1001
    if b>0:
        b=-1001
    if c>0:
        c=-1001
    if int(b)<int(a) and int(c)<int(a) and int(a)<0:
        return(a)
    elif int(a)<int(b) and int(c)<int(b) and int(b)<0:
        return(b)
    elif int(b)<int(c) and int(a)<int(c) and int(c)<0:
        return(c)
def f3(a, b, c):
    l = abs(a+b+c)
    l = str(l)
    return(int(l[0]))
def f4(a, b, c):
    l = abs(a+b+c)
    l = str(l)
    return(int(l[-1]))
def main():
    s1,s2,a,b,c= [int(i) for i in input().split()]
    if s1 == 0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2 ==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this
# 1641978, 2022-09-24 10:32:14, ---P[PP][PPPP] (50%)

def f1(a, b, c):
    if a<0:
        a=1001
    if b<0:
        b=1001
    if c<0:
        c=1001
    if int(a)<=int(b) and int(a)<=int(c) and int(a)>0:
        return(a)
    elif int(b)<=int(a) and int(b)<=int(c) and int(b)>0:
        return(b)
    elif int(c)<=int(b) and int(c)<=int(a) and int(c)>0:
        return(c)
def f2(a, b, c):
    if a>0:
        a=-1001
    if b>0:
        b=-1001
    if c>0:
        c=-1001
    if int(b)<int(a) and int(c)<int(a) and int(a)<0:
        return(a)
    elif int(a)<int(b) and int(c)<int(b) and int(b)<0:
        return(b)
    elif int(b)<int(c) and int(a)<int(c) and int(c)<0:
        return(c)
def f3(a, b, c):
    l = abs(a+b+c)
    l = str(l)
    return((l[0]))
def f4(a, b, c):
    l = abs(a+b+c)
    l = str(l)
    return(int(l[-1]))
def main():
    s1,s2,a,b,c= [int(i) for i in input().split()]
    if s1 == 0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2 ==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this
# 1642003, 2022-09-24 10:32:50, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    if a<0:
        a=1001
    if b<0:
        b=1001
    if c<0:
        c=1001
    if int(a)<=int(b) and int(a)<=int(c) and int(a)>0:
        return(a)
    elif int(b)<=int(a) and int(b)<=int(c) and int(b)>0:
        return(b)
    elif int(c)<=int(b) and int(c)<=int(a) and int(c)>0:
        return(c)
def f2(a, b, c):
    if a>0:
        a=-1001
    if b>0:
        b=-1001
    if c>0:
        c=-1001
    if int(b)<int(a) and int(c)<int(a) and int(a)<0:
        return(a)
    elif int(a)<int(b) and int(c)<int(b) and int(b)<0:
        return(b)
    elif int(b)<int(c) and int(a)<int(c) and int(c)<0:
        return(c)
def f3(a, b, c):
    l = abs(a+b+c)
    l = str(l)
    return(int(l[0]))
def f4(a, b, c):
    l = abs(a+b+c)
    l = str(l)
    return(int(l[-1]))
def main():
    s1,s2,a,b,c= [int(i) for i in input().split()]
    if s1 == 0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2 ==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this
# 1642057, 2022-09-24 10:33:44, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    if a<0:
        a=1001
    if b<0:
        b=1001
    if c<0:
        c=1001
    if int(a)<=int(b) and int(a)<=int(c) and int(a)>0:
        return(int(a))
    elif int(b)<=int(a) and int(b)<=int(c) and int(b)>0:
        return(int(b))
    elif int(c)<=int(b) and int(c)<=int(a) and int(c)>0:
        return(int(c))
def f2(a, b, c):
    if a>0:
        a=-1001
    if b>0:
        b=-1001
    if c>0:
        c=-1001
    if int(b)<int(a) and int(c)<int(a) and int(a)<0:
        return(int(a))
    elif int(a)<int(b) and int(c)<int(b) and int(b)<0:
        return(int(b))
    elif int(b)<int(c) and int(a)<int(c) and int(c)<0:
        return(int(c))
def f3(a, b, c):
    l = abs(a+b+c)
    l = str(l)
    return(int(l[0]))
def f4(a, b, c):
    l = abs(a+b+c)
    l = str(l)
    return(int(l[-1]))
def main():
    s1,s2,a,b,c= [int(i) for i in input().split()]
    if s1 == 0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2 ==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this
# 1642243, 2022-09-24 10:36:23, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    if a<0:
        a=1001
    if b<0:
        b=1001
    if c<0:
        c=1001
    if int(a)<int(b) and int(a)<int(c) and int(a)>0:
        return(int(a))
    elif int(b)<int(a) and int(b)<int(c) and int(b)>0:
        return(int(b))
    elif int(c)<int(b) and int(c)<int(a) and int(c)>0:
        return(int(c))
def f2(a, b, c):
    if a>0:
        a=-1001
    if b>0:
        b=-1001
    if c>0:
        c=-1001
    if int(b)<int(a) and int(c)<int(a) and int(a)<0:
        return(int(a))
    elif int(a)<int(b) and int(c)<int(b) and int(b)<0:
        return(int(b))
    elif int(b)<int(c) and int(a)<int(c) and int(c)<0:
        return(int(c))
def f3(a, b, c):
    l = abs(a+b+c)
    l = str(l)
    return(int(l[0]))
def f4(a, b, c):
    l = abs(a+b+c)
    l = str(l)
    return(int(l[-1]))
def main():
    s1,s2,a,b,c= [int(i) for i in input().split()]
    if s1 == 0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2 ==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this
# 1642366, 2022-09-24 10:37:50, --PP[--][P-P-] (33%)

def f1(a, b, c):
    if a<0:
        a=1001
    if b<0:
        b=1001
    if c<0:
        c=1001
    if int(a)<int(b) and int(a)<int(c) and int(a)>0:
        return(int(a))
    elif int(b)<int(a) and int(b)<int(c) and int(b)>0:
        return(int(b))
    elif int(c)<int(b) and int(c)<int(a) and int(c)>0:
        return(int(c))
def f2(a, b, c):
    if a>0:
        a=-1001
    if b>0:
        b=-1001
    if c>0:
        c=-1001
    if int(b)<int(a) and int(c)<int(a) and int(a)<0:
        return(int(a))
    elif int(a)<int(b) and int(c)<int(b) and int(b)<0:
        return(int(b))
    elif int(b)<int(c) and int(a)<int(c) and int(c)<0:
        return(int(c))
def f3(a, b, c):
    l = abs(a+b+c)
    l = str(l)
    return(int(l[0]))
def f4(a, b, c):
    l = abs(a+b+c)
    l = str(l)
    return(int(l[-1]))
def main():
    s1,s2,a,b,c= [int(i) for i in input().split()]
    if s1 == 0 and s2==0:
        print(f1(a,b,c))
    if s1==0 and s2==1:
        print(f2(a,b,c))
    if s1==1 and s2 ==0:
        print(f3(a,b,c))
    if s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this
# 1642387, 2022-09-24 10:38:07, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    if a<0:
        a=1001
    if b<0:
        b=1001
    if c<0:
        c=1001
    if int(a)<int(b) and int(a)<int(c) and int(a)>0:
        return(int(a))
    elif int(b)<int(a) and int(b)<int(c) and int(b)>0:
        return(int(b))
    elif int(c)<int(b) and int(c)<int(a) and int(c)>0:
        return(int(c))
def f2(a, b, c):
    if a>0:
        a=-1001
    if b>0:
        b=-1001
    if c>0:
        c=-1001
    if int(b)<int(a) and int(c)<int(a) and int(a)<0:
        return(int(a))
    elif int(a)<int(b) and int(c)<int(b) and int(b)<0:
        return(int(b))
    elif int(b)<int(c) and int(a)<int(c) and int(c)<0:
        return(int(c))
def f3(a, b, c):
    l = abs(a+b+c)
    l = str(l)
    return(int(l[0]))
def f4(a, b, c):
    l = abs(a+b+c)
    l = str(l)
    return(int(l[-1]))
def main():
    s1,s2,a,b,c= [int(i) for i in input().split()]
    if s1 == 0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2 ==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this

6230003221
# 1640639, 2022-09-24 10:03:16, ----[xx][xxxx] (0%)

def f1(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=[a,b,c]
    x.sort()
    if x[1]<0:
        k=x[2]
    else:
        k=x[1]
    return k
def f2(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=[a,b,c]
    x.sort()
    return x[2]
def f3(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=a+b+c
    y=str(x)
    if x<0:
        k=y[1]
    else:
        k=y[0]
    return k
def f4(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=a+b+c
    y=str(x)
    k=y[-1]
    return k


exec(input().strip())
# 1640680, 2022-09-24 10:04:14, ----[xx][xxxx] (0%)

def f1(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=[a,b,c]
    x.sort()
    if x[1]<0:
        k=x[2]
    else:
        k=x[1]
    return k
def f2(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=[a,b,c]
    x.sort()
    return x[2]
def f3(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=a+b+c
    y=str(x)
    if x<0:
        k=y[1]
    else:
        k=y[0]
    return k
def f4(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=a+b+c
    y=str(x)
    k=y[-1]
    return k

exec(input().strip())

# 1640698, 2022-09-24 10:04:50, ----[xx][xxxx] (0%)

def f1(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=[a,b,c]
    x.sort()
    if x[1]<0:
        k=x[2]
    else:
        k=x[1]
    return k
def f2(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=[a,b,c]
    x.sort()
    return x[2]
def f3(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=a+b+c
    y=str(x)
    if x<0:
        k=y[1]
    else:
        k=y[0]
    return k
def f4(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=a+b+c
    y=str(x)
    k=y[-1]
    return k


exec(input().strip())

# 1640855, 2022-09-24 10:08:41, ----[--][----] (0%)

def f1(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=[a,b,c]
    x.sort()
    if x[1]<0:
        k=x[2]
    else:
        k=x[1]
    return k
def f2(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=[a,b,c]
    x.sort()
    return x[2]
def f3(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=a+b+c
    y=str(x)
    if x<0:
        k=y[1]
    else:
        k=y[0]
    return k
def f4(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=a+b+c
    y=str(x)
    k=y[-1]
    return k
def main():
    s1,s2,a,b,c=[int(e)for e in input().split()]
    if s1==0 and s2==0:
        k=f1(a, b, c)
    if s1==0 and s2==1:
        k=f2(a, b, c)
    if s1==1 and s2==0:
        k=f3(a, b, c)
    if s1==1 and s2==1:
        k=f4(a, b, c)
    else:
        k="Error"
    return k
    
exec(input().strip())

# 1640869, 2022-09-24 10:09:00, ----[--][----] (0%)

def f1(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=[a,b,c]
    x.sort()
    if x[1]<0:
        k=x[2]
    else:
        k=x[1]
    return k
def f2(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=[a,b,c]
    x.sort()
    return x[2]
def f3(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=a+b+c
    y=str(x)
    if x<0:
        k=y[1]
    else:
        k=y[0]
    return k
def f4(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=a+b+c
    y=str(x)
    k=y[-1]
    return k
def main():
    s1,s2,a,b,c=[int(e)for e in input().split()]
    if s1==0 and s2==0:
        k=f1(a, b, c)
    if s1==0 and s2==1:
        k=f2(a, b, c)
    if s1==1 and s2==0:
        k=f3(a, b, c)
    if s1==1 and s2==1:
        k=f4(a, b, c)
    else:
        k="Error"
    return k
    
exec(input().strip())
# 1640908, 2022-09-24 10:10:09, ----[--][P-P-] (0%)

def f1(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=[a,b,c]
    x.sort()
    if x[1]<0:
        k=x[2]
    else:
        k=x[1]
    return k
def f2(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=[a,b,c]
    x.sort()
    return x[2]
def f3(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=a+b+c
    y=str(x)
    if x<0:
        k=y[1]
    else:
        k=y[0]
    return k
def f4(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=a+b+c
    y=str(x)
    k=y[-1]
    return k
def main():
    s1,s2,a,b,c=[int(e)for e in input().split()]
    if s1==0 and s2==0:
        k=f1(a, b, c)
    if s1==0 and s2==1:
        k=f2(a, b, c)
    if s1==1 and s2==0:
        k=f3(a, b, c)
    if s1==1 and s2==1:
        k=f4(a, b, c)
    else:
        k="Error"
    return print(k)
    
exec(input().strip())

# 1641229, 2022-09-24 10:18:11, ----[--][P-P-] (0%)

def f1(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=[a,b,c]
    x.sort()
    if x[1]<0:
        k=x[2]
    else:
        k=x[1]
    return k
def f2(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=[a,b,c]
    x.sort()
    return x[2]
def f3(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=a+b+c
    y=str(x)
    if x<0:
        k=y[1]
    else:
        k=y[0]
    return k
def f4(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=a+b+c
    y=str(x)
    k=y[-1]
    return k
def main():
    s1,s2,a,b,c=[int(e)for e in input().split()]
    if s1==0 and s2==0:
        k=f1(a, b, c)
    if s1==0 and s2==1:
        k=f2(a, b, c)
    if s1==1 and s2==0:
        k=f3(a, b, c)
    if s1==1 and s2==1:
        k=f4(a, b, c)
    else:
        k="Error"
    return print(k)
    
exec(input().strip())
# 1641341, 2022-09-24 10:20:15, --PP[--][P-P-] (33%)

def f1(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=[a,b,c]
    x.sort()
    if x[1]<0:
        k=int(x[2])
    else:
        k=int(x[1])
    return k
def f2(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=[a,b,c]
    x.sort()
    return int(x[2])
def f3(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=a+b+c
    y=str(x)
    if x<0:
        k=int(y[1])
    else:
        k=int(y[0])
    return k
def f4(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=a+b+c
    y=str(x)
    k=int(y[-1])
    return k
def main():
    s1,s2,a,b,c=[int(e)for e in input().split()]
    if s1==0 and s2==0:
        k=f1(a, b, c)
    if s1==0 and s2==1:
        k=f2(a, b, c)
    if s1==1 and s2==0:
        k=f3(a, b, c)
    if s1==1 and s2==1:
        k=f4(a, b, c)
    else:
        k="Error"
    return print(k)
    
exec(input().strip())

# 1641426, 2022-09-24 10:22:03, --PP[--][P-P-] (33%)

def f1(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=[a,b,c]
    x.sort()
    if x[1]<0:
        k=x[2]
    else:
        k=x[1]
    return int(k)
def f2(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=[a,b,c]
    x.sort()
    return int(x[2])
def f3(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=a+b+c
    y=str(x)
    if x<0:
        k=y[1]
    else:
        k=y[0]
    return int(k)
def f4(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=a+b+c
    y=str(x)
    k=y[-1]
    return int(k)
def main():
    s1,s2,a,b,c=[int(e)for e in input().split()]
    if s1==0 and s2==0:
        k=f1(a, b, c)
    if s1==0 and s2==1:
        k=f2(a, b, c)
    if s1==1 and s2==0:
        k=f3(a, b, c)
    if s1==1 and s2==1:
        k=f4(a, b, c)
    else:
        k="Error"
    return print(k)
    
exec(input().strip())

# 1641490, 2022-09-24 10:23:31, --PP[--][P-P-] (33%)

def f1(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=[a,b,c]
    x.sort()
    if x[1]<0:
        k=x[2]
    else:
        k=x[1]
    return int(k)
def f2(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=[a,b,c]
    x.sort()
    return int(x[2])
def f3(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=a+b+c
    y=str(x)
    if x<0:
        k=y[1]
    else:
        k=y[0]
    return int(k)
def f4(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=a+b+c
    y=str(x)
    k=y[-1]
    return int(k)
def main():
    s1,s2,a,b,c=[int(e)for e in input().split()]
    if s1==0 and s2==0:
        y=f1(a, b, c)
    if s1==0 and s2==1:
        y=f2(a, b, c)
    if s1==1 and s2==0:
        y=f3(a, b, c)
    if s1==1 and s2==1:
        y=f4(a, b, c)
    else:
        k="Error"
    return print(k)
    
exec(input().strip())

# 1641801, 2022-09-24 10:29:14, P-xP[--][P-P-] (33%)

def f1(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=[a,b,c]
    x.sort()
    if x[1]<=0:
        k=x[2]
    else:
        k=x[1]
    return int(k)
def f2(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=[a,b,c]
    x.sort()
    return int(x[2])
def f3(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=a+b+c
    y=str(x)
    if x<=0:
        k=y[1]
    else:
        k=y[0]
    return int(k)
def f4(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=a+b+c
    y=str(x)
    k=y[-1]
    return int(k)
def main():
    s1,s2,a,b,c=[int(e)for e in input().split()]
    if s1==0 and s2==0:
        k=f1(a, b, c)
    if s1==0 and s2==1:
        k=f2(a, b, c)
    if s1==1 and s2==0:
        k=f3(a, b, c)
    if s1==1 and s2==1:
        k=f4(a, b, c)
    else:
        k="Error"
    return print(k)
    
exec(input().strip())

# 1641988, 2022-09-24 10:32:28, compilation error (0%)

def f1(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=[a,b,c]
    x.sort()
    if x[1]<0:
        k=x[2]
    else:
        k=x[1]
    if x[1]=0:
        k=x[2]
    return int(k)
def f2(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=[a,b,c]
    x.sort()
    if x[1]>0:
        k=x[0]
    else:
        if x[2]>0:
            k=x[1]
        else:
            k=x[2]
    return int(k)
def f3(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=a+b+c
    y=str(x)
    if x<0:
        k=y[1]
    else:
        k=y[0]
    return int(k)
def f4(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=a+b+c
    y=str(x)
    k=y[-1]
    return int(k)
def main():
    s1,s2,a,b,c=[int(e)for e in input().split()]
    if s1==0 and s2==0:
        k=f1(a, b, c)
    if s1==0 and s2==1:
        k=f2(a, b, c)
    if s1==1 and s2==0:
        k=f3(a, b, c)
    if s1==1 and s2==1:
        k=f4(a, b, c)
    else:
        k="Error"
    return print(k)
    
exec(input().strip())

# 1642009, 2022-09-24 10:32:54, P-PP[--][P-P-] (50%)

def f1(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=[a,b,c]
    x.sort()
    if x[1]<0:
        k=x[2]
    else:
        k=x[1]
    if x[1]==0:
        k=x[2]
    return int(k)
def f2(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=[a,b,c]
    x.sort()
    if x[1]>0:
        k=x[0]
    else:
        if x[2]>0:
            k=x[1]
        else:
            k=x[2]
    return int(k)
def f3(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=a+b+c
    y=str(x)
    if x<0:
        k=y[1]
    else:
        k=y[0]
    return int(k)
def f4(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=a+b+c
    y=str(x)
    k=y[-1]
    return int(k)
def main():
    s1,s2,a,b,c=[int(e)for e in input().split()]
    if s1==0 and s2==0:
        k=f1(a, b, c)
    if s1==0 and s2==1:
        k=f2(a, b, c)
    if s1==1 and s2==0:
        k=f3(a, b, c)
    if s1==1 and s2==1:
        k=f4(a, b, c)
    else:
        k="Error"
    return print(k)
    
exec(input().strip())
# 1642148, 2022-09-24 10:35:08, PPPP[--][P-P-] (67%)

def f1(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=[a,b,c]
    x.sort()
    if x[1]<0:
        k=x[2]
    else:
        k=x[1]
    if x[1]==0:
        k=x[2]
    return int(k)
def f2(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=[a,b,c]
    x.sort()
    if x[1]>=0:
        k=x[0]
    else:
        if x[2]>0:
            k=x[1]
        else:
            k=x[2]
    
    return int(k)
def f3(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=a+b+c
    y=str(x)
    if x<0:
        k=y[1]
    else:
        k=y[0]
    return int(k)
def f4(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=a+b+c
    y=str(x)
    k=y[-1]
    return int(k)
def main():
    s1,s2,a,b,c=[int(e)for e in input().split()]
    if s1==0 and s2==0:
        k=f1(a, b, c)
    if s1==0 and s2==1:
        k=f2(a, b, c)
    if s1==1 and s2==0:
        k=f3(a, b, c)
    if s1==1 and s2==1:
        k=f4(a, b, c)
    else:
        k="Error"
    return print(k)
    
exec(input().strip())

# 1642189, 2022-09-24 10:35:36, PPPP[--][P-P-] (67%)

def f1(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=[a,b,c]
    x.sort()
    if x[1]<=0:
        k=x[2]
    else:
        k=x[1]
    return int(k)
def f2(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=[a,b,c]
    x.sort()
    if x[1]>=0:
        k=x[0]
    else:
        if x[2]>0:
            k=x[1]
        else:
            k=x[2]
    return int(k)
def f3(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=a+b+c
    y=str(x)
    if x<0:
        k=y[1]
    else:
        k=y[0]
    return int(k)
def f4(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    x=a+b+c
    y=str(x)
    k=y[-1]
    return int(k)
def main():
    s1,s2,a,b,c=[int(e)for e in input().split()]
    if s1==0 and s2==0:
        k=f1(a, b, c)
    if s1==0 and s2==1:
        k=f2(a, b, c)
    if s1==1 and s2==0:
        k=f3(a, b, c)
    if s1==1 and s2==1:
        k=f4(a, b, c)
    else:
        k="Error"
    return print(k)
    
exec(input().strip())


6531101521
# 1639478, 2022-09-24 09:31:25, ----[--][----] (0%)

def f1(a, b, c):
    x = [a, b, c]
    for i in range(len(x)):
        if i < 0:
            x.remove(i)
        x.sort()
        return x[1]
# 1639557, 2022-09-24 09:33:22, ----[--][----] (0%)

def f1(a, b, c):
    x = [a, b, c]
    for i in range(len(x)):
        if i < 0:
            x.remove(i)
        x.sort()
        return x[1]
    
def f2(a, b, c):
    x = [a, b, c]
    for i in range(len(x)):
        if i > 0:
            x.remove(i)
        x.sort()
        x[::-1]
        return x[1]
        
    


# 1639632, 2022-09-24 09:35:04, --xx[xx][xxxx] (0%)

def f1(a, b, c):
    x = [a, b, c]
    for i in range(len(x)):
        if i < 0:
            x.remove(i)
        x.sort()
        return x[1]
    
def f2(a, b, c):
    x = [a, b, c]
    for i in range(len(x)):
        if i > 0:
            x.remove(i)
        x.sort()
        x[::-1]
        return x[1]
        


    
exec(input().strip()) # DON'T remove this line

# 1640174, 2022-09-24 09:50:23, ---x[xx][xxxx] (0%)

def f1(a, b, c):
    x = [a, b, c]
    for i in range(len(x)):
        if i < 0:
            x.remove(i)
        x.sort()
        return x[1]
    
def f2(a, b, c):
    x = [a, b, c]
    for i in range(len(x)):
        if i > 0:
            x.remove(i)
        x.sort()
        x[::-1]
        return x[1]
        
def f3(a, b, c):
    x = a + b + c
    x = abs(x)
    y = (x//1)%10
    return y
    


    
exec(input().strip()) # DON'T remove this line

# 1640216, 2022-09-24 09:51:19, --xP[xx][xxxx] (17%)

def f1(a, b, c):
    x = [a, b, c]
    for i in range(len(x)):
        if i < 0:
            x.remove(i)
        x.sort()
        return x[1]
    
def f2(a, b, c):
    x = [a, b, c]
    for i in range(len(x)):
        if i > 0:
            x.remove(i)
        x.sort()
        x[::-1]
        return x[1]
        
def f4(a, b, c):
    x = a + b + c
    x = abs(x)
    y = (x//1)%10
    return y


    
exec(input().strip()) # DON'T remove this line
# 1640507, 2022-09-24 09:59:27, --PP[xx][xxxx] (33%)

def f1(a, b, c):
    x = [a, b, c]
    for i in range(len(x)):
        if i < 0:
            x.remove(i)
        x.sort()
        return x[1]
    
def f2(a, b, c):
    x = [a, b, c]
    for i in range(len(x)):
        if i > 0:
            x.remove(i)
        x.sort()
        x[::-1]
        return x[1]
        
def f3(a, b, c):
    x = a + b + c
    x = str(x)
    if x[0] == '-':
        return int(x[1])
    else:
        return int(x[0])
    y = int(y)
    return y

def f4(a, b, c):
    x = a + b + c
    x = abs(x)
    y = (x//1)%10
    return y
    
    


    
exec(input().strip()) # DON'T remove this line

# 1640658, 2022-09-24 10:03:49, --PP[--][P-P-] (33%)

def f1(a, b, c):
    x = [a, b, c]
    for i in range(len(x)):
        if i < 0:
            x.remove(i)
        x.sort()
        return x[1]
    
def f2(a, b, c):
    x = [a, b, c]
    for i in range(len(x)):
        if i > 0:
            x.remove(i)
        x.sort()
        x[::-1]
        return x[1]
        
def f3(a, b, c):
    x = a + b + c
    x = str(x)
    if x[0] == '-':
        return int(x[1])
    else:
        return int(x[0])
    y = int(y)
    return y

def f4(a, b, c):
    x = a + b + c
    x = abs(x)
    y = (x//1)%10
    return y
    
def main():
    [s1,s2,a,b,c] = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0: print(f1(a,b,c))
    if s1 == 0 and s2 == 1: print(f2(a,b,c))
    if s1 == 1 and s2 == 0: print(f3(a,b,c))
    if s1 == 1 and s2 == 1: print(f4(a,b,c))
    else: print("Error")
    


    
exec(input().strip()) # DON'T remove this line

# 1640703, 2022-09-24 10:04:57, --PP[--][P-P-] (33%)

def f1(a, b, c):
    x = [a, b, c]
    for i in range(len(x)):
        if i < 0:
            x.remove(i)
        x.sort()
        return int(x[1])
    
def f2(a, b, c):
    x = [a, b, c]
    for i in range(len(x)):
        if i > 0:
            x.remove(i)
        x.sort()
        x[::-1]
        return int(x[1])
        
def f3(a, b, c):
    x = a + b + c
    x = str(x)
    if x[0] == '-':
        return int(x[1])
    else:
        return int(x[0])
    y = int(y)
    return y

def f4(a, b, c):
    x = a + b + c
    x = abs(x)
    y = (x//1)%10
    return y
    
def main():
    [s1,s2,a,b,c] = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0: print(f1(a,b,c))
    if s1 == 0 and s2 == 1: print(f2(a,b,c))
    if s1 == 1 and s2 == 0: print(f3(a,b,c))
    if s1 == 1 and s2 == 1: print(f4(a,b,c))
    else: print("Error")
    


    
exec(input().strip()) # DON'T remove this line

# 1641174, 2022-09-24 10:17:02, --PP[--][P-P-] (33%)

def f1(a, b, c):
    x = [a, b, c]
    for i in range(len(x)):
        if i < 0:
            x.remove(i)
    x.sort()
    return int(x[1])
    
def f2(a, b, c):
    x = [a, b, c]
    for i in range(len(x)):
        if i > 0:
            x.remove(i)
        x.sort()
        x[::-1]
        return x[1]
        
def f3(a, b, c):
    x = a + b + c
    x = str(x)
    if x[0] == '-':
        return int(x[1])
    else:
        return int(x[0])
    y = int(y)
    return y

def f4(a, b, c):
    x = a + b + c
    x = abs(x)
    y = (x//1)%10
    return y
    
def main():
    [s1,s2,a,b,c] = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0: print(f1(a,b,c))
    if s1 == 0 and s2 == 1: print(f2(a,b,c))
    if s1 == 1 and s2 == 0: print(f3(a,b,c))
    if s1 == 1 and s2 == 1: print(f4(a,b,c))
    else: print("Error")
    


    
exec(input().strip()) # DON'T remove this line

# 1641593, 2022-09-24 10:25:25, x-PP[--][P-P-] (33%)

def f1(a, b, c):
    x = [a, b, c]
    y = []
    for i in x:
        if i > 0:
            y.append(i)
    y.sort()
    return int(y[1])
    
def f2(a, b, c):
    x = [a, b, c]
    y = []
    for i in x:
        if i < 0:
            y.append(i)
        y.sort()
    return x[1]
        
def f3(a, b, c):
    x = a + b + c
    x = str(x)
    if x[0] == '-':
        return int(x[1])
    else:
        return int(x[0])
    y = int(y)
    return y

def f4(a, b, c):
    x = a + b + c
    x = abs(x)
    y = (x//1)%10
    return y
    
def main():
    [s1,s2,a,b,c] = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0: print(f1(a,b,c))
    if s1 == 0 and s2 == 1: print(f2(a,b,c))
    if s1 == 1 and s2 == 0: print(f3(a,b,c))
    if s1 == 1 and s2 == 1: print(f4(a,b,c))
    else: print("Error")
    


    
exec(input().strip()) # DON'T remove this line

# 1641716, 2022-09-24 10:27:40, P-PP[--][P-P-] (50%)

def f1(a, b, c):
    x = [a, b, c]
    y = []
    for i in x:
        if i > 0:
            y.append(i)
    y.sort()
    return int(y[0])
    
def f2(a, b, c):
    x = [a, b, c]
    y = []
    for i in x:
        if i < 0:
            y.append(i)
        y.sort()
    return int(y[0])
        
def f3(a, b, c):
    x = a + b + c
    x = str(x)
    if x[0] == '-':
        return int(x[1])
    else:
        return int(x[0])
    y = int(y)
    return y

def f4(a, b, c):
    x = a + b + c
    x = abs(x)
    y = (x//1)%10
    return y
    
def main():
    [s1,s2,a,b,c] = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0: print(f1(a,b,c))
    if s1 == 0 and s2 == 1: print(f2(a,b,c))
    if s1 == 1 and s2 == 0: print(f3(a,b,c))
    if s1 == 1 and s2 == 1: print(f4(a,b,c))
    else: print("Error")
    


    
exec(input().strip()) # DON'T remove this line

# 1641779, 2022-09-24 10:28:52, PPPP[--][P-P-] (67%)

def f1(a, b, c):
    x = [a, b, c]
    y = []
    for i in x:
        if i > 0:
            y.append(i)
    y.sort()
    return int(y[0])
    
def f2(a, b, c):
    x = [a, b, c]
    y = []
    for i in x:
        if i < 0:
            y.append(i)
        y.sort()
    return int(y[-1])
        
def f3(a, b, c):
    x = a + b + c
    x = str(x)
    if x[0] == '-':
        return int(x[1])
    else:
        return int(x[0])
    y = int(y)
    return y

def f4(a, b, c):
    x = a + b + c
    x = abs(x)
    y = (x//1)%10
    return y
    
def main():
    [s1,s2,a,b,c] = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0: print(f1(a,b,c))
    if s1 == 0 and s2 == 1: print(f2(a,b,c))
    if s1 == 1 and s2 == 0: print(f3(a,b,c))
    if s1 == 1 and s2 == 1: print(f4(a,b,c))
    else: print("Error")
    


    
exec(input().strip()) # DON'T remove this line

# 1641852, 2022-09-24 10:29:59, PPPP[--][P-P-] (67%)

def f1(a, b, c):
    x = [a, b, c]
    y = []
    for i in x:
        if i > 0:
            y.append(i)
    y.sort()
    return int(y[0])
    
def f2(a, b, c):
    x = [a, b, c]
    y = []
    for i in x:
        if i < 0:
            y.append(i)
        y.sort()
    return int(y[-1])
        
def f3(a, b, c):
    x = a + b + c
    y = str(x)
    if y[0] == '-':
        return int(y[1])
    else:
        return int(y[0])
    return y

def f4(a, b, c):
    x = a + b + c
    x = abs(x)
    y = (x//1)%10
    return y
    
def main():
    [s1,s2,a,b,c] = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0: print(f1(a,b,c))
    if s1 == 0 and s2 == 1: print(f2(a,b,c))
    if s1 == 1 and s2 == 0: print(f3(a,b,c))
    if s1 == 1 and s2 == 1: print(f4(a,b,c))
    else: print("Error")
    


    
exec(input().strip()) # DON'T remove this line

# 1641977, 2022-09-24 10:32:12, PPPP[--][P-P-] (67%)

def f1(a, b, c):
    x = [a, b, c]
    y = []
    for i in x:
        if i > 0:
            y.append(i)
    y.sort()
    return int(y[0])
    
def f2(a, b, c):
    x = [a, b, c]
    y = []
    for i in x:
        if i < 0:
            y.append(i)
        y.sort()
    return int(y[-1])
        
def f3(a, b, c):
    x = a + b + c
    y = str(x)
    if y[0] == '-':
        return int(y[1])
    else:
        return int(y[0])

def f4(a, b, c):
    x = a + b + c
    x = abs(x)
    y = (x//1)%10
    return y
    
def main():
    [s1,s2,a,b,c] = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0: print(f1(a,b,c))
    if s1 == 0 and s2 == 1: print(f2(a,b,c))
    if s1 == 1 and s2 == 0: print(f3(a,b,c))
    if s1 == 1 and s2 == 1: print(f4(a,b,c))
    else: print("Error")
    


    
exec(input().strip()) # DON'T remove this line

# 1642046, 2022-09-24 10:33:33, PPPP[--][P-P-] (67%)

def f1(a, b, c):
    x = [a, b, c]
    y = []
    for i in x:
        if i > 0:
            y.append(i)
    y.sort()
    return int(y[0])
    
def f2(a, b, c):
    x = [a, b, c]
    y = []
    for i in x:
        if i < 0:
            y.append(i)
        y.sort()
    return int(y[-1])
        
def f3(a, b, c):
    x = a + b + c
    y = str(x)
    if y[0] == '-':
        return int(y[1])
    else:
        return int(y[0])

def f4(a, b, c):
    x = a + b + c
    x = abs(x)
    y = (x//1)%10
    return int(y)
    
def main():
    [s1,s2,a,b,c] = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0: print(f1(a,b,c))
    if s1 == 0 and s2 == 1: print(f2(a,b,c))
    if s1 == 1 and s2 == 0: print(f3(a,b,c))
    if s1 == 1 and s2 == 1: print(f4(a,b,c))
    else: print("Error")
    


    
exec(input().strip()) # DON'T remove this line


6230046221
# 1639436, 2022-09-24 09:30:24, ----[--][----] (0%)

def f1(a, b, c):

    z = []
    if a > 0 and b <= 0 and c <= 0:
        return a
    elif b > 0 and a <= 0 and c <= 0:
        return b
    elif c > 0 and b <= 0 and a <= 0:
        return c
    elif a > 0 and b > 0 and c <= 0:
        z.append(a)
        z.append(b)
        return min(z)
    elif a > 0 and c > 0 and b<= 0:
        z.append(a)
        z.append(c)
        return min(z)
    elif c > 0 and b > 0 and a<= 0:
        z.append(c)
        z.append(b)
        return min(z)

def f2(a, b, c):

    z = [a,b,c]
    z2 = []
    for i in z:
        if i < 0:
            z2.append(i)
    return max(z2)

def f3(a, b, c):
    z = a+b+c
    z = abs(z)
    return z[0]

def f4(a, b, c):

    z = a+b+c
    z = abs(z)
    return z[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 ==0:
        return print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        return print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        return print(f3(a,b,c))
    elif s1 == 1 and s1 == 1:
        return print(f4(a,b,c))
    else:
        return Error

# 1639540, 2022-09-24 09:32:49, ----[--][----] (0%)

def f1(a, b, c):

    z = []
    if a > 0 and b <= 0 and c <= 0:
        return a
    elif b > 0 and a <= 0 and c <= 0:
        return b
    elif c > 0 and b <= 0 and a <= 0:
        return c
    elif a > 0 and b > 0 and c <= 0:
        z.append(a)
        z.append(b)
        return min(z)
    elif a > 0 and c > 0 and b<= 0:
        z.append(a)
        z.append(c)
        return min(z)
    elif c > 0 and b > 0 and a<= 0:
        z.append(c)
        z.append(b)
        return min(z)

def f2(a, b, c):

    z = [a,b,c]
    z2 = []
    for i in z:
        if i < 0:
            z2.append(i)
    return max(z2)

def f3(a, b, c):
    z = a+b+c
    z = str(abs(z))
    return z[0]

def f4(a, b, c):

    z = a+b+c
    z = str(abs(z))
    return z[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 ==0:
        return f1(a,b,c)
    elif s1 == 0 and s2 == 1:
        return f2(a,b,c)
    elif s1 == 1 and s2 == 0:
        return f3(a,b,c)
    elif s1 == 1 and s2 == 1:
        return f4(a,b,c)
    else:
        return Error

# 1639641, 2022-09-24 09:35:28, ----[--][----] (0%)

def f1(a, b, c):

    z = []
    if a > 0 and b <= 0 and c <= 0:
        return a
    elif b > 0 and a <= 0 and c <= 0:
        return b
    elif c > 0 and b <= 0 and a <= 0:
        return c
    elif a > 0 and b > 0 and c <= 0:
        z.append(a)
        z.append(b)
        return min(z)
    elif a > 0 and c > 0 and b<= 0:
        z.append(a)
        z.append(c)
        return min(z)
    elif c > 0 and b > 0 and a<= 0:
        z.append(c)
        z.append(b)
        return min(z)

def f2(a, b, c):

    z = [a,b,c]
    z2 = []
    for i in z:
        if i < 0:
            z2.append(i)
    return max(z2)

def f3(a, b, c):
    z = a+b+c
    z = str(abs(z))
    return z[0]

def f4(a, b, c):

    z = a+b+c
    z = str(abs(z))
    return z[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 ==0:
        return int(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        return int(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        return int(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        return int(f4(a,b,c))
    else:
        return 'Error'

# 1639720, 2022-09-24 09:37:36, ----[--][----] (0%)

def f1(a, b, c):

    z = []
    if a > 0 and b <= 0 and c <= 0:
        return a
    elif b > 0 and a <= 0 and c <= 0:
        return b
    elif c > 0 and b <= 0 and a <= 0:
        return c
    elif a > 0 and b > 0 and c <= 0:
        z.append(a)
        z.append(b)
        return min(z)
    elif a > 0 and c > 0 and b<= 0:
        z.append(a)
        z.append(c)
        return min(z)
    elif c > 0 and b > 0 and a<= 0:
        z.append(c)
        z.append(b)
        return min(z)

def f2(a, b, c):

    z = [a,b,c]
    z2 = []
    for i in z:
        if i < 0:
            z2.append(i)
    return max(z2)

def f3(a, b, c):
    z = a+b+c
    z = str(abs(z))
    return z[0]

def f4(a, b, c):

    z = a+b+c
    z = str(abs(z))
    return z[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 ==0:
        return int(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        return int(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        return int(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        return int(f4(a,b,c))
    else:
        return 'Error'

# 1640506, 2022-09-24 09:59:26, ----[--][----] (0%)

def f1(a, b, c):

    z = []
    if a > 0 and b <= 0 and c <= 0:
        return a
    elif b > 0 and a <= 0 and c <= 0:
        return b
    elif c > 0 and b <= 0 and a <= 0:
        return c
    elif a > 0 and b > 0 and c <= 0:
        z.append(a)
        z.append(b)
        return min(z)
    elif a > 0 and c > 0 and b<= 0:
        z.append(a)
        z.append(c)
        return min(z)
    elif c > 0 and b > 0 and a<= 0:
        z.append(c)
        z.append(b)
        return min(z)

def f2(a, b, c):

    z = [a,b,c]
    z2 = []
    for i in z:
        if i < 0:
            z2.append(i)
    return max(z2)

def f3(a, b, c):
    z = a+b+c
    z = str(abs(z))
    return z[0]

def f4(a, b, c):

    z = a+b+c
    z = str(abs(z))
    return z[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 ==0:
        return int(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        return int(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        return int(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        return int(f4(a,b,c))
    else:
        return 'Error'

# 1640735, 2022-09-24 10:05:48, ----[--][----] (0%)

def f1(a, b, c):
    y = []
    if a > 0 and b <= 0 and c <= 0:
        return int(a)
    elif b > 0 and a <= 0 and c <= 0:
        return int(b)
    elif c > 0 and b <= 0 and a <= 0:
        return int(c)
    elif a > 0 and b > 0 and c <= 0:
        y.append(a)
        y.append(b)
        return min(z)
    elif a > 0 and c > 0 and b<= 0:
        y.append(a)
        y.append(c)
        return min(z)
    elif c > 0 and b > 0 and a<= 0:
        y.append(c)
        y.append(b)
        return min(z)

def f2(a, b, c):
    y2 = [a,b,c]
    z2 = []
    for i in y2:
        if i < 0:
            z2.append(i)
    return max(z2)

def f3(a, b, c):
    z3 = a+b+c
    z4 = str(abs(z3))
    return z4[0]

def f4(a, b, c):
    z5 = a+b+c
    z6 = str(abs(z5))
    return z6[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 ==0:
        return int(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        return int(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        return int(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        return int(f4(a,b,c))
    else:
        x = 'Error'
        return x

# 1640870, 2022-09-24 10:09:00, ----[--][----] (0%)

def f1(a, b, c):
    z = []
    if a > 0 and b <= 0 and c <= 0:
        return int(a)
    elif b > 0 and a <= 0 and c <= 0:
        return int(b)
    elif c > 0 and b <= 0 and a <= 0:
        return int(c)
    elif a > 0 and b > 0 and c <= 0:
        z.append(a)
        z.append(b)
        return min(z)
    elif a > 0 and c > 0 and b<= 0:
        z.append(a)
        z.append(c)
        return min(z)
    elif c > 0 and b > 0 and a<= 0:
        z.append(c)
        z.append(b)
        return min(z)

def f2(a, b, c):
    z = [a,b,c]
    z2 = []
    for i in z:
        if i < 0:
            z2.append(i)
    return max(z2)

def f3(a, b, c):
    z = a+b+c
    z = str(abs(z))
    return z[0]

def f4(a, b, c):
    z = a+b+c
    z = str(abs(z))
    return z[-1]
# 1640963, 2022-09-24 10:11:32, PP--[--][----] (33%)

def f1(a, b, c):
    y = []
    if a > 0 and b <= 0 and c <= 0:
        return int(a)
    elif b > 0 and a <= 0 and c <= 0:
        return int(b)
    elif c > 0 and b <= 0 and a <= 0:
        return int(c)
    elif a > 0 and b > 0 and c <= 0:
        y.append(a)
        y.append(b)
        return min(y)
    elif a > 0 and c > 0 and b<= 0:
        y.append(a)
        y.append(c)
        return min(y)
    elif c > 0 and b > 0 and a<= 0:
        y.append(c)
        y.append(b)
        return min(y)

def f2(a, b, c):
    y2 = [a,b,c]
    z2 = []
    for i in y2:
        if i < 0:
            z2.append(i)
    return max(z2)

def f3(a, b, c):
    z3 = a+b+c
    z4 = str(abs(z3))
    return z4[0]

def f4(a, b, c):
    z5 = a+b+c
    z6 = str(abs(z5))
    return z6[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 ==0:
        return int(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        return int(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        return int(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        return int(f4(a,b,c))
    else:
        x = 'Error'
        return x

exec(input().strip()) # DON'T remove this line

# 1641092, 2022-09-24 10:15:11, PP--[PP][-P-P] (50%)

def f1(a, b, c):
    y = []
    if a > 0 and b <= 0 and c <= 0:
        return int(a)
    elif b > 0 and a <= 0 and c <= 0:
        return int(b)
    elif c > 0 and b <= 0 and a <= 0:
        return int(c)
    elif a > 0 and b > 0 and c <= 0:
        y.append(a)
        y.append(b)
        return min(y)
    elif a > 0 and c > 0 and b<= 0:
        y.append(a)
        y.append(c)
        return min(y)
    elif c > 0 and b > 0 and a<= 0:
        y.append(c)
        y.append(b)
        return min(y)

def f2(a, b, c):
    y2 = [a,b,c]
    z2 = []
    for i in y2:
        if i < 0:
            z2.append(i)
    return max(z2)

def f3(a, b, c):
    z3 = a+b+c
    z4 = str(abs(z3))
    return z4[0]

def f4(a, b, c):
    z5 = a+b+c
    z6 = str(abs(z5))
    return z6[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 ==0:
        return print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        return print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        return print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        return print(f4(a,b,c))
    else:
        return 'Error'

exec(input().strip()) # DON'T remove this line

# 1641132, 2022-09-24 10:16:08, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    y = []
    if a > 0 and b <= 0 and c <= 0:
        return int(a)
    elif b > 0 and a <= 0 and c <= 0:
        return int(b)
    elif c > 0 and b <= 0 and a <= 0:
        return int(c)
    elif a > 0 and b > 0 and c <= 0:
        y.append(a)
        y.append(b)
        return min(y)
    elif a > 0 and c > 0 and b<= 0:
        y.append(a)
        y.append(c)
        return min(y)
    elif c > 0 and b > 0 and a<= 0:
        y.append(c)
        y.append(b)
        return min(y)

def f2(a, b, c):
    y2 = [a,b,c]
    z2 = []
    for i in y2:
        if i < 0:
            z2.append(i)
    return max(z2)

def f3(a, b, c):
    z3 = a+b+c
    z4 = str(abs(z3))
    return z4[0]

def f4(a, b, c):
    z5 = a+b+c
    z6 = str(abs(z5))
    return z6[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 ==0:
        return print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        return print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        return print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        return print(f4(a,b,c))
    else:
        x = 'Error'
        return print(x)

exec(input().strip()) # DON'T remove this line

# 1641223, 2022-09-24 10:18:01, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    y = []
    if a > 0 and b <= 0 and c <= 0:
        return int(a)
    elif b > 0 and a <= 0 and c <= 0:
        return int(b)
    elif c > 0 and b <= 0 and a <= 0:
        return int(c)
    elif a > 0 and b > 0 and c <= 0:
        y.append(a)
        y.append(b)
        return min(y)
    elif a > 0 and c > 0 and b<= 0:
        y.append(a)
        y.append(c)
        return min(y)
    elif c > 0 and b > 0 and a<= 0:
        y.append(c)
        y.append(b)
        return min(y)

def f2(a, b, c):
    y2 = [a,b,c]
    z2 = []
    for i in y2:
        if i < 0:
            z2.append(i)
    return max(z2)

def f3(a, b, c):
    z3 = a+b+c
    z4 = str(abs(z3))
    return z4[0]

def f4(a, b, c):
    z5 = a+b+c
    z6 = str(abs(z5))
    return z6[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 ==0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

exec(input().strip()) # DON'T remove this line

# 1641956, 2022-09-24 10:31:45, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    y = []
    if a > 0 and b <= 0 and c <= 0:
        return int(a)
    elif b > 0 and a <= 0 and c <= 0:
        return int(b)
    elif c > 0 and b <= 0 and a <= 0:
        return int(c)
    elif a >= 0 and b >= 0 and c < 0:
        y.append(a)
        y.append(b)
        return min(y)
    elif a >= 0 and c >= 0 and b< 0:
        y.append(a)
        y.append(c)
        return min(y)
    elif c >= 0 and b >= 0 and a< 0:
        y.append(c)
        y.append(b)
        return min(y)

def f2(a, b, c):
    y2 = [a,b,c]
    z2 = []
    for i in y2:
        if i < 0:
            z2.append(i)
    return max(z2)

def f3(a, b, c):
    z3 = a+b+c
    z4 = str(abs(z3))
    return z4[0]

def f4(a, b, c):
    z5 = a+b+c
    z6 = str(abs(z5))
    return z6[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 ==0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

exec(input().strip()) # DON'T remove this line

# 1642080, 2022-09-24 10:34:09, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    y = []
    if a > 0 and b <= 0 and c <= 0:
        return int(a)
    elif b > 0 and a <= 0 and c <= 0:
        return int(b)
    elif c > 0 and b <= 0 and a <= 0:
        return int(c)
    elif a >= 0 and b >= 0 and c < 0:
        y.append(a)
        y.append(b)
        if 0 in y :
            y.remove(0)
        return min(y)
    elif a >= 0 and c >= 0 and b< 0:
        y.append(a)
        y.append(c)
        if 0 in y :
            y.remove(0)
        return min(y)
    elif c >= 0 and b >= 0 and a< 0:
        y.append(c)
        y.append(b)
        if 0 in y :
            y.remove(0)
        return min(y)

def f2(a, b, c):
    y2 = [a,b,c]
    z2 = []
    for i in y2:
        if i < 0:
            z2.append(i)
    return max(z2)

def f3(a, b, c):
    z3 = a+b+c
    z4 = str(abs(z3))
    return z4[0]

def f4(a, b, c):
    z5 = a+b+c
    z6 = str(abs(z5))
    return z6[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 ==0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

exec(input().strip()) # DON'T remove this line

# 1642171, 2022-09-24 10:35:22, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    y = []
    if a > 0 and b <= 0 and c <= 0:
        return int(a)
    elif b > 0 and a <= 0 and c <= 0:
        return int(b)
    elif c > 0 and b <= 0 and a <= 0:
        return int(c)
    elif a >= 0 and b >= 0 and c < 0:
        y.append(a)
        y.append(b)
        if 0 in y :
            y.remove(0)
        return min(y)
    elif a >= 0 and c >= 0 and b< 0:
        y.append(a)
        y.append(c)
        if 0 in y :
            y.remove(0)
        return min(y)
    elif c >= 0 and b >= 0 and a< 0:
        y.append(c)
        y.append(b)
        if 0 in y :
            y.remove(0)
        return min(y)

def f2(a, b, c):
    y2 = [a,b,c]
    z2 = []
    for i in y2:
        if i < 0:
            z2.append(i)
    if 0 in z2 :
            z2.remove(0)
    return max(z2)

def f3(a, b, c):
    z3 = a+b+c
    z4 = str(abs(z3))
    return z4[0]

def f4(a, b, c):
    z5 = a+b+c
    z6 = str(abs(z5))
    return z6[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 ==0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

exec(input().strip()) # DON'T remove this line


6431804021
# 1639485, 2022-09-24 09:31:31, xxxx[xx][xxxx] (0%)

def f1(a, b, c):
    x = []
    if a > 0 :
        x.append(a)
    if b > 0 :
        x.append(b)
    if c > 0 :
        x.append(c)
    return min(x)
    
def f2(a, b, c):
    x = []
    if a < 0 :
        x.append(a)
    if b < 0 :
        x.append(b)
    if c < 0 :
        x.append(c)
    return max(x)
    
def f3(a, b, c):
    if (str(a+b+c))[0] == '-' :
        return (str(a+b+c))[1]
    else :
        return (str(a+b+c))[0]
    
def f4(a, b, c):
    return (str(a+b+c))[-1]
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print("Error")
#exec(input().strip())
main()
# 1639497, 2022-09-24 09:31:41, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x = []
    if a > 0 :
        x.append(a)
    if b > 0 :
        x.append(b)
    if c > 0 :
        x.append(c)
    return min(x)
    
def f2(a, b, c):
    x = []
    if a < 0 :
        x.append(a)
    if b < 0 :
        x.append(b)
    if c < 0 :
        x.append(c)
    return max(x)
    
def f3(a, b, c):
    if (str(a+b+c))[0] == '-' :
        return (str(a+b+c))[1]
    else :
        return (str(a+b+c))[0]
    
def f4(a, b, c):
    return (str(a+b+c))[-1]
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print("Error")
exec(input().strip())
# 1640830, 2022-09-24 10:08:05, compilation error (0%)

def f1(a, b, c):
    x = []
    if a > 0 :
        x.append(a)
    if b > 0 :
        x.append(b)
    if c > 0 :
        x.append(c)
    return min(x)
    
def f2(a, b, c):
    x = []
    if a =< 0 :
        x.append(a)
    if b =< 0 :
        x.append(b)
    if c =< 0 :
        x.append(c)
    return max(x)
    
def f3(a, b, c):
    if (str(a+b+c))[0] == '-' :
        return (str(a+b+c))[1]
    else :
        return (str(a+b+c))[0]
    
def f4(a, b, c):
    return (str(a+b+c))[-1]
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print("Error")
exec(input().strip())
# 1640847, 2022-09-24 10:08:26, P---[PP][PPPP] (50%)

def f1(a, b, c):
    x = []
    if a > 0 :
        x.append(a)
    if b > 0 :
        x.append(b)
    if c > 0 :
        x.append(c)
    return min(x)
    
def f2(a, b, c):
    x = []
    if a <= 0 :
        x.append(a)
    if b <= 0 :
        x.append(b)
    if c <= 0 :
        x.append(c)
    return max(x)
    
def f3(a, b, c):
    if (str(a+b+c))[0] == '-' :
        return (str(a+b+c))[1]
    else :
        return (str(a+b+c))[0]
    
def f4(a, b, c):
    return (str(a+b+c))[-1]
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print("Error")
exec(input().strip())
# 1640863, 2022-09-24 10:08:53, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x = []
    if a > 0 :
        x.append(a)
    if b > 0 :
        x.append(b)
    if c > 0 :
        x.append(c)
    return min(x)
    
def f2(a, b, c):
    x = []
    if a < 0 :
        x.append(a)
    if b < 0 :
        x.append(b)
    if c < 0 :
        x.append(c)
    return max(x)
    
def f3(a, b, c):
    if (str(a+b+c))[0] == '-' :
        return (str(a+b+c))[1]
    else :
        return (str(a+b+c))[0]
    
def f4(a, b, c):
    return (str(a+b+c))[-1]
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print("Error")
exec(input().strip())
# 1640917, 2022-09-24 10:10:21, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x = []
    if a > 0 :
        x.append(a)
    if b > 0 :
        x.append(b)
    if c > 0 :
        x.append(c)
    return min(x)
    
def f2(a, b, c):
    x = []
    if a < 0 :
        x.append(a)
    if b < 0 :
        x.append(b)
    if c < 0 :
        x.append(c)
    return max(x)
    
def f3(a, b, c):
    if (str(a+b+c))[0] == '-' :
        return (str(a+b+c))[1]
    else :
        return (str(a+b+c))[0]
    
def f4(a, b, c):
    return (str(a+b-c))[-1]
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print("Error")
exec(input().strip())
# 1640984, 2022-09-24 10:12:10, PP--[PP][PPP-] (50%)

def f1(a, b, c):
    x = []
    if a > 0 :
        x.append(a)
    if b > 0 :
        x.append(b)
    if c > 0 :
        x.append(c)
    return min(x)
    
def f2(a, b, c):
    x = []
    if a < 0 :
        x.append(a)
    if b < 0 :
        x.append(b)
    if c < 0 :
        x.append(c)
    return max(x)
    
def f3(a, b, c):
    if (str(a+b+c))[0] == '-' :
        return (str(a+b+c))[0]
    else :
        return (str(a+b+c))[0]
    
def f4(a, b, c):
    return (str(a+b+c))[-1]
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print("Error")
exec(input().strip())
# 1640997, 2022-09-24 10:12:34, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x = []
    if a > 0 :
        x.append(a)
    if b > 0 :
        x.append(b)
    if c > 0 :
        x.append(c)
    return min(x)
    
def f2(a, b, c):
    x = []
    if a < 0 :
        x.append(a)
    if b < 0 :
        x.append(b)
    if c < 0 :
        x.append(c)
    return max(x)
    
def f3(a, b, c):
    if (str(a+b+c))[0] == '-' :
        return (str(a+b+c))[1]
    else :
        return (str(a+b+c))[0]
    
def f4(a, b, c):
    return (str(a+b+c))[-1]
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print("Error")
exec(input().strip())
# 1641662, 2022-09-24 10:26:28, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x = []
    if a > 0 :
        x.append(a)
    if b > 0 :
        x.append(b)
    if c > 0 :
        x.append(c)
    return min(x)
    
def f2(a, b, c):
    x = []
    if a < 0 :
        x.append(a)
    if b < 0 :
        x.append(b)
    if c < 0 :
        x.append(c)
    return max(x)
    
def f3(a, b, c):
    if (str(a+b+c))[0] == '-' :
        return (str(a+b+c))[1]
    else :
        return (str(a+b+c))[0]
    
def f4(a, b, c):
    return (str(a+b+c))[0]
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print("Error")
exec(input().strip())
# 1641680, 2022-09-24 10:26:55, PP-x[PP][PPPP] (67%)

def f1(a, b, c):
    x = []
    if a > 0 :
        x.append(a)
    if b > 0 :
        x.append(b)
    if c > 0 :
        x.append(c)
    return min(x)
    
def f2(a, b, c):
    x = []
    if a < 0 :
        x.append(a)
    if b < 0 :
        x.append(b)
    if c < 0 :
        x.append(c)
    return max(x)
    
def f3(a, b, c):
    if (str(a+b+c))[0] == '-' :
        return (str(a+b+c))[1]
    else :
        return (str(a+b+c))[0]
    
def f4(a, b, c):
    z = a+b+c
    return z[-1]
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print("Error")
exec(input().strip())
# 1641747, 2022-09-24 10:28:13, PP-x[PP][PPPP] (67%)

def f1(a, b, c):
    x = []
    if a > 0 :
        x.append(a)
    if b > 0 :
        x.append(b)
    if c > 0 :
        x.append(c)
    return min(x)
    
def f2(a, b, c):
    x = []
    if a < 0 :
        x.append(a)
    if b < 0 :
        x.append(b)
    if c < 0 :
        x.append(c)
    return max(x)
    
def f3(a, b, c):
    if (str(a+b+c))[0] == '-' :
        return (str(a+b+c))[1]
    else :
        return (str(a+b+c))[0]
    
def f4(a, b, c):
    z = -(a+b+c)
    return z[-1]
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print("Error")
exec(input().strip())
# 1641781, 2022-09-24 10:28:53, PP-x[PP][PPPP] (67%)

def f1(a, b, c):
    x = []
    if a > 0 :
        x.append(a)
    if b > 0 :
        x.append(b)
    if c > 0 :
        x.append(c)
    return min(x)
    
def f2(a, b, c):
    x = []
    if a < 0 :
        x.append(a)
    if b < 0 :
        x.append(b)
    if c < 0 :
        x.append(c)
    return max(x)
    
def f3(a, b, c):
    if (str(a+b+c))[0] == '-' :
        return (str(a+b+c))[1]
    else :
        return (str(a+b+c))[0]
    
def f4(a, b, c):
    return (a+b+c)[-1]
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print("Error")
exec(input().strip())
# 1641821, 2022-09-24 10:29:33, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x = []
    if a > 0 :
        x.append(a)
    if b > 0 :
        x.append(b)
    if c > 0 :
        x.append(c)
    return min(x)
    
def f2(a, b, c):
    x = []
    if a < 0 :
        x.append(a)
    if b < 0 :
        x.append(b)
    if c < 0 :
        x.append(c)
    return max(x)
    
def f3(a, b, c):
    if (str(a+b+c))[0] == '-' :
        return (str(a+b+c))[1]
    else :
        return (str(a+b+c))[0]
    
def f4(a, b, c):
    return str((a+b+c))[-1]
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print("Error")
exec(input().strip())
# 1641890, 2022-09-24 10:30:34, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x = []
    if a > 0 :
        x.append(a)
    if b > 0 :
        x.append(b)
    if c > 0 :
        x.append(c)
    return min(x)
    
def f2(a, b, c):
    x = []
    if a < 0 :
        x.append(a)
    if b < 0 :
        x.append(b)
    if c < 0 :
        x.append(c)
    return max(x)
    
def f3(a, b, c):
    if (str(a+b+c))[0] == '-' :
        return (str(a+b+c))[1]
    else :
        return (str(a+b+c))[0]
    
def f4(a, b, c):
    return str((a+b+c))[-1]
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print("Error")
        
exec(input().strip())

6530146621
# 1639765, 2022-09-24 09:38:49, PP--[PP][PPPP] (67%)

def f1(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่าน้อยท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    a = int(a)
    b = int(b)
    c = int(c)
    p = []
    if a>0:
        p.append(a)
    if b>0:
        p.append(b)
    if c>0:
        p.append(c)
    return min(p)
def f2(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    a = int(a)
    b = int(b)
    c = int(c)
    p = []
    if a<0:
        p.append(a)
    if b<0:
        p.append(b)
    if c<0:
        p.append(c)
    return max(p)
def f3(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเคร่ืองหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, bและ c
    
    a = int(a)
    b = int(b)
    c = int(c)
    x = a+b+c
    x = str(x)
    if int(x)<0:
        return x[1]
    else:
        return x[0]
    
def f4(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    a = int(a)
    b = int(b)
    c = int(c)
    x = a+b+c
    x = str(x)
    if int(x)<0:
        return x[-1]
    else:
        return x[-2]
def main():
# รับข้อมูลจากคีย์บอร์ดเป็นจํานวนเต็ม 5 จํานวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกําหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c) # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c) # ถ้าs1 หรือs2 เป็นค่าอ่ืนให้แสดงคําว่าError
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 ==1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line
# 1639778, 2022-09-24 09:39:06, PP--[PP][PPPP] (67%)

def f1(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่าน้อยท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    a = int(a)
    b = int(b)
    c = int(c)
    p = []
    if a>0:
        p.append(a)
    if b>0:
        p.append(b)
    if c>0:
        p.append(c)
    return min(p)
def f2(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    a = int(a)
    b = int(b)
    c = int(c)
    p = []
    if a<0:
        p.append(a)
    if b<0:
        p.append(b)
    if c<0:
        p.append(c)
    return max(p)
def f3(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเคร่ืองหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, bและ c
    
    a = int(a)
    b = int(b)
    c = int(c)
    x = a+b+c
    x = str(x)
    if int(x)<0:
        return x[1]
    else:
        return x[0]
    
def f4(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    a = int(a)
    b = int(b)
    c = int(c)
    x = a+b+c
    x = str(x)
    if int(x)<0:
        return x[-1]
    else:
        return x[-2]
def main():
# รับข้อมูลจากคีย์บอร์ดเป็นจํานวนเต็ม 5 จํานวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกําหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c) # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c) # ถ้าs1 หรือs2 เป็นค่าอ่ืนให้แสดงคําว่าError
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 ==1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line
# 1639975, 2022-09-24 09:44:23, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    p = []
    if a>0:
        p.append(a)
    if b>0:
        p.append(b)
    if c>0:
        p.append(c)
    return min(p)

def f2(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    p = []
    if a<0:
        p.append(a)
    if b<0:
        p.append(b)
    if c<0:
        p.append(c)
    return max(p)

def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    x = a+b+c
    x = str(x)
    if int(x)<0:
        return x[1]
    else:
        return x[0]
    
def f4(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    x = a+b+c
    x = str(x)
    if int(x)<0:
        return x[-1]
    else:
        return x[-2]
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 ==1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip()) # DON'T remove this line
# 1640298, 2022-09-24 09:53:33, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    p = []
    if a>0:
        p.append(a)
    if b>0:
        p.append(b)
    if c>0:
        p.append(c)
    return min(p)

def f2(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    p = []
    if a<0:
        p.append(a)
    if b<0:
        p.append(b)
    if c<0:
        p.append(c)
    return max(p)

def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    x = a+b+c
    x = str(x)
    if int(x)<0:
        return x[1]
    else:
        return x[0]
    
def f4(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    x = a+b+c
    x = str(x)
    if int(x)<0:
        return x[-1]
    
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 ==1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip()) # DON'T remove this line
# 1640461, 2022-09-24 09:58:35, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    p = []
    if a>0:
        p.append(a)
    if b>0:
        p.append(b)
    if c>0:
        p.append(c)
    return min(p)

def f2(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    p = []
    if a<0:
        p.append(a)
    if b<0:
        p.append(b)
    if c<0:
        p.append(c)
    return max(p)

def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    x = a+b+c
    x = str(x)
    if int(x)<0:
        return x[1]
    else:
        return x[0]
    
def f4(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    x = a+b+c
    x = str(x)
    return x[-1]
    
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 ==1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip()) # DON'T remove this line
# 1640586, 2022-09-24 10:01:53, ----[--][PPPP] (17%)

def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    p = []
    if a>0:
        p.append(a)
    elif b>0:
        p.append(b)
    elif c>0:
        p.append(c)
    return min(p)

def f2(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    p = []
    if a<0:
        p.append(a)
    elif b<0:
        p.append(b)
    elif c<0:
        p.append(c)
    return max(p)

def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    x = a+b+c
    x = str(x)
    if int(x)<0:
        return x[1]
    else:
        return x[0]
    
def f4(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    x = a+b+c
    x = str(x)
    return x[-1]
    
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 ==1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip()) # DON'T remove this line
# 1640613, 2022-09-24 10:02:32, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    p = []
    if a>0:
        p.append(a)
    if b>0:
        p.append(b)
    if c>0:
        p.append(c)
    return min(p)

def f2(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    p = []
    if a<0:
        p.append(a)
    if b<0:
        p.append(b)
    if c<0:
        p.append(c)
    return max(p)

def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    x = a+b+c
    x = str(x)
    if int(x)<0:
        return x[1]
    else:
        return x[0]
    
def f4(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    x = a+b+c
    x = str(x)
    return x[-1]
    
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 ==1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip()) # DON'T remove this line
# 1640652, 2022-09-24 10:03:43, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    d = []
    if a>0:
        d.append(a)
    if b>0:
        d.append(b)
    if c>0:
        d.append(c)
    return min(d)

def f2(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    d = []
    if a<0:
        d.append(a)
    if b<0:
        d.append(b)
    if c<0:
        d.append(c)
    return max(d)

def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    x = a+b+c
    x = str(x)
    if int(x)<0:
        return x[1]
    else:
        return x[0]
    
def f4(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    x = a+b+c
    x = str(x)
    return x[-1]
    
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 ==1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip()) # DON'T remove this line
# 1640704, 2022-09-24 10:05:01, PP--[--][P-P-] (33%)

def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    d = []
    if a>0:
        d.append(a)
    if b>0:
        d.append(b)
    if c>0:
        d.append(c)
    return min(d)

def f2(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    d = []
    if a<0:
        d.append(a)
    if b<0:
        d.append(b)
    if c<0:
        d.append(c)
    return max(d)

def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    x = a+b+c
    x = str(x)
    if int(x)<0:
        return x[1]
    else:
        return x[0]
    
def f4(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    x = a+b+c
    x = str(x)
    return x[-1]
    
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 ==1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip()) # DON'T remove this line
# 1640716, 2022-09-24 10:05:19, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    d = []
    if a>0:
        d.append(a)
    if b>0:
        d.append(b)
    if c>0:
        d.append(c)
    return min(d)

def f2(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    d = []
    if a<0:
        d.append(a)
    if b<0:
        d.append(b)
    if c<0:
        d.append(c)
    return max(d)

def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    x = a+b+c
    x = str(x)
    if int(x)<0:
        return x[1]
    else:
        return x[0]
    
def f4(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    x = a+b+c
    x = str(x)
    return x[-1]
    
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 ==1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip()) # DON'T remove this line
# 1640777, 2022-09-24 10:06:39, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    d = []
    if a>0:
        d.append(a)
    if b>0:
        d.append(b)
    if c>0:
        d.append(c)
    return min(d)

def f2(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    d = []
    if a<0:
        d.append(a)
    if b<0:
        d.append(b)
    if c<0:
        d.append(c)
    return max(d)

def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    x = a+b+c
    x = str(x)
    if int(x)<0:
        return x[1]
    else:
        return x[0]
    
def f4(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    x = a+b+c
    x = str(x)
    return x[-1]
    
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 ==1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip()) # DON'T remove this line
# 1641265, 2022-09-24 10:18:54, xxxx[xx][xxxx] (0%)

a = -1000<=a<=1000
def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    d = []
    if a>0:
        d.append(a)
    if b>0:
        d.append(b)
    if c>0:
        d.append(c)
    return min(d)

def f2(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    d = []
    if a<0:
        d.append(a)
    if b<0:
        d.append(b)
    if c<0:
        d.append(c)
    return max(d)

def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    x = a+b+c
    x = str(x)
    if int(x)<0:
        return x[1]
    else:
        return x[0]
    
def f4(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    x = a+b+c
    x = str(x)
    return x[-1]
    
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 ==1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip()) # DON'T remove this line
# 1641282, 2022-09-24 10:19:11, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    d = []
    if a>0:
        d.append(a)
    if b>0:
        d.append(b)
    if c>0:
        d.append(c)
    return min(d)

def f2(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    d = []
    if a<0:
        d.append(a)
    if b<0:
        d.append(b)
    if c<0:
        d.append(c)
    return max(d)

def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    x = a+b+c
    x = str(x)
    if int(x)<0:
        return x[1]
    else:
        return x[0]
    
def f4(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    x = a+b+c
    x = str(x)
    return x[-1]
    
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 ==1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip()) # DON'T remove this line
# 1641864, 2022-09-24 10:30:09, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    d = []
    if a>0:
        d.append(a)
    if b>0:
        d.append(b)
    if c>0:
        d.append(c)
    return min(d)

def f2(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    d = []
    if a<0:
        d.append(a)
    if b<0:
        d.append(b)
    if c<0:
        d.append(c)
    return max(d)

def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    x = a+b+c
    x = str(x)
    if int(x)<0:
        return x[1]
    else:
        return x[0]
    
def f4(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    x = a+b+c
    x = str(x)
    return x[-1:]
    
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 ==1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip()) # DON'T remove this line

6530031021
# 1640395, 2022-09-24 09:56:43, PP-P[xx][PxPx] (50%)

def f1(a,b,c) :
    l = [a,b,c]
    l.sort()
    for i in range(len(l)) :
        if l[i] > 0 :
            return(l[i])
            break

def f2(a,b,c) :
    l = [a,b,c]
    l.sort()
    for i in range(len(l)) :
        if l[i+1] >= 0 :
            return(l[i])
            break

def f3(a,b,c) :
    l = str(abs(a+b+c))
    return(l[0])

def f4(a,b,c) :
    l = abs(a+b+c)
    return(l%10)

def main() :
    x = input().split()
    if int(x[0]) == 0 and int(x[1]) == 0 :
        print(f1(x[2],x[3],x[4]))
    if int(x[0]) == 0 and int(x[1]) == 1 :
        print(f2(x[2],x[3],x[4]))
    if int(x[0]) == 1 and int(x[1]) == 0 :
        print(f3(x[2],x[3],x[4]))
    if int(x[0]) == 1 and int(x[1]) == 1 :
        print(f4(x[2],x[3],x[4]))
    if int(x[0]) != 1 or int(x[0]) != 0 or int(x[1]) != 1 or int(x[1]) != 0 :
        print("Error")
    
exec(input().strip())
# 1640737, 2022-09-24 10:05:51, ----[--][----] (0%)

def f1(a,b,c) :
    l = [a,b,c]
    l.sort()
    for i in range(len(l)) :
        if l[i] > 0 :
            return(l[i])
            break

def f2(a,b,c) :
    l = [a,b,c]
    l.sort()
    for i in range(len(l)) :
        if l[i+1] >= 0 :
            return(l[i])
            break

def f3(a,b,c) :
    l = abs(a+b+c)
    return(l//(10**(len(str(l))-1)))

def f4(a,b,c) :
    l = abs(a+b+c)
    return(l%10)

def main() :
    x = input().split()
    if int(x[0]) == 0 and int(x[1]) == 0 :
        print(f1(x[2],x[3],x[4]))
    if int(x[0]) == 0 and int(x[1]) == 1 :
        print(f2(x[2],x[3],x[4]))
    if int(x[0]) == 1 and int(x[1]) == 0 :
        print(f3(x[2],x[3],x[4]))
    if int(x[0]) == 1 and int(x[1]) == 1 :
        print(f4(x[2],x[3],x[4]))
    if int(x[0]) != 1 or int(x[0]) != 0 or int(x[1]) != 1 or int(x[1]) != 0 :
        print("Error")
# 1640760, 2022-09-24 10:06:20, PPPP[xx][PxPx] (67%)

def f1(a,b,c) :
    l = [a,b,c]
    l.sort()
    for i in range(len(l)) :
        if l[i] > 0 :
            return(l[i])
            break

def f2(a,b,c) :
    l = [a,b,c]
    l.sort()
    for i in range(len(l)) :
        if l[i+1] >= 0 :
            return(l[i])
            break

def f3(a,b,c) :
    l = abs(a+b+c)
    return(l//(10**(len(str(l))-1)))

def f4(a,b,c) :
    l = abs(a+b+c)
    return(l%10)

def main() :
    x = input().split()
    if int(x[0]) == 0 and int(x[1]) == 0 :
        print(f1(x[2],x[3],x[4]))
    if int(x[0]) == 0 and int(x[1]) == 1 :
        print(f2(x[2],x[3],x[4]))
    if int(x[0]) == 1 and int(x[1]) == 0 :
        print(f3(x[2],x[3],x[4]))
    if int(x[0]) == 1 and int(x[1]) == 1 :
        print(f4(x[2],x[3],x[4]))
    if int(x[0]) != 1 or int(x[0]) != 0 or int(x[1]) != 1 or int(x[1]) != 0 :
        print("Error")
        
exec(input().strip())
# 1640791, 2022-09-24 10:07:10, PPPP[xx][-x-x] (67%)

def f1(a,b,c) :
    l = [a,b,c]
    l.sort()
    for i in range(len(l)) :
        if l[i] > 0 :
            return(l[i])
            break

def f2(a,b,c) :
    l = [a,b,c]
    l.sort()
    for i in range(len(l)) :
        if l[i+1] >= 0 :
            return(l[i])
            break

def f3(a,b,c) :
    l = abs(a+b+c)
    return(l//(10**(len(str(l))-1)))

def f4(a,b,c) :
    l = abs(a+b+c)
    return(l%10)

def main() :
    x = input().split()
    if int(x[0]) == 0 and int(x[1]) == 0 :
        return(f1(x[2],x[3],x[4]))
    if int(x[0]) == 0 and int(x[1]) == 1 :
        return(f2(x[2],x[3],x[4]))
    if int(x[0]) == 1 and int(x[1]) == 0 :
        return(f3(x[2],x[3],x[4]))
    if int(x[0]) == 1 and int(x[1]) == 1 :
        return(f4(x[2],x[3],x[4]))
    if int(x[0]) != 1 or int(x[0]) != 0 or int(x[1]) != 1 or int(x[1]) != 0 :
        return("Error")
    
exec(input().strip())
# 1640926, 2022-09-24 10:10:33, xxxx[xx][xxxx] (0%)

def f1(a,b,c) :
    l = [a,b,c]
    l.sort()
    for i in range(len(l)) :
        if l[i] > 0 :
            return(l[i])
            break

def f2(a,b,c) :
    l = [a,b,c]
    l.sort()
    for i in range(len(l)) :
        if l[i+1] >= 0 :
            return(l[i])
            break

def f3(a,b,c) :
    l = abs(a+b+c)
    return(l//(10**(len(str(l))-1)))

def f4(a,b,c) :
    l = abs(a+b+c)
    return(l%10)

def main() :
    s1,s2,a,b,c = input().split()
    if int(s1) == 0 and int(s2) == 0 :
        return(f1(a,b,c))
    if int(s1) == 0 and int(s2) == 1 :
        return(f2(a,b,c))
    if int(s1) == 1 and int(s2) == 0 :
        return(f3(a,b,c))
    if int(s1) == 1 and int(s2) == 1 :
        return(f4(a,b,c))
    if int(s1) != 1 or int(s1) != 0 or int(s2) != 1 or int(s2) != 0 :
        return("Error")
    
exec(input().strip())
    
exec(input().strip())
# 1640940, 2022-09-24 10:10:50, PPPP[xx][-x-x] (67%)

def f1(a,b,c) :
    l = [a,b,c]
    l.sort()
    for i in range(len(l)) :
        if l[i] > 0 :
            return(l[i])
            break

def f2(a,b,c) :
    l = [a,b,c]
    l.sort()
    for i in range(len(l)) :
        if l[i+1] >= 0 :
            return(l[i])
            break

def f3(a,b,c) :
    l = abs(a+b+c)
    return(l//(10**(len(str(l))-1)))

def f4(a,b,c) :
    l = abs(a+b+c)
    return(l%10)

def main() :
    s1,s2,a,b,c = input().split()
    if int(s1) == 0 and int(s2) == 0 :
        return(f1(a,b,c))
    if int(s1) == 0 and int(s2) == 1 :
        return(f2(a,b,c))
    if int(s1) == 1 and int(s2) == 0 :
        return(f3(a,b,c))
    if int(s1) == 1 and int(s2) == 1 :
        return(f4(a,b,c))
    if int(s1) != 1 or int(s1) != 0 or int(s2) != 1 or int(s2) != 0 :
        return("Error")
    
exec(input().strip())
    
# 1640994, 2022-09-24 10:12:28, PPPP[--][----] (67%)

def f1(a,b,c) :
    l = [a,b,c]
    l.sort()
    for i in range(len(l)) :
        if l[i] > 0 :
            return(l[i])
            break

def f2(a,b,c) :
    l = [a,b,c]
    l.sort()
    for i in range(len(l)) :
        if l[i+1] >= 0 :
            return(l[i])
            break

def f3(a,b,c) :
    l = abs(a+b+c)
    return(l//(10**(len(str(l))-1)))

def f4(a,b,c) :
    l = abs(a+b+c)
    return(l%10)

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if int(s1) == 0 and int(s2) == 0 :
        return(f1(a,b,c))
    if int(s1) == 0 and int(s2) == 1 :
        return(f2(a,b,c))
    if int(s1) == 1 and int(s2) == 0 :
        return(f3(a,b,c))
    if int(s1) == 1 and int(s2) == 1 :
        return(f4(a,b,c))
    if int(s1) != 1 or int(s1) != 0 or int(s2) != 1 or int(s2) != 0 :
        return("Error")
    
exec(input().strip())
# 1641029, 2022-09-24 10:13:11, compilation error (0%)

def f1(a,b,c) :
    l = [a,b,c]
    l.sort()
    for i in range(len(l)) :
        if l[i] > 0 :
            return(l[i])
            break

def f2(a,b,c) :
    l = [a,b,c]
    l.sort()
    for i in range(len(l)) :
        if l[i+1] >= 0 :
            return(l[i])
            break

def f3(a,b,c) :
    l = abs(a+b+c)
    return(l//(10**(len(str(l))-1)))

def f4(a,b,c) :
    l = abs(a+b+c)
    return(l%10)

def main() :
    s1,s2,a,b,c = int(e) for e in input().split()
    if int(s1) == 0 and int(s2) == 0 :
        return(f1(a,b,c))
    if int(s1) == 0 and int(s2) == 1 :
        return(f2(a,b,c))
    if int(s1) == 1 and int(s2) == 0 :
        return(f3(a,b,c))
    if int(s1) == 1 and int(s2) == 1 :
        return(f4(a,b,c))
    if int(s1) != 1 or int(s1) != 0 or int(s2) != 1 or int(s2) != 0 :
        return("Error")
    
exec(input().strip())
# 1641034, 2022-09-24 10:13:24, PPPP[--][----] (67%)

def f1(a,b,c) :
    l = [a,b,c]
    l.sort()
    for i in range(len(l)) :
        if l[i] > 0 :
            return(l[i])
            break

def f2(a,b,c) :
    l = [a,b,c]
    l.sort()
    for i in range(len(l)) :
        if l[i+1] >= 0 :
            return(l[i])
            break

def f3(a,b,c) :
    l = abs(a+b+c)
    return(l//(10**(len(str(l))-1)))

def f4(a,b,c) :
    l = abs(a+b+c)
    return(l%10)

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if int(s1) == 0 and int(s2) == 0 :
        return(f1(a,b,c))
    if int(s1) == 0 and int(s2) == 1 :
        return(f2(a,b,c))
    if int(s1) == 1 and int(s2) == 0 :
        return(f3(a,b,c))
    if int(s1) == 1 and int(s2) == 1 :
        return(f4(a,b,c))
    if int(s1) != 1 or int(s1) != 0 or int(s2) != 1 or int(s2) != 0 :
        return("Error")
    
exec(input().strip())
# 1641133, 2022-09-24 10:16:08, ----[--][----] (0%)

def f1(a,b,c) :
    l = [a,b,c]
    l.sort()
    for i in range(len(l)) :
        if l[i] > 0 :
            return(l[i])
            break

def f2(a,b,c) :
    l = [a,b,c]
    l.sort()
    for i in range(len(l)) :
        if l[i+1] >= 0 :
            return(l[i])
            break

def f3(a,b,c) :
    l = abs(a+b+c)
    return(l//(10**(len(str(l))-1)))

def f4(a,b,c) :
    l = abs(a+b+c)
    return(l%10)

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        return(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        return(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        return(f3(a,b,c))
    if s1 == 1 and s2 == 1 :
        return(f4(a,b,c))
    if s1 != 1 or s1 != 0 or s2 != 1 or s2 != 0 :
        return("Error")
# 1641184, 2022-09-24 10:17:14, PPPP[--][----] (67%)

def f1(a,b,c) :
    l = [a,b,c]
    l.sort()
    for i in range(len(l)) :
        if l[i] > 0 :
            return(l[i])
            break

def f2(a,b,c) :
    l = [a,b,c]
    l.sort()
    for i in range(len(l)) :
        if l[i+1] >= 0 :
            return(l[i])
            break

def f3(a,b,c) :
    l = abs(a+b+c)
    return(l//(10**(len(str(l))-1)))

def f4(a,b,c) :
    l = abs(a+b+c)
    return(l%10)

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        return(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        return(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        return(f3(a,b,c))
    if s1 == 1 and s2 == 1 :
        return(f4(a,b,c))
    if s1 != 1 or s1 != 0 or s2 != 1 or s2 != 0 :
        return("Error")
        
exec(input().strip())
# 1641562, 2022-09-24 10:24:45, PPPP[--][P-P-] (67%)

def f1(a,b,c) :
    l = [a,b,c]
    l.sort()
    for i in range(len(l)) :
        if l[i] > 0 :
            return(l[i])
            break

def f2(a,b,c) :
    l = [a,b,c]
    l.sort()
    for i in range(len(l)) :
        if l[i+1] >= 0 :
            return(l[i])
            break

def f3(a,b,c) :
    l = abs(a+b+c)
    return(l//(10**(len(str(l))-1)))

def f4(a,b,c) :
    l = abs(a+b+c)
    return(l%10)

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    if s1 != 1 or s1 != 0 or s2 != 1 or s2 != 0 :
        print("Error")
        
exec(input().strip())
# 1641873, 2022-09-24 10:30:19, PPPP[--][P-P-] (67%)

def f1(a,b,c) :
    l = [a,b,c]
    l.sort()
    for i in range(len(l)) :
        if l[i] > 0 :
            return(l[i])
            break

def f2(a,b,c) :
    l = [a,b,c]
    l.sort()
    for i in range(len(l)) :
        if l[i+1] >= 0 :
            return(l[i])
            break

def f3(a,b,c) :
    l = abs(a+b+c)
    return(l//(10**(len(str(l))-1)))

def f4(a,b,c) :
    l = abs(a+b+c)
    return(l%10)

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    if s1 != 1 or s1 != 0 or s2 != 1 or s2 != 0 :
        print("Error")
        
exec(input().strip())

6530099821
# 1639838, 2022-09-24 09:40:46, ----[--][----] (0%)

def f1(a,b,c):
    m=[]
    if a>0:
        m.append(a)
    if b>0:
        m.append(b)
    if c>0:
        m.append(c)
    x=min(m)
    return x

def f2(a,b,c):
    m=[]
    if a<0:
        m.append(a)
    if b<0:
        m.append(b)
    if c<0:
        m.append(c)
    x=max(m)
    return x

def f3(a,b,c):
    s=a+b+c
    if s<0:
        p=str(s)[1]
    else:
        p=str(s)[0]
    return p
    
def f4(a,b,c):
    s=a+b+c
    p=str(s)[-1]
    return p
    
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0: 
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
# 1639877, 2022-09-24 09:41:43, PP--[PP][PPPP] (67%)

def f1(a,b,c):
    m=[]
    if a>0:
        m.append(a)
    if b>0:
        m.append(b)
    if c>0:
        m.append(c)
    x=min(m)
    return x

def f2(a,b,c):
    m=[]
    if a<0:
        m.append(a)
    if b<0:
        m.append(b)
    if c<0:
        m.append(c)
    x=max(m)
    return x

def f3(a,b,c):
    s=a+b+c
    if s<0:
        p=str(s)[1]
    else:
        p=str(s)[0]
    return p
    
def f4(a,b,c):
    s=a+b+c
    p=str(s)[-1]
    return p
    
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0: 
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
        
    
exec(input().strip())


# 1639881, 2022-09-24 09:41:46, PP--[PP][PPPP] (67%)

def f1(a,b,c):
    m=[]
    if a>0:
        m.append(a)
    if b>0:
        m.append(b)
    if c>0:
        m.append(c)
    x=min(m)
    return x

def f2(a,b,c):
    m=[]
    if a<0:
        m.append(a)
    if b<0:
        m.append(b)
    if c<0:
        m.append(c)
    x=max(m)
    return x

def f3(a,b,c):
    s=a+b+c
    if s<0:
        p=str(s)[1]
    else:
        p=str(s)[0]
    return p
    
def f4(a,b,c):
    s=a+b+c
    p=str(s)[-1]
    return p
    
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0: 
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
        
    
exec(input().strip())
# 1640862, 2022-09-24 10:08:52, PPx-[PP][PxPx] (50%)

def f1(a,b,c):
    m=[]
    if a>0:
        m.append(a)
    if b>0:
        m.append(b)
    if c>0:
        m.append(c)
    x=min(m)
    return x

def f2(a,b,c):
    m=[]
    if a<0:
        m.append(a)
    if b<0:
        m.append(b)
    if c<0:
        m.append(c)
    x=max(m)
    return x

def f3(a,b,c):
    s=a+b+c
    #if s<0:
    #    p=str(s)[1]
    #else:
    #    p=str(s)[0]
    return p
    
def f4(a,b,c):
    s=a+b+c
    p=str(s)[-1]
    return p
    
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0: 
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
        
    
exec(input().strip())
# 1640876, 2022-09-24 10:09:06, PP--[PP][PPPP] (67%)

def f1(a,b,c):
    m=[]
    if a>0:
        m.append(a)
    if b>0:
        m.append(b)
    if c>0:
        m.append(c)
    x=min(m)
    return x

def f2(a,b,c):
    m=[]
    if a<0:
        m.append(a)
    if b<0:
        m.append(b)
    if c<0:
        m.append(c)
    x=max(m)
    return x

def f3(a,b,c):
    s=a+b+c
    if s<0:
        p=str(s)[1]
    else:
        p=str(s)[0]
    return p
    
def f4(a,b,c):
    s=a+b+c
    p=str(s)[-1]
    return p
    
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0: 
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
        
    
exec(input().strip())
# 1640916, 2022-09-24 10:10:20, compilation error (0%)

def f1(a,b,c):
    m=[]
    if a>=0:
        m.append(a)
    if b>=0:
        m.append(b)
    if c>=0:
        m.append(c)
    x=min(m)
    return x

def f2(a,b,c):
    m=[]
    if a=<0:
        m.append(a)
    if b=<0:
        m.append(b)
    if c=<0:
        m.append(c)
    x=max(m)
    return x

def f3(a,b,c):
    s=a+b+c
    if s<0:
        p=str(s)[1]
    else:
        p=str(s)[0]
    return p
    
def f4(a,b,c):
    s=a+b+c
    p=str(s)[-1]
    return p
    
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0: 
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
        
    
exec(input().strip())
# 1640932, 2022-09-24 10:10:44, ----[PP][PPPP] (33%)

def f1(a,b,c):
    m=[]
    if a>=0:
        m.append(a)
    if b>=0:
        m.append(b)
    if c>=0:
        m.append(c)
    x=min(m)
    return x

def f2(a,b,c):
    m=[]
    if a<=0:
        m.append(a)
    if b<=0:
        m.append(b)
    if c<=0:
        m.append(c)
    x=max(m)
    return x

def f3(a,b,c):
    s=a+b+c
    if s<0:
        p=str(s)[1]
    else:
        p=str(s)[0]
    return p
    
def f4(a,b,c):
    s=a+b+c
    p=str(s)[-1]
    return p
    
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0: 
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
        
    
exec(input().strip())
# 1640985, 2022-09-24 10:12:16, compilation error (0%)

def f1(a,b,c):
    m=[]
    if a>0:
        m.append(a)
    if b>0:
        m.append(b)
    if c>0:
        m.append(c)
    x=min(m)
    return x

def f2(a,b,c):
    m=[]
    if a<0:
        m.append(a)
    if b<0:
        m.append(b)
    if c<0:
        m.append(c)
    x=max(m)
    return x

def f3(a,b,c):
    s=a+b+c
    if s<0:
        p=str(s)[1]
    else:
        p=str(s)[0]
    return p
    
def f4(a,b,c):
    s=a+b+c
    p=str(s)[-1]
    return p
    
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0: 
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    elif s1 or s2 != 0 or 1
        print('Error')
        
    
exec(input().strip())
# 1641002, 2022-09-24 10:12:39, PP--[PP][PPPP] (67%)

def f1(a,b,c):
    m=[]
    if a>0:
        m.append(a)
    if b>0:
        m.append(b)
    if c>0:
        m.append(c)
    x=min(m)
    return x

def f2(a,b,c):
    m=[]
    if a<0:
        m.append(a)
    if b<0:
        m.append(b)
    if c<0:
        m.append(c)
    x=max(m)
    return x

def f3(a,b,c):
    s=a+b+c
    if s<0:
        p=str(s)[1]
    else:
        p=str(s)[0]
    return p
    
def f4(a,b,c):
    s=a+b+c
    p=str(s)[-1]
    return p
    
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0: 
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    elif s1 or s2 != 0 or 1:
        print('Error')
        
    
exec(input().strip())
# 1641477, 2022-09-24 10:23:14, PP--[PP][PPPP] (67%)

def f1(a,b,c):
    m=[]
    if a>0:
        m.append(a)
    if b>0:
        m.append(b)
    if c>0:
        m.append(c)
    x=min(m)
    return x

def f2(a,b,c):
    m=[]
    if a<0:
        m.append(a)
    if b<0:
        m.append(b)
    if c<0:
        m.append(c)
    x=max(m)
    return x

def f3(a,b,c):
    s=a+b+c
    if s<0:
        p=str(s)[1]
    else:
        p=str(s)[0]
    return p
    
def f4(a,b,c):
    s=a+b+c
    p=str(s)[-1]
    return p
    
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0: 
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
        
    
exec(input().strip())


# 1641825, 2022-09-24 10:29:38, PP--[PP][PPPP] (67%)

def f1(a,b,c):
    m=[]
    if a>0:
        m.append(a)
    if b>0:
        m.append(b)
    if c>0:
        m.append(c)
    x=min(m)
    return x

def f2(a,b,c):
    m=[]
    if a<0:
        m.append(a)
    if b<0:
        m.append(b)
    if c<0:
        m.append(c)
    x=max(m)
    return x

def f3(a,b,c):
    s=a+b+c
    if s<0:
        s=-(s)
    p=str(s)[0]    
    return p
    
def f4(a,b,c):
    s=a+b+c
    if s<0:
        s=-(s)
    p=str(s)[-1]
    return p
    
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0: 
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
        
    
exec(input().strip())


# 1641907, 2022-09-24 10:30:51, ----[--][----] (0%)

def f1(a,b,c):
    m=[]
    if a>0:
        m.append(a)
    if b>0:
        m.append(b)
    if c>0:
        m.append(c)
    x=min(m)
    return x

def f2(a,b,c):
    m=[]
    if a<0:
        m.append(a)
    if b<0:
        m.append(b)
    if c<0:
        m.append(c)
    x=max(m)
    return x

def f3(a,b,c):
    s=a+b+c
    if s<0:
        s=-(s)
    p=str(s)[0]    
    return p
    
def f4(a,b,c):
    s=a+b+c
    if s<0:
        s=-(s)
    p=str(s)[-1]
    return p
    
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0: 
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
        
    

# 1641920, 2022-09-24 10:31:03, PP--[PP][PPPP] (67%)

def f1(a,b,c):
    m=[]
    if a>0:
        m.append(a)
    if b>0:
        m.append(b)
    if c>0:
        m.append(c)
    x=min(m)
    return x

def f2(a,b,c):
    m=[]
    if a<0:
        m.append(a)
    if b<0:
        m.append(b)
    if c<0:
        m.append(c)
    x=max(m)
    return x

def f3(a,b,c):
    s=a+b+c
    if s<0:
        s=-(s)
    p=str(s)[0]    
    return p
    
def f4(a,b,c):
    s=a+b+c
    if s<0:
        s=-(s)
    p=str(s)[-1]
    return p
    
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0: 
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
        
exec(input().strip())

6231117321
# 1638816, 2022-09-24 09:15:52, ----[--][----] (0%)

def f1(a, b, c):
    return max(a,b,b,0)
# 1638858, 2022-09-24 09:16:53, ----[--][----] (0%)

def f1(a, b, c):
    return min(a,b,c,0)
# 1639111, 2022-09-24 09:22:22, ----[--][----] (0%)

def f1(a, b, c):
    s=[]
    if a<0:
        s += [b] +[c]
    elif b<0:
        s += [a] +[c]
    else:
        s += [a] +[b]
    return min(s)
# 1639213, 2022-09-24 09:24:42, --xx[xx][xxxx] (0%)

def f1(a, b, c):
    s=[]
    if a<0:
        s += [b] +[c]
    elif b<0:
        s += [a] +[c]
    else:
        s += [a] +[b]
    return min(s)
    



def f2(a, b, c):
    s=[]
    if a>0:
        s += [b] +[c]
    elif b>0:
        s += [a] +[c]
    else:
        s += [a] +[b]
    return max(s)
    
    
    
    
    
    
    
exec(input().strip()) # DON'T remove this line
# 1639710, 2022-09-24 09:37:23, compilation error (0%)

### Grader 1 ###
#2
def f1(a, b, c):
    s=[]
    if a<0:
        s += [b] +[c]
    elif b<0:
        s += [a] +[c]
    else:
        s += [a] +[b]
    return min(s)
    



def f2(a, b, c):
    s=[]
    if a>0:
        s += [b] +[c]
    elif b>0:
        s += [a] +[c]
    else:
        s += [a] +[b]
    return max(s)
    


def f3(a, b, c):
    sum = 0
    sum += a + b + c
    if sum>0:
        pass
    else:
        sum =abs(sum)
    str_sum = str(sum)
    return str_sum[0]


    
    

def f4(a, b, c):
    sum = 0
    sum += a + b + c
    str_sum = str(sum)
    return str_sum[-1]
    



def main():
    s1,s2,a,b,c = [int(e) foe e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f3(a,b,c))
    else:
        print('Error')
    


exec(input().strip()) # DON'T remove this line


# 1639732, 2022-09-24 09:37:59, ----[PP][P-P-] (17%)

### Grader 1 ###
#2
def f1(a, b, c):
    s=[]
    if a<0:
        s += [b] +[c]
    elif b<0:
        s += [a] +[c]
    else:
        s += [a] +[b]
    return min(s)
    



def f2(a, b, c):
    s=[]
    if a>0:
        s += [b] +[c]
    elif b>0:
        s += [a] +[c]
    else:
        s += [a] +[b]
    return max(s)
    


def f3(a, b, c):
    sum = 0
    sum += a + b + c
    if sum>0:
        pass
    else:
        sum =abs(sum)
    str_sum = str(sum)
    return str_sum[0]


    
    

def f4(a, b, c):
    sum = 0
    sum += a + b + c
    str_sum = str(sum)
    return str_sum[-1]
    



def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f3(a,b,c))
    else:
        print('Error')
    


exec(input().strip()) # DON'T remove this line
# 1639812, 2022-09-24 09:40:04, ----[PP][PPPP] (33%)

### Grader 1 ###
#2
def f1(a, b, c):
    s=[]
    if a<0:
        s += [b] +[c]
    elif b<0:
        s += [a] +[c]
    else:
        s += [a] +[b]
    return min(s)
    



def f2(a, b, c):
    s=[]
    if a>0:
        s += [b] +[c]
    elif b>0:
        s += [a] +[c]
    else:
        s += [a] +[b]
    return max(s)
    


def f3(a, b, c):
    sum = 0
    sum += a + b + c
    if sum>0:
        pass
    else:
        sum =abs(sum)
    str_sum = str(sum)
    return str_sum[0]


    
    

def f4(a, b, c):
    sum = 0
    sum += a + b + c
    str_sum = str(sum)
    return str_sum[-1]
    



def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else:
        print('Error')
    


exec(input().strip()) # DON'T remove this line


# 1639893, 2022-09-24 09:42:04, --PP[PP][PPPP] (67%)

### Grader 1 ###
#2
def f1(a, b, c):
    s=[]
    if a<0:
        s += [b] +[c]
    elif b<0:
        s += [a] +[c]
    else:
        s += [a] +[b]
    return min(s)
    



def f2(a, b, c):
    s=[]
    if a>0:
        s += [b] +[c]
    elif b>0:
        s += [a] +[c]
    else:
        s += [a] +[b]
    return max(s)
    


def f3(a, b, c):
    sum = 0
    sum += a + b + c
    if sum>0:
        pass
    else:
        sum =abs(sum)
    str_sum = str(sum)
    return int(str_sum[0])


    
    

def f4(a, b, c):
    sum = 0
    sum += a + b + c
    str_sum = str(sum)
    return int(str_sum[-1])
    



def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else:
        print('Error')
    


exec(input().strip()) # DON'T remove this line


# 1641750, 2022-09-24 10:28:16, x-PP[PP][PPPP] (67%)

### Grader 1 ###
#2
def f1(a, b, c):
    s=[]
    if a<0 and b>0 and c>0:
        s += [b] +[c]
    elif b<0 and a>0 and c>0:
        s += [a] +[c]
    else:
        if c<0 and a>0 and b>0:
            s += [a] +[b]
    return min(s)
    



def f2(a, b, c):
    s=[]
    if a>0:
        s += [b] +[c]
    elif b>0:
        s += [a] +[c]
    else:
        s += [a] +[b]
    return max(s)
    


def f3(a, b, c):
    sum = 0
    sum += a + b + c
    if sum>0:
        pass
    else:
        sum =abs(sum)
    str_sum = str(sum)
    return int(str_sum[0])


    
    

def f4(a, b, c):
    sum = 0
    sum += a + b + c
    str_sum = str(sum)
    return int(str_sum[-1])
    



def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else:
        print('Error')
    


exec(input().strip()) # DON'T remove this line


# 1641902, 2022-09-24 10:30:43, --PP[PP][PPPP] (67%)

### Grader 1 ###
#2
def f1(a, b, c):
    s=[]
    if a<0:#and b>0 and c>0:
        s += [b] +[c]
    elif b<0:#and a>0 and c>0:
        s += [a] +[c]
    else:
        if c<0: #and a>0 and b>0:
            s += [a] +[b]
    return int(min(s))
    



def f2(a, b, c):
    s=[]
    if a>0:
        s += [b] +[c]
    elif b>0:
        s += [a] +[c]
    else:
        s += [a] +[b]
    return int(max(s))
    


def f3(a, b, c):
    sum = 0
    sum += a + b + c
    if sum>0:
        pass
    else:
        sum =abs(sum)
    str_sum = str(sum)
    return int(str_sum[0])


    
    

def f4(a, b, c):
    sum = 0
    sum += a + b + c
    str_sum = str(sum)
    return int(str_sum[-1])
    



def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else:
        print('Error')
    


exec(input().strip()) # DON'T remove this line


# 1642047, 2022-09-24 10:33:33, --PP[PP][PPPP] (67%)

### Grader 1 ###
#2
def f1(a, b, c):
    list = [a,b,c]
    for ele in list:
        if ele <0:
            list.remove(ele)
    return min(list)



def f2(a, b, c):
    s=[]
    if a>0:
        s += [b] +[c]
    elif b>0:
        s += [a] +[c]
    else:
        s += [a] +[b]
    return int(max(s))
    


def f3(a, b, c):
    sum = 0
    sum += a + b + c
    if sum>0:
        pass
    else:
        sum =abs(sum)
    str_sum = str(sum)
    return int(str_sum[0])


    
    

def f4(a, b, c):
    sum = 0
    sum += a + b + c
    str_sum = str(sum)
    return int(str_sum[-1])
    



def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else:
        print('Error')
    


exec(input().strip()) # DON'T remove this line
# 1642161, 2022-09-24 10:35:19, --PP[PP][PPPP] (67%)

### Grader 1 ###
#2
# def f1(a, b, c):
#     s=[]
#     if a<0:#and b>0 and c>0:
#         s += [b] +[c]
#     elif b<0:#and a>0 and c>0:
#         s += [a] +[c]
#     else:
#         if c<0: #and a>0 and b>0:
#             s += [a] +[b]
#     return int(min(s))

def f1(a, b, c):
    list = [a,b,c]
    for ele in list:
        if ele <0:
            list.remove(ele)
    return min(list)
    
    



# def f2(a, b, c):
#     s=[]
#     if a>0:
#         s += [b] +[c]
#     elif b>0:
#         s += [a] +[c]
#     else:
#         s += [a] +[b]
#     return int(max(s))

def f2(a, b, c):
    list = [a,b,c]
    for ele in list:
        if ele >0:
            list.remove(ele)
    return max(list)
    


def f3(a, b, c):
    sum = 0
    sum += a + b + c
    if sum>0:
        pass
    else:
        sum =abs(sum)
    str_sum = str(sum)
    return int(str_sum[0])


    
    

def f4(a, b, c):
    sum = 0
    sum += a + b + c
    str_sum = str(sum)
    return int(str_sum[-1])
    



def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else:
        print('Error')
    


exec(input().strip()) # DON'T remove this line



6530047121
# 1639246, 2022-09-24 09:25:38, xx-x[xx][xxxx] (0%)

def f3(a,b,c):
    x=a+b+c
    y=str(x)
    if x>=0:
        return y[0]
    else :
        return y[1]
exec(input().strip())

# 1639304, 2022-09-24 09:27:04, xx-x[xx][xxxx] (0%)

def f3(a,b,c):
    x=a+b+c
    y=str(x)
    if x>=0:
        return y[0]
    else :
        return y[1]
    
exec(input().strip())

# 1639779, 2022-09-24 09:39:06, ----[--][----] (0%)

def f1(a,b,c):
    if a<0:
        a=1001
    if b<0:
        b=1001
    if c<0:
        c=1001
    d=[a,b,c]
    return min(d)
def f2(a,b,c):
    if a>0:
        a=-1001
    if b>0:
        b=-1001
    if c>0:
        c=-1001
    d=[a,b,c]
    return max(d)
def f3(a,b,c):
    x=a+b+c
    y=str(x)
    if x>=0:
        return y[0]
    else :
        return y[1]
def f4(a,b,c):
    x=a+b+c
    y=str(x)
    return y[-1]
def main():
    x=input().split()
    s1=int(x[0])
    s2=int(x[1])
    a=int(x[2])
    b=int(x[3])
    c=int(x[4])
    if s1==0 and s2==0:
        return f1(a,b,c)
    
exec(input().strip())

# 1639964, 2022-09-24 09:44:13, ----[--][----] (0%)

def f1(a,b,c):
    if a<0:
        a=1001
    if b<0:
        b=1001
    if c<0:
        c=1001
    d=[a,b,c]
    return min(d)
def f2(a,b,c):
    if a>0:
        a=-1001
    if b>0:
        b=-1001
    if c>0:
        c=-1001
    d=[a,b,c]
    return max(d)
def f3(a,b,c):
    x=a+b+c
    y=str(x)
    if x>=0:
        return y[0]
    else :
        return y[1]
def f4(a,b,c):
    x=a+b+c
    y=str(x)
    return y[-1]
def main():
    x=input().split()
    s1=int(x[0])
    s2=int(x[1])
    a=int(x[2])
    b=int(x[3])
    c=int(x[4])
    if s1==0 and s2==0:
        return f1(a,b,c)
    elif s1==0 and s2==1:
        return f2(a,b,c)
    elif s1==1 and s2==0:
        return f3(a,b,c)
    elif s1==1 and s2==1:
        return f4(a,b,c)
    else:
        return "Error"
    
exec(input().strip())

# 1640258, 2022-09-24 09:52:18, ----[--][----] (0%)

def f1(a,b,c):
    if a<0:
        a=1001
    if b<0:
        b=1001
    if c<0:
        c=1001
    d=[a,b,c]
    return min(d)
def f2(a,b,c):
    if a>0:
        a=-1001
    if b>0:
        b=-1001
    if c>0:
        c=-1001
    d=[a,b,c]
    return max(d)
def f3(a,b,c):
    x=a+b+c
    y=str(x)
    if x>=0:
        return y[0]
    else :
        return y[1]
def f4(a,b,c):
    x=a+b+c
    y=str(x)
    return y[-1]
def main():
    x=input().split()
    s1=int(x[0])
    s2=int(x[1])
    a=int(x[2])
    b=int(x[3])
    c=int(x[4])
    if s1==0 and s2==0:
        return f1(a,b,c)
    elif s1==0 and s2==1:
        return f2(a,b,c)
    elif s1==1 and s2==0:
        return f3(a,b,c)
    elif s1==1 and s2==1:
        return f4(a,b,c)
    else:
        return "Error"
exec(input().strip())
# 1641141, 2022-09-24 10:16:20, ----[PP][PPPP] (33%)

def f1(a,b,c):
    if a<0:
        a=1001
    if b<0:
        b=1001
    if c<0:
        c=1001
    d=[a,b,c]
    return min(d)
def f2(a,b,c):
    if a>0:
        a=-1001
    if b>0:
        b=-1001
    if c>0:
        c=-1001
    d=[a,b,c]
    return max(d)
def f3(a,b,c):
    x=a+b+c
    y=str(x)
    if x>=0:
        return y[0]
    else :
        return y[1]
def f4(a,b,c):
    x=a+b+c
    y=str(x)
    return y[-1]
def main():
    x=input().split()
    s1=int(x[0])
    s2=int(x[1])
    a=int(x[2])
    b=int(x[3])
    c=int(x[4])
    if s1==0 and s2==0:
        return print(f1(a,b,c))
    elif s1==0 and s2==1:
        return print(f2(a,b,c))
    elif s1==1 and s2==0:
        return print(f3(a,b,c))
    elif s1==1 and s2==1:
        return print(f4(a,b,c))
    else:
        return print("Error")
exec(input().strip())

# 1641288, 2022-09-24 10:19:17, ----[PP][PPPP] (33%)

def f1(a,b,c):
    if a<0:
        a=1001
    if b<0:
        b=1001
    if c<0:
        c=1001
    d=[a,b,c]
    return str(min(d))
def f2(a,b,c):
    if a>0:
        a=-1001
    if b>0:
        b=-1001
    if c>0:
        c=-1001
    d=[a,b,c]
    return str(max(d))
def f3(a,b,c):
    x=a+b+c
    y=str(x)
    if x>=0:
        return y[0]
    else :
        return y[1]
def f4(a,b,c):
    x=a+b+c
    y=str(x)
    return str(y[-1])
def main():
    x=input().split()
    s1=int(x[0])
    s2=int(x[1])
    a=int(x[2])
    b=int(x[3])
    c=int(x[4])
    if s1==0 and s2==0:
        return print(f1(a,b,c))
    elif s1==0 and s2==1:
        return print(f2(a,b,c))
    elif s1==1 and s2==0:
        return print(f3(a,b,c))
    elif s1==1 and s2==1:
        return print(f4(a,b,c))
    else:
        return print("Error")
exec(input().strip())

# 1641392, 2022-09-24 10:21:15, ----[PP][PPPP] (33%)

def f1(a,b,c):
    if a<0:
        a=1001
    if b<0:
        b=1001
    if c<0:
        c=1001
    d=[a,b,c]
    return min(d)
def f2(a,b,c):
    if a>0:
        a=-1001
    if b>0:
        b=-1001
    if c>0:
        c=-1001
    d=[a,b,c]
    return max(d)
def f3(a,b,c):
    x=a+b+c
    y=str(x)
    if x>=0:
        return y[0]
    else :
        return y[1]
def f4(a,b,c):
    x=a+b+c
    y=str(x)
    return y[-1]
def main():
    x=input().split()
    s1=int(x[0])
    s2=int(x[1])
    a=int(x[2])
    b=int(x[3])
    c=int(x[4])
    if s1==0 and s2==0:
        return print(f1(a,b,c))
    elif s1==0 and s2==1:
        return print(f2(a,b,c))
    elif s1==1 and s2==0:
        return print(f3(a,b,c))
    elif s1==1 and s2==1:
        return print(f4(a,b,c))
    else:
        return print("Error")
exec(input().strip())

# 1641456, 2022-09-24 10:22:36, --PP[PP][PPPP] (67%)

def f1(a,b,c):
    if a<0:
        a=1001
    if b<0:
        b=1001
    if c<0:
        c=1001
    d=[a,b,c]
    return int(min(d))
def f2(a,b,c):
    if a>0:
        a=-1001
    if b>0:
        b=-1001
    if c>0:
        c=-1001
    d=[a,b,c]
    return int(max(d))
def f3(a,b,c):
    x=a+b+c
    y=str(x)
    if x>=0:
        return int(y[0])
    else :
        return int(y[1])
def f4(a,b,c):
    x=a+b+c
    y=str(x)
    return int(y[-1])
def main():
    x=input().split()
    s1=int(x[0])
    s2=int(x[1])
    a=int(x[2])
    b=int(x[3])
    c=int(x[4])
    if s1==0 and s2==0:
        return print(f1(a,b,c))
    elif s1==0 and s2==1:
        return print(f2(a,b,c))
    elif s1==1 and s2==0:
        return print(f3(a,b,c))
    elif s1==1 and s2==1:
        return print(f4(a,b,c))
    else:
        return print("Error")
exec(input().strip())

# 1642226, 2022-09-24 10:36:09, compilation error (0%)

def f1(a,b,c):
    if a<0:
        a=1001
    if b<0:
        b=1001
    if c<0:
        c=1001
    d=[a,b,c]
    if min(d) x%1>=0.5:
        return min(d)+1
    else:
        return min(d)
def f2(a,b,c):
    if a>0:
        a=-1001
    if b>0:
        b=-1001
    if c>0:
        c=-1001
    d=[a,b,c]
    return max(d)
def f3(a,b,c):
    x=a+b+c
    y=str(x)
    if x>=0:
        return y[0]
    else :
        return y[1]
def f4(a,b,c):
    x=a+b+c
    y=str(x)
    return y[-1]
def main():
    x=input().split()
    s1=int(x[0])
    s2=int(x[1])
    a=int(x[2])
    b=int(x[3])
    c=int(x[4])
    if s1==0 and s2==0:
        if a<0:
            a=1001
        if b<0:
            b=1001
        if c<0:
            c=1001
        d=[a,b,c]
        return min(d)
    elif s1==0 and s2==1:
        if a>0:
            a=-1001
        if b>0:
            b=-1001
        if c>0:
            c=-1001
        d=[a,b,c]
        return max(d)
    elif s1==1 and s2==0:
        x=a+b+c
        y=str(x)
        if x>=0:
            return y[0]
        else :
            return y[1]
    elif s1==1 and s2==1:
        x=a+b+c
        y=str(x)
        return y[-1]
    else:
        return "Error"
    
exec(input().strip())

# 1642255, 2022-09-24 10:36:31, ----[--][----] (0%)

def f1(a,b,c):
    if a<0:
        a=1001
    if b<0:
        b=1001
    if c<0:
        c=1001
    d=[a,b,c]
    return min(d)
def f2(a,b,c):
    if a>0:
        a=-1001
    if b>0:
        b=-1001
    if c>0:
        c=-1001
    d=[a,b,c]
    return max(d)
def f3(a,b,c):
    x=a+b+c
    y=str(x)
    if x>=0:
        return y[0]
    else :
        return y[1]
def f4(a,b,c):
    x=a+b+c
    y=str(x)
    return y[-1]
def main():
    x=input().split()
    s1=int(x[0])
    s2=int(x[1])
    a=int(x[2])
    b=int(x[3])
    c=int(x[4])
    if s1==0 and s2==0:
        if a<0:
            a=1001
        if b<0:
            b=1001
        if c<0:
            c=1001
        d=[a,b,c]
        return min(d)
    elif s1==0 and s2==1:
        if a>0:
            a=-1001
        if b>0:
            b=-1001
        if c>0:
            c=-1001
        d=[a,b,c]
        return max(d)
    elif s1==1 and s2==0:
        x=a+b+c
        y=str(x)
        if x>=0:
            return y[0]
        else :
            return y[1]
    elif s1==1 and s2==1:
        x=a+b+c
        y=str(x)
        return y[-1]
    else:
        return "Error"
    
exec(input().strip())

# 1642301, 2022-09-24 10:37:07, --PP[PP][PPPP] (67%)

def f1(a,b,c):
    if a<0:
        a=1001
    if b<0:
        b=1001
    if c<0:
        c=1001
    d=[a,b,c]
    return int(min(d))
def f2(a,b,c):
    if a>0:
        a=-1001
    if b>0:
        b=-1001
    if c>0:
        c=-1001
    d=[a,b,c]
    return int(max(d))
def f3(a,b,c):
    x=a+b+c
    y=str(x)
    if x>=0:
        return int(y[0])
    else :
        return int(y[1])
def f4(a,b,c):
    x=a+b+c
    y=str(x)
    return int(y[-1])
def main():
    x=input().split()
    s1=int(x[0])
    s2=int(x[1])
    a=int(x[2])
    b=int(x[3])
    c=int(x[4])
    if s1==0 and s2==0:
        return print(f1(a,b,c))
    elif s1==0 and s2==1:
        return print(f2(a,b,c))
    elif s1==1 and s2==0:
        return print(f3(a,b,c))
    elif s1==1 and s2==1:
        return print(f4(a,b,c))
    else:
        return print("Error")
exec(input().strip())

6531803421
# 1640024, 2022-09-24 09:46:11, --P-[PP][PPPP] (50%)

def f1(a, b, c) :
    if a > 0 and b > 0 and c > 0 : return min(a,b,c)
    if a < 0 and b < 0 and c > 0 : return c
    if a < 0 and b > 0 and c < 0 : return b
    if a > 0 and b < 0 and c < 0 : return a
    if a < 0 and b > 0 and c > 0 : return min(b,c)
    if a > 0 and b < 0 and c > 0 : return min(a,c)
    if a > 0 and b > 0 and c < 0 : return min(a,b)
def f2(a, b, c) :
    if a < 0 and b < 0 and c < 0 : return max(a,b,c)
    if a < 0 and b < 0 and c > 0 : return max(a,b)
    if a < 0 and b > 0 and c < 0 : return max(a,c)
    if a > 0 and b < 0 and c < 0 : return max(b,c)
    if a < 0 and b > 0 and c > 0 : return a
    if a > 0 and b < 0 and c > 0 : return b
    if a > 0 and b > 0 and c < 0 : return c
def f3(a, b, c) :
    s = abs(a + b + c)
    a = 10**(len(str(s)) - 1)
    ss = s
    ss //= a
    return ss
def f4(a, b, c) :
    s = abs(a + b + c)
    a = 10**(len(str(s)) - 1)
    ss = s
    ss %= a
    return ss
def main() :
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print('Error')
exec(input().strip())
# 1641393, 2022-09-24 10:21:17, --P-[PP][PPPP] (50%)

def f1(a, b, c) :
    if a > 0 and b > 0 and c > 0 : return min(a,b,c)
    if a < 0 and b < 0 and c > 0 : return c
    if a < 0 and b > 0 and c < 0 : return b
    if a > 0 and b < 0 and c < 0 : return a
    if a < 0 and b > 0 and c > 0 : return min(b,c)
    if a > 0 and b < 0 and c > 0 : return min(a,c)
    if a > 0 and b > 0 and c < 0 : return min(a,b)
def f2(a, b, c) :
    if a < 0 and b < 0 and c < 0 : return max(a,b,c)
    if a < 0 and b < 0 and c > 0 : return max(a,b)
    if a < 0 and b > 0 and c < 0 : return max(a,c)
    if a > 0 and b < 0 and c < 0 : return max(b,c)
    if a < 0 and b > 0 and c > 0 : return a
    if a > 0 and b < 0 and c > 0 : return b
    if a > 0 and b > 0 and c < 0 : return c
def f3(a, b, c) :
    s = abs(a + b + c)
    a = 10**(len(str(s)) - 1)
    s //= a
    return s
def f4(a, b, c) :
    s = abs(a + b + c)
    a = 10**(len(str(s)) - 1)
    s %= a
    return s
def main() :
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print('Error')
exec(input().strip())
# 1641464, 2022-09-24 10:22:52, compilation error (0%)

def f1(a, b, c) :
    if a > 0 and b > 0 and c > 0 : return min(a,b,c)
    if a < 0 and b < 0 and c > 0 : return c
    if a < 0 and b > 0 and c < 0 : return b
    if a > 0 and b < 0 and c < 0 : return a
    if a < 0 and b > 0 and c > 0 : return min(b,c)
    if a > 0 and b < 0 and c > 0 : return min(a,c)
    if a > 0 and b > 0 and c < 0 : return min(a,b)
def f2(a, b, c) :
    if a < 0 and b < 0 and c < 0 : return max(a,b,c)
    if a < 0 and b < 0 and c > 0 : return max(a,b)
    if a < 0 and b > 0 and c < 0 : return max(a,c)
    if a > 0 and b < 0 and c < 0 : return max(b,c)
    if a < 0 and b > 0 and c > 0 : return a
    if a > 0 and b < 0 and c > 0 : return b
    if a > 0 and b > 0 and c < 0 : return c
def f3(a, b, c) :
    s = a + b + c
    if s < 0 :
      a = 10**(len(str(s)) - 2)
      return s //= a
    elif s > 0 :
      a = 10**(len(str(s)) - 1)
      return s //= a
def f4(a, b, c) :
    s = a + b + c
    if s < 0 :
      a = 10**(len(str(s)) - 2)
      return s %= a
    elif s > 0 :
      a = 10**(len(str(s)) - 1)
      return s %= a
def main() :
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print('Error')
exec(input().strip())
# 1641535, 2022-09-24 10:24:23, ----[PP][PPP-] (17%)

def f1(a, b, c) :
    if a > 0 and b > 0 and c > 0 : return min(a,b,c)
    if a < 0 and b < 0 and c > 0 : return c
    if a < 0 and b > 0 and c < 0 : return b
    if a > 0 and b < 0 and c < 0 : return a
    if a < 0 and b > 0 and c > 0 : return min(b,c)
    if a > 0 and b < 0 and c > 0 : return min(a,c)
    if a > 0 and b > 0 and c < 0 : return min(a,b)
def f2(a, b, c) :
    if a < 0 and b < 0 and c < 0 : return max(a,b,c)
    if a < 0 and b < 0 and c > 0 : return max(a,b)
    if a < 0 and b > 0 and c < 0 : return max(a,c)
    if a > 0 and b < 0 and c < 0 : return max(b,c)
    if a < 0 and b > 0 and c > 0 : return a
    if a > 0 and b < 0 and c > 0 : return b
    if a > 0 and b > 0 and c < 0 : return c
def f3(a, b, c) :
    s = a + b + c
    if s < 0 :
      a = 10**(len(str(s)) - 2)
      return s // a
    elif s > 0 :
      a = 10**(len(str(s)) - 1)
      return s // a
def f4(a, b, c) :
    s = a + b + c
    if s < 0 :
      a = 10**(len(str(s)) - 2)
      return s % a
    elif s > 0 :
      a = 10**(len(str(s)) - 1)
      return s % a
def main() :
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print('Error')
exec(input().strip())
# 1641660, 2022-09-24 10:26:27, ----[PP][P-P-] (17%)

def f1(a, b, c) :
    if a > 0 and b > 0 and c > 0 : return min(a,b,c)
    if a < 0 and b < 0 and c > 0 : return c
    if a < 0 and b > 0 and c < 0 : return b
    if a > 0 and b < 0 and c < 0 : return a
    if a < 0 and b > 0 and c > 0 : return min(b,c)
    if a > 0 and b < 0 and c > 0 : return min(a,c)
    if a > 0 and b > 0 and c < 0 : return min(a,b)
def f2(a, b, c) :
    if a < 0 and b < 0 and c < 0 : return max(a,b,c)
    if a < 0 and b < 0 and c > 0 : return max(a,b)
    if a < 0 and b > 0 and c < 0 : return max(a,c)
    if a > 0 and b < 0 and c < 0 : return max(b,c)
    if a < 0 and b > 0 and c > 0 : return a
    if a > 0 and b < 0 and c > 0 : return b
    if a > 0 and b > 0 and c < 0 : return c
def f3(a, b, c) :
    s = abs(a + b + c)
    a = 10**(len(str(s)) - 1)
    ss = s
    s //= a
    return s,a,ss
def f4(a, b, c) :
    s = abs(a + b + c)
    a = 10**(len(str(s)) - 1)
    ss = s
    ss %= a
    return s,a,ss
def main() :
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print('Error')
exec(input().strip())

# 1641670, 2022-09-24 10:26:42, ----[PP][P-P-] (17%)

def f1(a, b, c) :
    if a > 0 and b > 0 and c > 0 : return min(a,b,c)
    if a < 0 and b < 0 and c > 0 : return c
    if a < 0 and b > 0 and c < 0 : return b
    if a > 0 and b < 0 and c < 0 : return a
    if a < 0 and b > 0 and c > 0 : return min(b,c)
    if a > 0 and b < 0 and c > 0 : return min(a,c)
    if a > 0 and b > 0 and c < 0 : return min(a,b)
def f2(a, b, c) :
    if a < 0 and b < 0 and c < 0 : return max(a,b,c)
    if a < 0 and b < 0 and c > 0 : return max(a,b)
    if a < 0 and b > 0 and c < 0 : return max(a,c)
    if a > 0 and b < 0 and c < 0 : return max(b,c)
    if a < 0 and b > 0 and c > 0 : return a
    if a > 0 and b < 0 and c > 0 : return b
    if a > 0 and b > 0 and c < 0 : return c
def f3(a, b, c) :
    s = abs(a + b + c)
    a = 10**(len(str(s)) - 1)
    ss = s
    s //= a
    return ss
def f4(a, b, c) :
    s = abs(a + b + c)
    a = 10**(len(str(s)) - 1)
    ss = s
    ss %= a
    return ss
def main() :
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print('Error')
exec(input().strip())
# 1641687, 2022-09-24 10:27:02, --P-[PP][PPPP] (50%)

def f1(a, b, c) :
    if a > 0 and b > 0 and c > 0 : return min(a,b,c)
    if a < 0 and b < 0 and c > 0 : return c
    if a < 0 and b > 0 and c < 0 : return b
    if a > 0 and b < 0 and c < 0 : return a
    if a < 0 and b > 0 and c > 0 : return min(b,c)
    if a > 0 and b < 0 and c > 0 : return min(a,c)
    if a > 0 and b > 0 and c < 0 : return min(a,b)
def f2(a, b, c) :
    if a < 0 and b < 0 and c < 0 : return max(a,b,c)
    if a < 0 and b < 0 and c > 0 : return max(a,b)
    if a < 0 and b > 0 and c < 0 : return max(a,c)
    if a > 0 and b < 0 and c < 0 : return max(b,c)
    if a < 0 and b > 0 and c > 0 : return a
    if a > 0 and b < 0 and c > 0 : return b
    if a > 0 and b > 0 and c < 0 : return c
def f3(a, b, c) :
    s = abs(a + b + c)
    a = 10**(len(str(s)) - 1)
    ss = s
    ss //= a
    return ss
def f4(a, b, c) :
    s = abs(a + b + c)
    a = 10**(len(str(s)) - 1)
    ss = s
    ss %= a
    return ss
def main() :
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print('Error')
exec(input().strip())
# 1641818, 2022-09-24 10:29:27, compilation error (0%)

def f1(a, b, c) :
    if a > 0 and b > 0 and c > 0 : return min(a,b,c)
    if a < 0 and b < 0 and c > 0 : return c
    if a < 0 and b > 0 and c < 0 : return b
    if a > 0 and b < 0 and c < 0 : return a
    if a < 0 and b > 0 and c > 0 : return min(b,c)
    if a > 0 and b < 0 and c > 0 : return min(a,c)
    if a > 0 and b > 0 and c < 0 : return min(a,b)
    if b = 0 : return b
    if a = 0 : return a
    if c = 0 : return c
def f2(a, b, c) :
    if a < 0 and b < 0 and c < 0 : return max(a,b,c)
    if a < 0 and b < 0 and c > 0 : return max(a,b)
    if a < 0 and b > 0 and c < 0 : return max(a,c)
    if a > 0 and b < 0 and c < 0 : return max(b,c)
    if a < 0 and b > 0 and c > 0 : return a
    if a > 0 and b < 0 and c > 0 : return b
    if a > 0 and b > 0 and c < 0 : return c
    if b = 0 : return b
    if a = 0 : return a
    if c = 0 : return c
def f3(a, b, c) :
    s = abs(a + b + c)
    a = 10**(len(str(s)) - 1)
    ss = s
    ss //= a
    return ss
def f4(a, b, c) :
    s = abs(a + b + c)
    a = 10**(len(str(s)) - 1)
    ss = s
    ss %= a
    return ss
def main() :
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print('Error')
exec(input().strip())
# 1641869, 2022-09-24 10:30:13, compilation error (0%)

def f1(a, b, c) :
    if a > 0 and b > 0 and c > 0 : return min(a,b,c)
    elif a < 0 and b < 0 and c > 0 : return c
    elif a < 0 and b > 0 and c < 0 : return b
    elif a > 0 and b < 0 and c < 0 : return a
    elif a < 0 and b > 0 and c > 0 : return min(b,c)
    elif a > 0 and b < 0 and c > 0 : return min(a,c)
    elif a > 0 and b > 0 and c < 0 : return min(a,b)
    
def f2(a, b, c) :
    if a < 0 and b < 0 and c < 0 : return max(a,b,c)
    elif a < 0 and b < 0 and c > 0 : return max(a,b)
    elif a < 0 and b > 0 and c < 0 : return max(a,c)
    elif a > 0 and b < 0 and c < 0 : return max(b,c)
    elif a < 0 and b > 0 and c > 0 : return a
    elif a > 0 and b < 0 and c > 0 : return b
    elif a > 0 and b > 0 and c < 0 : return c
    def f3(a, b, c) :
    s = abs(a + b + c)
    a = 10**(len(str(s)) - 1)
    ss = s
    ss //= a
    return ss
def f4(a, b, c) :
    s = abs(a + b + c)
    a = 10**(len(str(s)) - 1)
    ss = s
    ss %= a
    return ss
def main() :
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print('Error')
exec(input().strip())
# 1641929, 2022-09-24 10:31:09, compilation error (0%)

def f1(a, b, c) :
    if a > 0 and b > 0 and c > 0 : return min(a,b,c)
    elif a < 0 and b < 0 and c > 0 : return c
    elif a < 0 and b > 0 and c < 0 : return b
    elif a > 0 and b < 0 and c < 0 : return a
    elif a < 0 and b > 0 and c > 0 : return min(b,c)
    elif a > 0 and b < 0 and c > 0 : return min(a,c)
    elif a > 0 and b > 0 and c < 0 : return min(a,b)
    
def f2(a, b, c) :
    if a < 0 and b < 0 and c < 0 : return max(a,b,c)
    elif a < 0 and b < 0 and c > 0 : return max(a,b)
    elif a < 0 and b > 0 and c < 0 : return max(a,c)
    elif a > 0 and b < 0 and c < 0 : return max(b,c)
    elif a < 0 and b > 0 and c > 0 : return a
    elif a > 0 and b < 0 and c > 0 : return b
    elif a > 0 and b > 0 and c < 0 : return c
  def f3(a, b, c) :
    s = abs(a + b + c)
    a = 10**(len(str(s)) - 1)
    ss = s
    ss //= a
    return ss
def f4(a, b, c) :
    s = abs(a + b + c)
    a = 10**(len(str(s)) - 1)
    ss = s
    ss %= a
    return ss
def main() :
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print('Error')
exec(input().strip())
# 1641935, 2022-09-24 10:31:20, --P-[PP][PPPP] (50%)

def f1(a, b, c) :
    if a > 0 and b > 0 and c > 0 : return min(a,b,c)
    elif a < 0 and b < 0 and c > 0 : return c
    elif a < 0 and b > 0 and c < 0 : return b
    elif a > 0 and b < 0 and c < 0 : return a
    elif a < 0 and b > 0 and c > 0 : return min(b,c)
    elif a > 0 and b < 0 and c > 0 : return min(a,c)
    elif a > 0 and b > 0 and c < 0 : return min(a,b)
    
def f2(a, b, c) :
    if a < 0 and b < 0 and c < 0 : return max(a,b,c)
    elif a < 0 and b < 0 and c > 0 : return max(a,b)
    elif a < 0 and b > 0 and c < 0 : return max(a,c)
    elif a > 0 and b < 0 and c < 0 : return max(b,c)
    elif a < 0 and b > 0 and c > 0 : return a
    elif a > 0 and b < 0 and c > 0 : return b
    elif a > 0 and b > 0 and c < 0 : return c
def f3(a, b, c) :
    s = abs(a + b + c)
    a = 10**(len(str(s)) - 1)
    ss = s
    ss //= a
    return ss
def f4(a, b, c) :
    s = abs(a + b + c)
    a = 10**(len(str(s)) - 1)
    ss = s
    ss %= a
    return ss
def main() :
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print('Error')
exec(input().strip())
# 1642320, 2022-09-24 10:37:21, -PP-[PP][PPPP] (67%)

def f1(a, b, c) :
    if a > 0 and b > 0 and c > 0 : return min(a,b,c)
    elif a <= 0 and b <= 0 and c > 0 : return c
    elif a <= 0 and b > 0 and c < 0 : return b
    elif a > 0 and b <= 0 and c <= 0 : return a
    elif a <= 0 and b > 0 and c > 0 : return min(b,c)
    elif a > 0 and b <= 0 and c > 0 : return min(a,c)
    elif a > 0 and b > 0 and c <= 0 : return min(a,b)
    
def f2(a, b, c) :
    if a < 0 and b < 0 and c < 0 : return max(a,b,c)
    elif a < 0 and b < 0 and c >= 0 : return max(a,b)
    elif a < 0 and b >= 0 and c < 0 : return max(a,c)
    elif a >= 0 and b < 0 and c < 0 : return max(b,c)
    elif a < 0 and b >= 0 and c >= 0 : return a
    elif a >= 0 and b < 0 and c >= 0 : return b
    elif a >= 0 and b >= 0 and c < 0 : return c
def f3(a, b, c) :
    s = abs(a + b + c)
    a = 10**(len(str(s)) - 1)
    ss = s
    ss //= a
    return ss
def f4(a, b, c) :
    s = abs(a + b + c)
    a = 10**(len(str(s)) - 1)
    ss = s
    ss %= a
    return ss
def main() :
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print('Error')
exec(input().strip())

6530063121
# 1639789, 2022-09-24 09:39:20, ---P[PP][P-P-] (33%)

def f1(a, b, c):
    if a<0:
        a=1001
    elif b<0:
        b=1001
    elif c<0:
        c=1001
    d=int(a)
    if d>b:
        d=b
    if d>c:
        d=c
    return(int(d))
def f2(a, b, c):
    if a>0:
        a=-1001
    elif b>0:
        b=-1001
    elif c>0:
        c=-1001
    d=int(a)
    if d<b:
        d=b
    if d<c:
        d=c
    return(int(d))
def f3(a, b, c):
    d=a+b+c
    if d<0:
        d=-d
    if 0<d<10:
        return(d)
    elif 10<=d<100:
        return(d//10%10)
    elif 100<=d<1000:
        return(d//100%10)
    elif d==1000:
        return(1)
def f4(a, b, c):
    d=a+b+c
    if d<0:
        d=-d
    return(d%10)
def main():
    s1,s2,a,b,c= [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip())
        
    

# 1639912, 2022-09-24 09:42:47, ---P[PP][P-P-] (33%)

def f1(a, b, c):
    if a<=0:
        a=1001
    elif b<=0:
        b=1001
    elif c<=0:
        c=1001
    d=int(a)
    if d>b:
        d=b
    if d>c:
        d=c
    return(int(d))
def f2(a, b, c):
    if a>=0:
        a=-1001
    elif b>=0:
        b=-1001
    elif c>=0:
        c=-1001
    d=int(a)
    if d<b:
        d=b
    if d<c:
        d=c
    return(int(d))
def f3(a, b, c):
    d=a+b+c
    if d<0:
        d=-d
    if 0<d<10:
        return(d)
    elif 10<=d<100:
        return(d//10%10)
    elif 100<=d<1000:
        return(d//100%10)
    elif d==1000:
        return(1)
def f4(a, b, c):
    d=a+b+c
    if d<0:
        d=-d
    return(d%10)
def main():
    s1,s2,a,b,c= [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip())
        
    

# 1641824, 2022-09-24 10:29:38, ----[--][----] (0%)

def f1(a, b, c):
    if a<=0:
        a=1001
    elif b<=0:
        b=1001
    elif c<=0:
        c=1001
    d=int(a)
    if d>b:
        d=b
    if d>c:
        d=c
    return(int(d))
# 1641845, 2022-09-24 10:29:54, ----[--][----] (0%)

def f2(a, b, c):
    if a>=0:
        a=-1001
    elif b>=0:
        b=-1001
    elif c>=0:
        c=-1001
    d=int(a)
    if d<b:
        d=b
    if d<c:
        d=c
    return(int(d))
# 1641859, 2022-09-24 10:30:06, ----[--][----] (0%)

def f3(a, b, c):
    d=a+b+c
    if d<0:
        d=-d
    if 0<d<10:
        return(d)
    elif 10<=d<100:
        return(d//10%10)
    elif 100<=d<1000:
        return(d//100%10)
    elif d==1000:
        return(1)
# 1641874, 2022-09-24 10:30:20, ----[--][----] (0%)

def f4(a, b, c):
    d=a+b+c
    if d<0:
        d=-d
    return(d%10)
# 1641892, 2022-09-24 10:30:36, ---P[PP][P-P-] (33%)

def f1(a, b, c):
    if a<=0:
        a=1001
    elif b<=0:
        b=1001
    elif c<=0:
        c=1001
    d=int(a)
    if d>b:
        d=b
    if d>c:
        d=c
    return(int(d))
def f2(a, b, c):
    if a>=0:
        a=-1001
    elif b>=0:
        b=-1001
    elif c>=0:
        c=-1001
    d=int(a)
    if d<b:
        d=b
    if d<c:
        d=c
    return(int(d))
def f3(a, b, c):
    d=a+b+c
    if d<0:
        d=-d
    if 0<d<10:
        return(d)
    elif 10<=d<100:
        return(d//10%10)
    elif 100<=d<1000:
        return(d//100%10)
    elif d==1000:
        return(1)
def f4(a, b, c):
    d=a+b+c
    if d<0:
        d=-d
    return(d%10)
def main():
    s1,s2,a,b,c= [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip())
# 1642036, 2022-09-24 10:33:22, ---P[PP][P-P-] (33%)

def f1(a, b, c):
    if a<=0:
        a=1001000
    elif b<=0:
        b=1001000
    elif c<=0:
        c=1001000
    d=int(a)
    if d>b:
        d=b
    if d>c:
        d=c
    return(int(d))
def f2(a, b, c):
    if a>=0:
        a=-1001000
    elif b>=0:
        b=-1001000
    elif c>=0:
        c=-1001000
    d=int(a)
    if d<b:
        d=b
    if d<c:
        d=c
    return(int(d))
def f3(a, b, c):
    d=a+b+c
    if d<0:
        d=-d
    if 0<d<10:
        return(d)
    elif 10<=d<100:
        return(d//10%10)
    elif 100<=d<1000:
        return(d//100%10)
    elif d==1000:
        return(1)
def f4(a, b, c):
    d=a+b+c
    if d<0:
        d=-d
    return(d%10)
def main():
    s1,s2,a,b,c= [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip())
# 1642254, 2022-09-24 10:36:31, PP-P[PP][P-P-] (67%)

def f1(a, b, c):
    if a<=0:
        a=1001000
    if b<=0:
        b=1001000
    if c<=0:
        c=1001000
    d=int(a)
    if d>b:
        d=b
    if d>c:
        d=c
    return(int(d))
def f2(a, b, c):
    if a>=0:
        a=-1001000
    if b>=0:
        b=-1001000
    if c>=0:
        c=-1001000
    d=int(a)
    if d<b:
        d=b
    if d<c:
        d=c
    return(int(d))
def f3(a, b, c):
    d=a+b+c
    if d<0:
        d=-d
    if 0<d<10:
        return(d)
    elif 10<=d<100:
        return(d//10%10)
    elif 100<=d<1000:
        return(d//100%10)
    elif d==1000:
        return(1)
def f4(a, b, c):
    d=a+b+c
    if d<0:
        d=-d
    return(d%10)
def main():
    s1,s2,a,b,c= [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip())
# 1642288, 2022-09-24 10:36:57, PP-P[PP][P-P-] (67%)

def f1(a, b, c):
    if a<=0:
        a=1001000
    if b<=0:
        b=1001000
    if c<=0:
        c=1001000
    d=int(a)
    if d>b:
        d=b
    if d>c:
        d=c
    return(int(d))
def f2(a, b, c):
    if a>=0:
        a=-1001000
    if b>=0:
        b=-1001000
    if c>=0:
        c=-1001000
    d=int(a)
    if d<b:
        d=b
    if d<c:
        d=c
    return(int(d))
def f3(a, b, c):
    d=a+b+c
    if d<0:
        d=-d
    if 0<d<10:
        return(d)
    if 10<=d<100:
        return(d//10%10)
    if 100<=d<1000:
        return(d//100%10)
    if d==1000:
        return(1)
def f4(a, b, c):
    d=a+b+c
    if d<0:
        d=-d
    return(d%10)
def main():
    s1,s2,a,b,c= [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip())
# 1642346, 2022-09-24 10:37:35, PP-P[PP][P-P-] (67%)

def f1(a, b, c):
    if a<=0:
        a=1001000
    if b<=0:
        b=1001000
    if c<=0:
        c=1001000
    d=int(a)
    if d>b:
        d=b
    if d>c:
        d=c
    return(int(d))
def f2(a, b, c):
    if a>=0:
        a=-1001000
    if b>=0:
        b=-1001000
    if c>=0:
        c=-1001000
    d=int(a)
    if d<b:
        d=b
    if d<c:
        d=c
    return(int(d))
def f3(a, b, c):
    d=a+b+c
    if d<0:
        d=-d
    elif 0<d<10:
        return(d)
    elif 10<=d<100:
        return(d//10%10)
    elif 100<=d<1000:
        return(d//100%10)
    elif d==1000:
        return(1)
def f4(a, b, c):
    d=a+b+c
    if d<0:
        d=-d
    return(d%10)
def main():
    s1,s2,a,b,c= [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip())

6531344721
# 1639998, 2022-09-24 09:45:19, xxPP[xP][PPPP] (50%)

def f1(a, b, c):
    d = []
    if a > 0:
        d.append(a)
    if b > 0:
        d.append(b)
    if c > 0:
        d.append(c)
    for i in range(len(d)-1):
        if int(d[i]) <= int(d[i+1]):
            min1 = d[i]
    return min1


def f2(a, b, c):
    d = []

    if a < 0:
        d.append(a)
    if b < 0:
        d.append(b)
    if c < 0:
        d.append(c)
    for i in range(len(d)-1):
        if int(d[i]) <= int(d[i+1]):
            m1 = d[i+1]
    return m1


def f3(a, b, c):
    s = a+b+c
    s = str(abs(s))
    l1 = int(s[0])
    return l1


def f4(a, b, c):
    s = a+b+c
    s = str(abs(s))
    r1 = int(s[-1])
    return r1


def main():
    t = input().split()
    s1 = int(t[0])
    s2 = int(t[1])
    a = int(t[2])
    b = int(t[3])
    c = int(t[4])
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())
# 1640308, 2022-09-24 09:53:53, xxPP[xP][PPPP] (50%)

def f1(a, b, c):
    d = []

    if a > 0:
        d.append(a)
    if b > 0:
        d.append(b)
    if c > 0:
        d.append(c)
    print(d)
    if len(d) > 1:
        for i in range(len(d)-1):
            if int(d[i]) <= int(d[i+1]):
                min1 = d[i]
    else:
        min1 = d[0]
    return min1


def f2(a, b, c):
    d = []

    if a < 0:
        d.append(a)
    if b < 0:
        d.append(b)
    if c < 0:
        d.append(c)
    if len(d)>1:
        for i in range(len(d)-1):
            if int(d[i]) <= int(d[i+1]):
                m1 = d[i+1]
    else:
        m1=d[0]
    return m1


def f3(a, b, c):
    s = a+b+c
    s = str(abs(s))
    l1 = int(s[0])
    return l1


def f4(a, b, c):
    s = a+b+c
    s = str(abs(s))
    r1 = int(s[-1])
    return r1


def main():
    t = input().split()
    s1 = int(t[0])
    s2 = int(t[1])
    a = int(t[2])
    b = int(t[3])
    c = int(t[4])
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())
# 1640540, 2022-09-24 10:00:21, xxPP[xP][PPPP] (50%)

def f1(a, b, c):
    d = []

    if a > 0:
        d.append(a)
    if b > 0:
        d.append(b)
    if c > 0:
        d.append(c)
    print(d)
    if len(d) > 1:
        for i in range(len(d)-1):
            if int(d[i]) <= int(d[i+1]):
                min1 = d[i]
    else:
        min1 = int(d[0])
    return min1


def f2(a, b, c):
    d = []

    if a < 0:
        d.append(a)
    if b < 0:
        d.append(b)
    if c < 0:
        d.append(c)
    if len(d) > 1:
        for i in range(len(d)-1):
            if int(d[i]) <= int(d[i+1]):
                m1 = d[i+1]
    else:
        m1 = int(d[0])
    return m1


def f3(a, b, c):
    s = a+b+c
    s = str(abs(s))
    l1 = int(s[0])
    return l1


def f4(a, b, c):
    s = a+b+c
    s = str(abs(s))
    r1 = int(s[-1])
    return r1


def main():
    t = input().split()
    s1 = int(t[0])
    s2 = int(t[1])
    a = int(t[2])
    b = int(t[3])
    c = int(t[4])
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())
# 1640559, 2022-09-24 10:00:53, xxPP[xP][PPPP] (50%)

def f1(a, b, c):
    d = []

    if a > 0:
        d.append(a)
    if b > 0:
        d.append(b)
    if c > 0:
        d.append(c)
    print(d)
    if len(d) > 1:
        for i in range(len(d)-1):
            if int(d[i]) <= int(d[i+1]):
                min1 = int(d[i])
    else:
        min1 = int(d[0])
    return min1


def f2(a, b, c):
    d = []

    if a < 0:
        d.append(a)
    if b < 0:
        d.append(b)
    if c < 0:
        d.append(c)
    if len(d) > 1:
        for i in range(len(d)-1):
            if int(d[i]) <= int(d[i+1]):
                m1 = int(d[i+1])
    else:
        m1 = int(d[0])
    return m1


def f3(a, b, c):
    s = a+b+c
    s = str(abs(s))
    l1 = int(s[0])
    return l1


def f4(a, b, c):
    s = a+b+c
    s = str(abs(s))
    r1 = int(s[-1])
    return r1


def main():
    t = input().split()
    s1 = int(t[0])
    s2 = int(t[1])
    a = int(t[2])
    b = int(t[3])
    c = int(t[4])
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())
# 1641453, 2022-09-24 10:22:35, xxPP[xP][PPPP] (50%)

def f1(a, b, c):
    d = []

    if a > 0:
        d.append(a)
    if b > 0:
        d.append(b)
    if c > 0:
        d.append(c)
    print(d)
    if len(d) > 1:
        for i in range(len(d)-1):
            if int(d[i]) <= int(d[i+1]):
                min1 = int(d[i])
    else:
        min1 = int(d[0])
    return int(min1)


def f2(a, b, c):
    d = []

    if a < 0:
        d.append(a)
    if b < 0:
        d.append(b)
    if c < 0:
        d.append(c)
    if len(d) > 1:
        for i in range(len(d)-1):
            if int(d[i]) <= int(d[i+1]):
                m1 = int(d[i+1])
    else:
        m1 = int(d[0])
    return int(m1)


def f3(a, b, c):
    s = a+b+c
    s = str(abs(s))
    l1 = int(s[0])
    return int(l1)


def f4(a, b, c):
    s = a+b+c
    s = str(abs(s))
    r1 = int(s[-1])
    return int(r1)


def main():
    t = input().split()
    s1 = int(t[0])
    s2 = int(t[1])
    a = int(t[2])
    b = int(t[3])
    c = int(t[4])
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())
# 1642071, 2022-09-24 10:33:59, xxPP[-x][PPPP] (50%)

def f1(a, b, c):
    d = []

    if a > 0:
        d.append(a)
    if b > 0:
        d.append(b)
    if c > 0:
        d.append(c)
    print(d)
    if len(d) == 1:
        for i in range(len(d)-1):
            if int(d[i]) <= int(d[i+1]):
                min1 = d[i]
    elif len(d)==2:
        if d[0]>d[1]:
            min1=d[1]
        elif d[0]<=d[1]:
            min1=d[0]
    elif len(d)==3:
        min1 = int(d[0])
    return min1


def f2(a, b, c):
    d = []

    if a < 0:
        d.append(a)
    if b < 0:
        d.append(b)
    if c < 0:
        d.append(c)
    if len(d) == 1:
        for i in range(len(d)-1):
            if int(d[i]) <= int(d[i+1]):
                m1 = d[i+1]
    elif len(d)==2:
        if d[0]>d[1]:
            min1=d[0]
        elif d[0]<=d[1]:
            min1=d[1]
    elif len(d)==3:
        m1 = int(d[0])
    return m1


def f3(a, b, c):
    s = a+b+c
    s = str(abs(s))
    l1 = int(s[0])
    return l1


def f4(a, b, c):
    s = a+b+c
    s = str(abs(s))
    r1 = int(s[-1])
    return r1


def main():
    t = input().split()
    s1 = int(t[0])
    s2 = int(t[1])
    a = int(t[2])
    b = int(t[3])
    c = int(t[4])
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())
# 1642165, 2022-09-24 10:35:21, -xPP[-x][PPPP] (50%)

def f1(a, b, c):
    d = []

    if a > 0:
        d.append(a)
    if b > 0:
        d.append(b)
    if c > 0:
        d.append(c)
    print(d)
    if len(d) == 3:
        for i in range(len(d)-1):
            if int(d[i]) <= int(d[i+1]):
                min1 = d[i]
    elif len(d)==2:
        if d[0]>d[1]:
            min1=d[1]
        elif d[0]<=d[1]:
            min1=d[0]
    elif len(d)==1:
        min1 = int(d[0])
    return min1


def f2(a, b, c):
    d = []

    if a < 0:
        d.append(a)
    if b < 0:
        d.append(b)
    if c < 0:
        d.append(c)
    if len(d) == 3:
        for i in range(len(d)-1):
            if int(d[i]) <= int(d[i+1]):
                m1 = d[i+1]
    elif len(d)==2:
        if d[0]>d[1]:
            min1=d[0]
        elif d[0]<=d[1]:
            min1=d[1]
    elif len(d)==1:
        m1 = int(d[0])
    return m1


def f3(a, b, c):
    s = a+b+c
    s = str(abs(s))
    l1 = int(s[0])
    return l1


def f4(a, b, c):
    s = a+b+c
    s = str(abs(s))
    r1 = int(s[-1])
    return r1


def main():
    t = input().split()
    s1 = int(t[0])
    s2 = int(t[1])
    a = int(t[2])
    b = int(t[3])
    c = int(t[4])
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())
# 1642217, 2022-09-24 10:36:03, PxPP[Px][PPPP] (67%)

def f1(a, b, c):
    d = []

    if a > 0:
        d.append(a)
    if b > 0:
        d.append(b)
    if c > 0:
        d.append(c)
    if len(d) == 3:
        for i in range(len(d)-1):
            if int(d[i]) <= int(d[i+1]):
                min1 = d[i]
    elif len(d)==2:
        if d[0]>d[1]:
            min1=d[1]
        elif d[0]<=d[1]:
            min1=d[0]
    elif len(d)==1:
        min1 = int(d[0])
    return min1


def f2(a, b, c):
    d = []

    if a < 0:
        d.append(a)
    if b < 0:
        d.append(b)
    if c < 0:
        d.append(c)
    if len(d) == 3:
        for i in range(len(d)-1):
            if int(d[i]) <= int(d[i+1]):
                m1 = d[i+1]
    elif len(d)==2:
        if d[0]>d[1]:
            min1=d[0]
        elif d[0]<=d[1]:
            min1=d[1]
    elif len(d)==1:
        m1 = int(d[0])
    return m1


def f3(a, b, c):
    s = a+b+c
    s = str(abs(s))
    l1 = int(s[0])
    return l1


def f4(a, b, c):
    s = a+b+c
    s = str(abs(s))
    r1 = int(s[-1])
    return r1


def main():
    t = input().split()
    s1 = int(t[0])
    s2 = int(t[1])
    a = int(t[2])
    b = int(t[3])
    c = int(t[4])
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())
# 1642442, 2022-09-24 10:38:44, compilation error (0%)

def f1(a, b, c):
    d = []

    if a > 0:
        d.append(a)
    if b > 0:
        d.append(b)
    if c > 0:
        d.append(c)
    if len(d) == 3:
        for i in range(len(d)-1):
            if int(d[i]) <= int(d[i+1]):
                min1 = d[i]
    elif len(d)==2:
        if d[0]=>d[1]:
            min1=d[1]
        elif d[0]<=d[1]:
            min1=d[0]
    elif len(d)==1:
        min1 = int(d[0])
    return min1


def f2(a, b, c):
    d = []

    if a < 0:
        d.append(a)
    if b < 0:
        d.append(b)
    if c < 0:
        d.append(c)
    if len(d) == 3:
        for i in range(len(d)-1):
            if int(d[i]) <= int(d[i+1]):
                m1 = d[i+1]
    elif len(d)==2:
        if d[0]=>d[1]:
            min1=d[0]
        elif d[0]<=d[1]:
            min1=d[1]
    elif len(d)==1:
        m1 = int(d[0])
    return m1


def f3(a, b, c):
    s = a+b+c
    s = str(abs(s))
    l1 = int(s[0])
    return l1


def f4(a, b, c):
    s = a+b+c
    s = str(abs(s))
    r1 = int(s[-1])
    return r1


def main():
    t = input().split()
    s1 = int(t[0])
    s2 = int(t[1])
    a = int(t[2])
    b = int(t[3])
    c = int(t[4])
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())
# 1642466, 2022-09-24 10:39:03, PxPP[Px][PPPP] (67%)

def f1(a, b, c):
    d = []

    if a > 0:
        d.append(a)
    if b > 0:
        d.append(b)
    if c > 0:
        d.append(c)
    if len(d) == 3:
        for i in range(len(d)-1):
            if int(d[i]) <= int(d[i+1]):
                min1 = d[i]
    elif len(d)==2:
        if d[0]>d[1]:
            min1=d[1]
        elif d[0]<=d[1]:
            min1=d[0]
    elif len(d)==1:
        min1 = int(d[0])
    return min1


def f2(a, b, c):
    d = []

    if a < 0:
        d.append(a)
    if b < 0:
        d.append(b)
    if c < 0:
        d.append(c)
    if len(d) == 3:
        for i in range(len(d)-1):
            if int(d[i]) <= int(d[i+1]):
                m1 = d[i+1]
    elif len(d)==2:
        if d[0]>d[1]:
            min1=d[0]
        elif d[0]<=d[1]:
            min1=d[1]
    elif len(d)==1:
        m1 = int(d[0])
    return m1


def f3(a, b, c):
    s = a+b+c
    s = str(abs(s))
    l1 = int(s[0])
    return l1


def f4(a, b, c):
    s = a+b+c
    s = str(abs(s))
    r1 = int(s[-1])
    return r1


def main():
    t = input().split()
    s1 = int(t[0])
    s2 = int(t[1])
    a = int(t[2])
    b = int(t[3])
    c = int(t[4])
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")


exec(input().strip())

6531304621
# 1639711, 2022-09-24 09:37:24, ----[xx][xxxx] (0%)

def f1(a, b, c):
    if a > 0 and b > 0:
        if a < b:
            return a
        if b < a:
            return b
    elif a > 0 and c > 0:
        if a < c:
            return a
        if c < a:
            return c
    elif b > 0 and c > 0:
        if c < b:
            return c
        if b < c:
            return b
    elif a > 0:
        return a
    elif b > 0:
        return b
    elif c > 0:
        return c


def f2(a, b, c):
    if a < 0 and b < 0:
        if a > b:
            return a
        if b > a:
            return b
    elif a < 0 and c < 0:
        if a > c:
            return a
        if c > a:
            return c
    elif b < 0 and c < 0:
        if c > b:
            return c
        if b > c:
            return b
    elif a < 0:
        return a
    elif b < 0:
        return b
    elif c < 0:
        return c


def f3(a, b, c):
    A = abs(a)
    B = abs(b)
    C = abs(c)
    return A/len(str(a))+B/len(str(b))+C/len(str(c))


def f4(a, b, c):
    A = abs(a)
    B = abs(b)
    C = abs(c)
    return A % 10 + B % 10 + C % 10


def main():
    s1, s2, a, b, c = [inte for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))


exec(input().strip())  # DON'T remove this line
# 1639948, 2022-09-24 09:43:50, --PP[--][P-P-] (33%)

def f1(a, b, c):
    if a > 0 and b > 0:
        if a < b:
            return a
        if b < a:
            return b
    elif a > 0 and c > 0:
        if a < c:
            return a
        if c < a:
            return c
    elif b > 0 and c > 0:
        if c < b:
            return c
        if b < c:
            return b
    elif a > 0:
        return a
    elif b > 0:
        return b
    elif c > 0:
        return c


def f2(a, b, c):
    if a < 0 and b < 0:
        if a > b:
            return a
        if b > a:
            return b
    elif a < 0 and c < 0:
        if a > c:
            return a
        if c > a:
            return c
    elif b < 0 and c < 0:
        if c > b:
            return c
        if b > c:
            return b
    elif a < 0:
        return a
    elif b < 0:
        return b
    elif c < 0:
        return c


def f3(a, b, c):
    return abs((a+b+c)//(10**(len(str(a+b+c))-1)))


def f4(a, b, c):
    return abs(a+b+c) % 10


def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')


exec(input().strip())  # DON'T remove this line
# 1640106, 2022-09-24 09:48:17, P-PP[--][P-P-] (50%)

def f1(a, b, c):
    if a > 0 and b > 0:
        if a <= b:
            return a
        if b <= a:
            return b
    elif a > 0 and c > 0:
        if a <= c:
            return a
        if c <= a:
            return c
    elif b > 0 and c > 0:
        if c <= b:
            return c
        if b <= c:
            return b
    elif a > 0:
        return a
    elif b > 0:
        return b
    elif c > 0:
        return c


def f2(a, b, c):
    if a < 0 and b < 0:
        if a >= b:
            return a
        if b >= a:
            return b
    elif a < 0 and c < 0:
        if a >= c:
            return a
        if c >= a:
            return c
    elif b < 0 and c < 0:
        if c > b:
            return c
        if b > c:
            return b
    elif a < 0:
        return a
    elif b < 0:
        return b
    elif c < 0:
        return c


def f3(a, b, c):
    return abs((a+b+c)//(10**(len(str(a+b+c))-1)))


def f4(a, b, c):
    return abs(a+b+c) % 10


def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')


exec(input().strip())  # DON'T remove this line
# 1640111, 2022-09-24 09:48:37, PPPP[--][P-P-] (67%)

def f1(a, b, c):
    if a > 0 and b > 0:
        if a <= b:
            return a
        if b <= a:
            return b
    elif a > 0 and c > 0:
        if a <= c:
            return a
        if c <= a:
            return c
    elif b > 0 and c > 0:
        if c <= b:
            return c
        if b <= c:
            return b
    elif a > 0:
        return a
    elif b > 0:
        return b
    elif c > 0:
        return c


def f2(a, b, c):
    if a < 0 and b < 0:
        if a >= b:
            return a
        if b >= a:
            return b
    elif a < 0 and c < 0:
        if a >= c:
            return a
        if c >= a:
            return c
    elif b < 0 and c < 0:
        if c >= b:
            return c
        if b >= c:
            return b
    elif a < 0:
        return a
    elif b < 0:
        return b
    elif c < 0:
        return c


def f3(a, b, c):
    return abs((a+b+c)//(10**(len(str(a+b+c))-1)))


def f4(a, b, c):
    return abs(a+b+c) % 10


def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')


exec(input().strip())  # DON'T remove this line
# 1641796, 2022-09-24 10:29:03, P-PP[--][P-P-] (50%)

def f1(a, b, c):
    if a > 0 and b > 0:
        if a <= b:
            return a
        if b <= a:
            return b
    elif a > 0 and c > 0:
        if a <= c:
            return a
        if c <= a:
            return c
    elif b > 0 and c > 0:
        if c <= b:
            return c
        if b <= c:
            return b
    elif a > 0:
        return a
    elif b > 0:
        return b
    elif c > 0:
        return c
    else:
        return 'Error'
def f2(a, b, c):
    if a < 0 and b < 0:
        if a >= b:
            return a
        if b >= a:
            return b
    elif a < 0 and c < 0:
        if a >= c:
            return a
        if c >= a:
            return c
    elif b < 0 and c < 0:
        if c > b:
            return c
        if b > c:
            return b
    elif a < 0:
        return a
    elif b < 0:
        return b
    elif c < 0:
        return c
    else:
        return 'Error'
        
def f3(a, b, c):
    return abs((a+b+c)//(10**(len(str(a+b+c))-1)))


def f4(a, b, c):
    return abs(a+b+c) % 10


def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')


exec(input().strip())  # DON'T remove this line
# 1641924, 2022-09-24 10:31:06, PPPP[--][P-P-] (67%)

def f1(a, b, c):
    if a > 0 and b > 0:
        if a <= b:
            return a
        if b <= a:
            return b
    elif a > 0 and c > 0:
        if a <= c:
            return a
        if c <= a:
            return c
    elif b > 0 and c > 0:
        if c <= b:
            return c
        if b <= c:
            return b
    elif a > 0:
        return a
    elif b > 0:
        return b
    elif c > 0:
        return c
    else:
        return 'Error'
def f2(a, b, c):
    if a < 0 and b < 0:
        if a >= b:
            return a
        if b >= a:
            return b
    elif a < 0 and c < 0:
        if a >= c:
            return a
        if c >= a:
            return c
    elif b < 0 and c < 0:
        if c >= b:
            return c
        if b >= c:
            return b
    elif a < 0:
        return a
    elif b < 0:
        return b
    elif c < 0:
        return c
    else:
        return 'Error'

def f3(a, b, c):
    return abs((a+b+c)//(10**(len(str(a+b+c))-1)))


def f4(a, b, c):
    return abs(a+b+c) % 10


def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')


exec(input().strip())  # DON'T remove this line
# 1641953, 2022-09-24 10:31:40, PPPP[--][P-P-] (67%)

def f1(a, b, c):
    if a > 0 and b > 0:
        if a <= b:
            return a
        if b <= a:
            return b
    elif a > 0 and c > 0:
        if a <= c:
            return a
        if c <= a:
            return c
    elif b > 0 and c > 0:
        if c <= b:
            return c
        if b <= c:
            return b
    elif a > 0:
        return a
    elif b > 0:
        return b
    elif c > 0:
        return c
    else:
        return 'Error'
def f2(a, b, c):
    if a < 0 and b < 0:
        if a >= b:
            return a
        if b >= a:
            return b
    elif a < 0 and c < 0:
        if a >= c:
            return a
        if c >= a:
            return c
    elif b < 0 and c < 0:
        if c >= b:
            return c
        if b >= c:
            return b
    elif a < 0:
        return a
    elif b < 0:
        return b
    elif c < 0:
        return c
    else:
        return 'Error'

def f3(a, b, c):
    return int(abs((a+b+c)//(10**(len(str(a+b+c))-1))))


def f4(a, b, c):
    return abs(a+b+c) % 10


def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')


exec(input().strip())  # DON'T remove this line
# 1642105, 2022-09-24 10:34:22, PPPP[--][P-P-] (67%)

def f1(a, b, c):
    if a > 0 and b > 0 and c > 0:
        if a <= b and a<= c:
            return a
        if b <= a and b<= c:
            return b
        if c <= b and c<= a:
            return c
    elif a > 0 and b > 0:
        if a <= b:
            return a
        if b <= a:
            return b
    elif a > 0 and c > 0:
        if a <= c:
            return a
        if c <= a:
            return c
    elif b > 0 and c > 0:
        if c <= b:
            return c
        if b <= c:
            return b
    elif a > 0:
        return a
    elif b > 0:
        return b
    elif c > 0:
        return c


def f2(a, b, c):
    if a < 0 and b < 0:
        if a >= b:
            return a
        if b >= a:
            return b
    elif a < 0 and c < 0:
        if a >= c:
            return a
        if c >= a:
            return c
    elif b < 0 and c < 0:
        if c >= b:
            return c
        if b >= c:
            return b
    elif a < 0:
        return a
    elif b < 0:
        return b
    elif c < 0:
        return c


def f3(a, b, c):
    return abs((a+b+c)//(10**(len(str(a+b+c))-1)))


def f4(a, b, c):
    return abs(a+b+c) % 10


def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')


exec(input().strip())  # DON'T remove this line
# 1642325, 2022-09-24 10:37:24, PPPP[--][P-P-] (67%)

def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    if a > 0 and b > 0 and c > 0:
        if a <= b and a<= c:
            return a
        if b <= a and b<= c:
            return b
        if c <= b and c<= a:
            return c
    elif a > 0 and b > 0:
        if a <= b:
            return a
        if b <= a:
            return b
    elif a > 0 and c > 0:
        if a <= c:
            return a
        if c <= a:
            return c
    elif b > 0 and c > 0:
        if c <= b:
            return c
        if b <= c:
            return b
    elif a > 0:
        return a
    elif b > 0:
        return b
    elif c > 0:
        return c


def f2(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    if a < 0 and b < 0:
        if a >= b:
            return a
        if b >= a:
            return b
    elif a < 0 and c < 0:
        if a >= c:
            return a
        if c >= a:
            return c
    elif b < 0 and c < 0:
        if c >= b:
            return c
        if b >= c:
            return b
    elif a < 0:
        return a
    elif b < 0:
        return b
    elif c < 0:
        return c


def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    return abs((a+b+c)//(10**(len(str(a+b+c))-1)))

def f4(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    return abs(a+b+c) % 10


def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')


exec(input().strip())  # DON'T remove this line

6530089521
# 1640268, 2022-09-24 09:52:33, xx--[-x][PPP-] (0%)

def f1(a, b, c):
    k=[]
    f5=a,b,c
    for i in f5 :
        if i>= 0:
            if -1000<i<1000:
                k.append(i)
                k.sort()
        return(k[-1])
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0

def f2(a, b, c):
    k=[]
    f6=a,b,c
    for i in f6:
        if i<= 0 :
            if -1000<i<1000:
                k.append(i)
                k.sort()
        return(k[1])
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
def f3(a, b, c):
    k=0
    f7=a,b,c
    for i in f7 :
        if -1000<i<1000:
            k+=i
    if k>=0:
        s =str(k)
        return(s[0])
    else:
        s = str(k)
        return(s[1])
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c

def f4(a, b, c):
    k=0
    f8=a,b,c
    for i in f8 :
        if -1000<i<1000:
            k+=i
    if k>=0:
        s =str(k)
        return(s[-1])
    else:
        s = str(k)
        return(s[-1])
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else: print('Error')
    # รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
# ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
# ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error
exec(input().strip()) # DON'T remove this line

# 1640712, 2022-09-24 10:05:13, x---[-P][PPP-] (0%)

def f1(a, b, c):
    k=[]
    f5=a,b,c
    for i in f5 :
        if i>= 0:
            if -1000<i<1000:
                k.append(i)
                k.sort()
        return(k[-1])
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0

def f2(a, b, c):
    k=[]
    f6=a,b,c
    f6=sorted(f6)
    for i in f6 :
        if i <=0:
            k.append(i)
    return k[-1]
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
def f3(a, b, c):
    k=0
    f7=a,b,c
    for i in f7 :
        if -1000<i<1000:
            k+=i
    if k>=0:
        s =str(k)
        return(s[0])
    else:
        s = str(k)
        return(s[1])
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c

def f4(a, b, c):
    k=0
    f8=a,b,c
    for i in f8 :
        if -1000<i<1000:
            k+=i
    if k>=0:
        s =str(k)
        return(s[-1])
    else:
        s = str(k)
        return(s[-1])
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else: print('Error')
    # รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
# ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
# ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error
exec(input().strip()) # DON'T remove this line

# 1640841, 2022-09-24 10:08:14, x---[-P][PPP-] (0%)

def f1(a, b, c):
    k=[]
    f5=a,b,c
    for i in f5 :
        if i>= 0:
            if -1000<i<1000:
                k.append(i)
                k.sort()
        return(k[-1])
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0

def f2(a, b, c):
    k=[]
    f6=a,b,c
    f6=sorted(f6)
    for i in f6 :
        if i <=0 and -1000<i<1000:
            k.append(i)
    return k[-1]
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
def f3(a, b, c):
    k=0
    f7=a,b,c
    for i in f7 :
        if -1000<i<1000:
            k+=i
    if k>=0:
        s =str(k)
        return(s[0])
    else:
        s = str(k)
        return(s[1])
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c

def f4(a, b, c):
    k=0
    f8=a,b,c
    for i in f8 :
        if -1000<i<1000:
            k+=i
    if k>=0:
        s =str(k)
        return(s[-1])
    else:
        s = str(k)
        return(s[-1])
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else: print('Error')
    # รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
# ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
# ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error
exec(input().strip()) # DON'T remove this line

# 1641751, 2022-09-24 10:28:16, x---[-P][PPP-] (0%)

def f1(a, b, c):
    k=[]
    f5=a,b,c
    for i in f5 :
        if i>= 0:
            if -1000<i<1000:
                k.append(i)
                k.sort()
        return(k[-1])
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0

def f2(a, b, c):
    k=[]
    f6=a,b,c
    f6=sorted(f6)
    for i in f6 :
        if i <=0 and -1000<i<1000:
            k.append(i)
    return k[-1]
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
def f3(a, b, c):
    k=0
    f7=a,b,c
    for i in f7 :
        if -1000<i<1000:
            k+=i
    if k>=0:
        s =str(k)
        return(s[0])
    else:
        s = str(k)
        return(s[1])
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c

def f4(a, b, c):
    k=0
    f8=a,b,c
    for i in f8 :
        if -1000<i<1000:
            k+=i
    s = str(k)
    return(s[-1])
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else: print('Error')
    # รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
# ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
# ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error
exec(input().strip()) # DON'T remove this line

# 1641785, 2022-09-24 10:28:59, x---[-P][PPP-] (0%)

def f1(a, b, c):
    k=[]
    f5=a,b,c
    for i in f5 :
        if i>= 0:
            if -1000<i<1000:
                k.append(i)
                k.sort()
        return(k[-1])
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0

def f2(a, b, c):
    k=[]
    f6=a,b,c
    f6=sorted(f6)
    for i in f6 :
        if i <=0 and -1000<i<1000:
            k.append(i)
    return k[-1]
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
def f3(a, b, c):
    k=0
    f7=a,b,c
    for i in f7 :
        if -1000<i<1000:
            k+=i
    if k>=0:
        s =str(k)
        return(int(s[0]))
    else:
        s = str(k)
        return(int(s[1]))
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c

def f4(a, b, c):
    k=0
    f8=a,b,c
    for i in f8 :
        if -1000<i<1000:
            k+=i
    s = str(k)
    return(int(s[-1]))
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else: print('Error')
    # รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
# ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
# ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error
exec(input().strip()) # DON'T remove this line

# 1641854, 2022-09-24 10:29:59, xP--[-P][PPP-] (17%)

def f1(a, b, c):
    k=[]
    f5=a,b,c
    for i in f5 :
        if i>= 0:
            if -1000<i<1000:
                k.append(i)
                k.sort()
        return(k[-1])
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0

def f2(a, b, c):
    k=[]
    f6=a,b,c
    f6=sorted(f6)
    for i in f6 :
        if i <0 :
            k.append(i)
    return k[-1]
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
def f3(a, b, c):
    k=0
    f7=a,b,c
    for i in f7 :
        if -1000<i<1000:
            k+=i
    if k>=0:
        s =str(k)
        return(int(s[0]))
    else:
        s = str(k)
        return(int(s[1]))
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c

def f4(a, b, c):
    k=0
    f8=a,b,c
    for i in f8 :
        if -1000<i<1000:
            k+=i
    s = str(k)
    return(int(s[-1]))
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else: print('Error')
    # รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
# ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
# ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error
exec(input().strip()) # DON'T remove this line

# 1641904, 2022-09-24 10:30:48, xPP-[-P][PPPP] (50%)

def f1(a, b, c):
    k=[]
    f5=a,b,c
    for i in f5 :
        if i> 0:
            if -1000<i<1000:
                k.append(i)
                k.sort()
        return(k[-1])
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0

def f2(a, b, c):
    k=[]
    f6=a,b,c
    f6=sorted(f6)
    for i in f6 :
        if i <0 :
            k.append(i)
    return k[-1]
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
def f3(a, b, c):
    k=0
    f7=a,b,c
    for i in f7 :
        k+=i
    if k>=0:
        s =str(k)
        return(int(s[0]))
    else:
        s = str(k)
        return(int(s[1]))
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c

def f4(a, b, c):
    k=0
    f8=a,b,c
    for i in f8 :
        if -1000<i<1000:
            k+=i
    s = str(k)
    return(int(s[-1]))
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else: print('Error')
    # รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
# ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
# ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error
exec(input().strip()) # DON'T remove this line

# 1641955, 2022-09-24 10:31:43, xPPP[-P][PPPP] (67%)

def f1(a, b, c):
    k=[]
    f5=a,b,c
    for i in f5 :
        if i> 0:
            if -1000<i<1000:
                k.append(i)
                k.sort()
        return(k[-1])
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0

def f2(a, b, c):
    k=[]
    f6=a,b,c
    f6=sorted(f6)
    for i in f6 :
        if i <0 :
            k.append(i)
    return k[-1]
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
def f3(a, b, c):
    k=0
    f7=a,b,c
    for i in f7 :
        k+=i
    if k>=0:
        s =str(k)
        return(int(s[0]))
    else:
        s = str(k)
        return(int(s[1]))
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c

def f4(a, b, c):
    k=0
    f8=a,b,c
    for i in f8 :
        k+=i
    s = str(k)
    return(int(s[-1]))
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else: print('Error')
    # รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
# ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
# ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error
exec(input().strip()) # DON'T remove this line


6530185021
# 1639514, 2022-09-24 09:32:06, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    if a>0 and b>0:
        return min(a,b)
    elif a>0 and c>0:
        return min(a,c)
    elif b>0 and c>0:
        return min(b,c)
    elif a>0:
        return a
    elif b>0:
        return b
    elif c>0:
        return c
    
def f2(a, b, c):
    if a<0 and b<0:
        return max(a,b)
    elif a<0 and c<0:
        return max(a,c)
    elif b<0 and c<0:
        return max(b,c)
    elif a<0:
        return a
    elif b<0:
        return b
    elif c<0:
        return c
    
def f3(a, b, c):
    sum = str(abs(a+b+c))
    return sum[0]

def f4(a, b, c):
    sum = str(abs(a+b+c))
    return sum[-1]

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
    
exec(input().strip())
# 1639599, 2022-09-24 09:34:28, PP--[PP][PPP-] (50%)

def f1(a, b, c):
    if a>0 and b>0:
        return min(a,b)
    elif a>0 and c>0:
        return min(a,c)
    elif b>0 and c>0:
        return min(b,c)
    elif a>0:
        return a
    elif b>0:
        return b
    elif c>0:
        return c
    
def f2(a, b, c):
    if a<0 and b<0:
        return max(a,b)
    elif a<0 and c<0:
        return max(a,c)
    elif b<0 and c<0:
        return max(b,c)
    elif a<0:
        return a
    elif b<0:
        return b
    elif c<0:
        return c
    
def f3(a, b, c):
    sum = str(a+b+c)
    return sum[0]

def f4(a, b, c):
    sum = str(a+b+c)
    return sum[-1]

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
    
exec(input().strip())
# 1639609, 2022-09-24 09:34:40, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    if a>0 and b>0:
        return min(a,b)
    elif a>0 and c>0:
        return min(a,c)
    elif b>0 and c>0:
        return min(b,c)
    elif a>0:
        return a
    elif b>0:
        return b
    elif c>0:
        return c
    
def f2(a, b, c):
    if a<0 and b<0:
        return max(a,b)
    elif a<0 and c<0:
        return max(a,c)
    elif b<0 and c<0:
        return max(b,c)
    elif a<0:
        return a
    elif b<0:
        return b
    elif c<0:
        return c
    
def f3(a, b, c):
    sum = str(abs(a+b+c))
    return sum[0]

def f4(a, b, c):
    sum = str(abs(a+b+c))
    return sum[-1]

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
    
exec(input().strip())
    
# 1641413, 2022-09-24 10:21:48, P---[P-][PPPP] (33%)

def f1(a, b, c):
    if a>0 and b>0:
        return min(a,b)
    elif a>0 and c>0:
        return min(a,c)
    elif b>0 and c>0:
        return min(b,c)
    elif a>0:
        return a
    elif b>0:
        return b
    elif c>0:
        return c
    
def f2(a, b, c):
    if a<0 and b<0:
        return min(a,b)
    elif a<0 and c<0:
        return max(a,c)
    elif b<0 and c<0:
        return max(b,c)
    elif a<0:
        return a
    elif b<0:
        return b
    elif c<0:
        return c
    
def f3(a, b, c):
    sum = str(abs(a+b+c))
    return sum[0]

def f4(a, b, c):
    sum = str(abs(a+b+c))
    return sum[-1]

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
    
exec(input().strip())
# 1641423, 2022-09-24 10:22:00, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    if a>0 and b>0:
        return min(a,b)
    elif a>0 and c>0:
        return min(a,c)
    elif b>0 and c>0:
        return min(b,c)
    elif a>0:
        return a
    elif b>0:
        return b
    elif c>0:
        return c
    
def f2(a, b, c):
    if a<0 and b<0:
        return max(a,b)
    elif a<0 and c<0:
        return max(a,c)
    elif b<0 and c<0:
        return max(b,c)
    elif a<0:
        return a
    elif b<0:
        return b
    elif c<0:
        return c
    
def f3(a, b, c):
    sum = str(abs(a+b+c))
    return sum[0]

def f4(a, b, c):
    sum = str(abs(a+b+c))
    return sum[-1]

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
    
exec(input().strip())
# 1641439, 2022-09-24 10:22:18, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    if a>0 and b>0:
        return min(a,b)
    elif a>0 and c>0:
        return min(a,c)
    elif b>0 and c>0:
        return min(b,c)
    elif a>0:
        return a
    elif b>0:
        return b
    elif c>0:
        return c
    
def f2(a, b, c):
    if a<0 and b<0:
        return max(a,b)
    elif a<0 and c<0:
        return max(a,c)
    elif b<0 and c<0:
        return max(b,c)
    elif a<0:
        return a
    elif b<0:
        return b
    elif c<0:
        return c
    
def f3(a, b, c):
    sum = str(abs(a+b+c))
    return sum[0]

def f4(a, b, c):
    sum = str(a+b+c)
    return sum[-1]

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
    
exec(input().strip())
# 1641509, 2022-09-24 10:23:54, PP-x[PP][PPPP] (67%)

def f1(a, b, c):
    if a>0 and b>0:
        return min(a,b)
    elif a>0 and c>0:
        return min(a,c)
    elif b>0 and c>0:
        return min(b,c)
    elif a>0:
        return a
    elif b>0:
        return b
    elif c>0:
        return c
    
def f2(a, b, c):
    if a<0 and b<0:
        return max(a,b)
    elif a<0 and c<0:
        return max(a,c)
    elif b<0 and c<0:
        return max(b,c)
    elif a<0:
        return a
    elif b<0:
        return b
    elif c<0:
        return c
    
def f3(a, b, c):
    sum = str(abs(a+b+c))
    return sum[0]

def f4(a, b, c):
    sum = str(a+b+c)
    return abs(sum[-1])

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
    
exec(input().strip())
# 1641523, 2022-09-24 10:24:09, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    if a>0 and b>0:
        return min(a,b)
    elif a>0 and c>0:
        return min(a,c)
    elif b>0 and c>0:
        return min(b,c)
    elif a>0:
        return a
    elif b>0:
        return b
    elif c>0:
        return c
    
def f2(a, b, c):
    if a<0 and b<0:
        return max(a,b)
    elif a<0 and c<0:
        return max(a,c)
    elif b<0 and c<0:
        return max(b,c)
    elif a<0:
        return a
    elif b<0:
        return b
    elif c<0:
        return c
    
def f3(a, b, c):
    sum = str(abs(a+b+c))
    return sum[0]

def f4(a, b, c):
    sum = str(a+b+c)
    return sum[-1]

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
    
exec(input().strip())

6530212321
# 1639373, 2022-09-24 09:28:45, --x-[PP][PxPP] (17%)

def f1(a, b, c):
    x = []
    x.append(a)
    x.append(b)
    x.append(c)
    for e in x :
        if e < 0 :
            x.remove(e)
    x.sort()
    return(x[0])

def f2(a, b, c):
    x = []
    x.append(a)
    x.append(b)
    x.append(c)
    for e in x :
        if e > 0 :
            x.remove(e)
    x.sort()
    return(x[-1])

def f3(a, b, c):
    best = a + b + c
    if best < 0 :
        best = str(best)
        best = best[1::]
    return(best[0])

def f4(a, b, c):
    best = a + b + c
    if best < 0 :
        best = str(best)
        best = best[1::]
    return(best[-1])

def main():
    x = input().split()
    s1 = int(x[0]) ; s2 = int(x[1]) ; a = int(x[2]) ; \
         b = int(x[3]) ; c = int(x[4])
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')

exec(input().strip()) # DON'T remove this line
# 1640266, 2022-09-24 09:52:29, --x-[PP][PxPP] (17%)

def f1(a, b, c):
    x = []
    x.append(a)
    x.append(b)
    x.append(c)
    for e in x :
        if e < 0 :
            x.remove(e)
    for e in x :
        if e < 0 :
            x.remove(e)
    x.sort()
    return(x[0])

def f2(a, b, c):
    x = []
    x.append(a)
    x.append(b)
    x.append(c)
    for e in x :
        if e > 0 :
            x.remove(e)
    for e in x :
        if e > 0 :
            x.remove(e)
    x.sort()
    return(x[-1])

def f3(a, b, c):
    best = a + b + c
    if best < 0 :
        best = str(best)
        best = best[1::]
    return(best[0])

def f4(a, b, c):
    best = a + b + c
    if best < 0 :
        best = str(best)
        best = best[1::]
    return(best[-1])

def main():
    x = input().split()
    s1 = int(x[0]) ; s2 = int(x[1]) ; a = int(x[2]) ; \
         b = int(x[3]) ; c = int(x[4])
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')

exec(input().strip()) # DON'T remove this line
# 1640482, 2022-09-24 09:59:01, --x-[PP][PxPP] (17%)

def f1(a, b, c):
    x = []
    x.append(a)
    x.append(b)
    x.append(c) ; y = []
    for e in x :
        if e < 0 :
            y.append(e)
    ans = []
    for i in range(len(x)) :
        if x[i] not in y :
            ans.append(x[i])
    ans.sort()
    return(ans[0])

def f2(a, b, c):
    x = []
    x.append(a)
    x.append(b)
    x.append(c) ; y = []
    for e in x :
        if e > 0 :
            y.append(e)
    ans = []
    for i in range(len(x)) :
        if x[i] not in y :
            ans.append(x[i])
    ans.sort()
    return(ans[-1])
    

def f3(a, b, c):
    best = a + b + c
    if best < 0 :
        best = str(best)
        best = best[1::]
    return(best[0])

def f4(a, b, c):
    best = a + b + c
    if best < 0 :
        best = str(best)
        best = best[1::]
    return(best[-1])

def main():
    x = input().split()
    s1 = int(x[0]) ; s2 = int(x[1]) ; a = int(x[2]) ; \
         b = int(x[3]) ; c = int(x[4])
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')

exec(input().strip()) # DON'T remove this line
# 1640654, 2022-09-24 10:03:47, --xP[PP][PxPP] (33%)

def f1(a, b, c):
    x = []
    x.append(a)
    x.append(b)
    x.append(c) ; y = []
    for e in x :
        if e < 0 :
            y.append(e)
    ans = []
    for i in range(len(x)) :
        if x[i] not in y :
            ans.append(x[i])
    ans.sort()
    return(ans[0])

def f2(a, b, c):
    x = []
    x.append(a)
    x.append(b)
    x.append(c) ; y = []
    for e in x :
        if e > 0 :
            y.append(e)
    ans = []
    for i in range(len(x)) :
        if x[i] not in y :
            ans.append(x[i])
    ans.sort()
    return(ans[-1])
    

def f3(a, b, c):
    best = a + b + c
    if best < 0 :
        best = str(best)
        best = best[1::]
    return(int(best[0]))

def f4(a, b, c):
    best = a + b + c
    if best < 0 :
        best = str(best)
        best = best[1::]
    return(int(best[-1]))

def main():
    x = input().split()
    s1 = int(x[0]) ; s2 = int(x[1]) ; a = int(x[2]) ; \
         b = int(x[3]) ; c = int(x[4])
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')

exec(input().strip()) # DON'T remove this line
# 1640817, 2022-09-24 10:07:48, ---P[PP][PPPP] (50%)

def f1(a, b, c):
    x = []
    x.append(a)
    x.append(b)
    x.append(c) ; y = []
    for e in x :
        if e < 0 :
            y.append(e)
    ans = []
    for i in range(len(x)) :
        if x[i] not in y :
            ans.append(x[i])
    ans.sort()
    return(ans[0])

def f2(a, b, c):
    x = []
    x.append(a)
    x.append(b)
    x.append(c) ; y = []
    for e in x :
        if e > 0 :
            y.append(e)
    ans = []
    for i in range(len(x)) :
        if x[i] not in y :
            ans.append(x[i])
    ans.sort()
    return(ans[-1])
    

def f3(a, b, c):
    best = a + b + c
    if best < 0 :
        best = str(best)
        best = best[1::]
        return(int(best[0]))
    else :
        best = str(best)
        return(best[0])

def f4(a, b, c):
    best = a + b + c
    if best < 0 :
        best = str(best)
        best = best[1::]
        return(int(best[-1]))
    else :
        best = str(best)
        return(best[-1])

def main():
    x = input().split()
    s1 = int(x[0]) ; s2 = int(x[1]) ; a = int(x[2]) ; \
         b = int(x[3]) ; c = int(x[4])
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')

exec(input().strip()) # DON'T remove this line
# 1641534, 2022-09-24 10:24:22, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    x = []
    x.append(a)
    x.append(b)
    x.append(c) ; y = []
    for e in x :
        if e < 0 :
            y.append(e)
    ans = []
    for i in range(len(x)) :
        if x[i] not in y :
            ans.append(x[i])
    ans.sort()
    return(ans[0])

def f2(a, b, c):
    x = []
    x.append(a)
    x.append(b)
    x.append(c) ; y = []
    for e in x :
        if e > 0 :
            y.append(e)
    ans = []
    for i in range(len(x)) :
        if x[i] not in y :
            ans.append(x[i])
    ans.sort()
    return(ans[-1])
    

def f3(a, b, c):
    best = a + b + c
    if best < 0 :
        best = str(best)
        best = best[1::]
        return(int(best[0]))
    else :
        best = str(best)
        return(int(best[0]))

def f4(a, b, c):
    best = a + b + c
    if best < 0 :
        best = str(best)
        best = best[1::]
        return(int(best[-1]))
    else :
        best = str(best)
        return(int(best[-1]))

def main():
    x = input().split()
    s1 = int(x[0]) ; s2 = int(x[1]) ; a = int(x[2]) ; \
         b = int(x[3]) ; c = int(x[4])
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')

exec(input().strip()) # DON'T remove this line
# 1641925, 2022-09-24 10:31:06, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    x = []
    x.append(a)
    x.append(b)
    x.append(c) ; y = []
    for e in x :
        if e < 0 :
            y.append(e)
    ans = []
    for i in range(len(x)) :
        if x[i] not in y :
            ans.append(x[i])
    ans.sort()
    return(ans[0])

def f2(a, b, c):
    x = []
    x.append(a)
    x.append(b)
    x.append(c) ; y = []
    for e in x :
        if e > 0 :
            y.append(e)
    ans = []
    for i in range(len(x)) :
        if x[i] not in y :
            ans.append(x[i])
    ans.sort()
    return(ans[-1])
    

def f3(a, b, c):
    best = a + b + c
    if best < 0 :
        best = abs(best)
        best = str(best)
        return(int(best[0]))
    else :
        best = str(best)
        return(int(best[0]))

def f4(a, b, c):
    best = a + b + c
    if best < 0 :
        best = abs(best)
        best = str(best)
        return(int(best[-1]))
    else :
        best = str(best)
        return(int(best[-1]))

def main():
    x = input().split()
    s1 = int(x[0]) ; s2 = int(x[1]) ; a = int(x[2]) ; \
         b = int(x[3]) ; c = int(x[4])
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')

exec(input().strip()) # DON'T remove this line
# 1642053, 2022-09-24 10:33:36, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    x = []
    x.append(a)
    x.append(b)
    x.append(c) ; y = []
    for e in x :
        if e < 0 :
            y.append(e)
    ans = []
    for i in range(len(x)) :
        if x[i] not in y :
            ans.append(x[i])
    ans.sort()
    return(int(ans[0]))

def f2(a, b, c):
    x = []
    x.append(a)
    x.append(b)
    x.append(c) ; y = []
    for e in x :
        if e > 0 :
            y.append(e)
    ans = []
    for i in range(len(x)) :
        if x[i] not in y :
            ans.append(x[i])
    ans.sort()
    return(int(ans[-1]))
    

def f3(a, b, c):
    best = a + b + c
    if best < 0 :
        best = abs(best)
        best = str(best)
        return(int(best[0]))
    else :
        best = str(best)
        return(int(best[0]))

def f4(a, b, c):
    best = a + b + c
    if best < 0 :
        best = abs(best)
        best = str(best)
        return(int(best[-1]))
    else :
        best = str(best)
        return(int(best[-1]))

def main():
    x = input().split()
    s1 = int(x[0]) ; s2 = int(x[1]) ; a = int(x[2]) ; \
         b = int(x[3]) ; c = int(x[4])
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print('Error')

exec(input().strip()) # DON'T remove this line

6530040721
# 1639471, 2022-09-24 09:31:14, compilation error (0%)

def f1(a, b, c):
    if a < 0 and b < 0 and c <0:
        return min(a,b,c)
    elif a<0 and b<0 :
        return min(a,b)
    elif a<0 and c<0 :
        return min(a,c)
    elif b<0 and c<0:
        return min(b,c)
    else:
        pass
def f2(a, b, c):
    if a < 0 and b < 0 and c <0:
        return int(max(a,b,c))
    elif a<0 and b<0 :
        return int(max(a,b))
    elif a<0 and c<0 :
        return int(max(a,c))
    elif b<0 and c<0:
        return int(max(b,c))
    else:
        pass
def f3(a, b, c):
    z = str(a+b+c)
    return int(z[0])
def f4(a, b, c):
    x = str(a+b+c)
    return int(z[-1])

def main():
    z = [int(e) for e in input().split()]
    s1,s2,a,b,c = z[0],z[1],z[2],z[3],z[4]
    if s1 == 0 and s2 ==0:
        print f1(a, b, c)
    if s1 == 0 and s2 ==1:
        print f2(a, b, c)
    if s1 == 1 and s2 ==0:
        print f3(a, b, c)
    if s1 == 1 and s2 ==1:
        print f4(a, b, c)
    else:
        print('Error')

exec(input().strip()) # DON'T remove this line
# 1639553, 2022-09-24 09:33:15, --xx[--][P-Px] (0%)

def f1(a, b, c):
    if a < 0 and b < 0 and c <0:
        return min(a,b,c)
    elif a<0 and b<0 :
        return min(a,b)
    elif a<0 and c<0 :
        return min(a,c)
    elif b<0 and c<0:
        return min(b,c)
    else:
        pass
def f2(a, b, c):
    if a < 0 and b < 0 and c <0:
        return int(max(a,b,c))
    elif a<0 and b<0 :
        return int(max(a,b))
    elif a<0 and c<0 :
        return int(max(a,c))
    elif b<0 and c<0:
        return int(max(b,c))
    else:
        pass
def f3(a, b, c):
    z = str(a+b+c)
    return int(z[0])
def f4(a, b, c):
    x = str(a+b+c)
    return int(z[-1])

def main():
    z = [int(e) for e in input().split()]
    s1,s2,a,b,c = z[0],z[1],z[2],z[3],z[4]
    if s1 == 0 and s2 ==0:
        print (f1(a, b, c))
    if s1 == 0 and s2 ==1:
        print (f2(a, b, c))
    if s1 == 1 and s2 ==0:
        print (f3(a, b, c))
    if s1 == 1 and s2 ==1:
        print (f4(a, b, c))
    else:
        print('Error')

exec(input().strip()) # DON'T remove this line

# 1639708, 2022-09-24 09:37:21, P-xx[--][P-Px] (17%)

def f1(a, b, c):
    z = [a,b,c]
    z0 = []
    for i in z:
        if i > 0:
            z0.append(i)
    return int(min(z0))
def f2(a, b, c):
    z = [a,b,c]
    z0 = []
    for i in z:
        if i < 0:
            z0.append(i)
    return int(min(z0))
def f3(a, b, c):
    z = str(a+b+c)
    return int(z[0])
def f4(a, b, c):
    x = str(a+b+c)
    return int(z[-1])

def main():
    z = [int(e) for e in input().split()]
    s1,s2,a,b,c = z[0],z[1],z[2],z[3],z[4]
    if s1 == 0 and s2 ==0:
        print (f1(a, b, c))
    if s1 == 0 and s2 ==1:
        print (f2(a, b, c))
    if s1 == 1 and s2 ==0:
        print (f3(a, b, c))
    if s1 == 1 and s2 ==1:
        print (f4(a, b, c))
    else:
        print('Error')

exec(input().strip()) # DON'T remove this line

# 1640118, 2022-09-24 09:48:55, PPPP[--][P-P-] (67%)

def f1(a, b, c):
    z = [a,b,c]
    z0 = []
    for i in z:
        if i > 0:
            z0.append(i)
    return int(min(z0))
def f2(a, b, c):
    z = [a,b,c]
    z0 = []
    for i in z:
        if i < 0:
            z0.append(i)
    return int(max(z0))

def f3(a, b, c):
    z = str(abs(a+b+c))
    return int(z[0])

def f4(a, b, c):
    z = str(abs(a+b+c))
    return int(z[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 ==0:
        print (f1(a, b, c))
    if s1 == 0 and s2 ==1:
        print (f2(a, b, c))
    if s1 == 1 and s2 ==0:
        print (f3(a, b, c))
    if s1 == 1 and s2 ==1:
        print (f4(a, b, c))
    else:
        print('Error')

exec(input().strip()) # DON'T remove this line
# 1640394, 2022-09-24 09:56:40, PPPP[--][P-P-] (67%)

def f1(a, b, c):
    z = [a,b,c]
    z0 = []
    for i in z:
        if i > 0:
            z0.append(i)
    if z0 == [] :
        pass
    else:
        return int(min(z0))
def f2(a, b, c):
    z = [a,b,c]
    z0 = []
    for i in z:
        if i < 0:
            z0.append(i)
    if z0 == []:
        pass
    else:
        return int(max(z0))

def f3(a, b, c):
    z = str(abs(a+b+c))
    return int(z[0])

def f4(a, b, c):
    z = str(abs(a+b+c))
    return int(z[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 ==0:
        print (f1(a, b, c))
    if s1 == 0 and s2 ==1:
        print (f2(a, b, c))
    if s1 == 1 and s2 ==0:
        print (f3(a, b, c))
    if s1 == 1 and s2 ==1:
        print (f4(a, b, c))
    else:
        print('Error')

exec(input().strip()) # DON'T remove this line

# 1641291, 2022-09-24 10:19:20, --PP[--][P-P-] (33%)

def f1(a, b, c):
    z = [a,b,c]
    z0 = []
    for i in z:
        if i >= 0:
            z0.append(i)
    if z0 == [] :
        pass
    else:
        return int(min(z0))
def f2(a, b, c):
    z = [a,b,c]
    z0 = []
    for i in z:
        if i <= 0:
            z0.append(i)
    if z0 == []:
        pass
    else:
        return int(max(z0))

def f3(a, b, c):
    z = str(abs(a+b+c))
    return int(z[0])

def f4(a, b, c):
    z = str(abs(a+b+c))
    return int(z[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 ==0:
        print (f1(a, b, c))
    if s1 == 0 and s2 ==1:
        print (f2(a, b, c))
    if s1 == 1 and s2 ==0:
        print (f3(a, b, c))
    if s1 == 1 and s2 ==1:
        print (f4(a, b, c))
    else:
        print('Error')

exec(input().strip()) # DON'T remove this line
# 1641298, 2022-09-24 10:19:28, PPPP[--][P-P-] (67%)

def f1(a, b, c):
    z = [a,b,c]
    z0 = []
    for i in z:
        if i > 0:
            z0.append(i)
    if z0 == [] :
        pass
    else:
        return int(min(z0))
def f2(a, b, c):
    z = [a,b,c]
    z0 = []
    for i in z:
        if i < 0:
            z0.append(i)
    if z0 == []:
        pass
    else:
        return int(max(z0))

def f3(a, b, c):
    z = str(abs(a+b+c))
    return int(z[0])

def f4(a, b, c):
    z = str(abs(a+b+c))
    return int(z[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 ==0:
        print (f1(a, b, c))
    if s1 == 0 and s2 ==1:
        print (f2(a, b, c))
    if s1 == 1 and s2 ==0:
        print (f3(a, b, c))
    if s1 == 1 and s2 ==1:
        print (f4(a, b, c))
    else:
        print('Error')

exec(input().strip()) # DON'T remove this line

6530069021
# 1641322, 2022-09-24 10:19:56, ----[--][----] (0%)

def f1(a,b,c):
    a =int(a)
    b =int(b)
    c =int(c)
    d=[]
    if a >= 0:
        d += [a]
    if b >= 0:
        d += [b]
    if c >= 0:
        d += [c]
    d.sort()
    return(d[0])
def f2(a,b,c):
    a =int(a)
    b =int(b)
    c =int(c)
    d=[]
    if a <= 0:
        d += [a]
    if b <= 0:
        d += [b]
    if c <= 0:
        d += [c]
    d.sort()
    g = d[::-1]
    return(g[0])
def f3(a,b,c):
    a =int(a)
    b =int(b)
    c =int(c)
    d = a+b+c
    j=0
    if d > 0:
        j +=d
    else:
        if d <0:
            j =+ -d
    return (j % 100)

# 1641346, 2022-09-24 10:20:23, ---x[xx][xxxx] (0%)

def f1(a,b,c):
    a =int(a)
    b =int(b)
    c =int(c)
    d=[]
    if a >= 0:
        d += [a]
    if b >= 0:
        d += [b]
    if c >= 0:
        d += [c]
    d.sort()
    return(d[0])
def f2(a,b,c):
    a =int(a)
    b =int(b)
    c =int(c)
    d=[]
    if a <= 0:
        d += [a]
    if b <= 0:
        d += [b]
    if c <= 0:
        d += [c]
    d.sort()
    g = d[::-1]
    return(g[0])
def f3(a,b,c):
    a =int(a)
    b =int(b)
    c =int(c)
    d = a+b+c
    j=0
    if d > 0:
        j +=d
    else:
        if d <0:
            j =+ -d
    return (j % 100)
exec(input().strip()) # DON'T remove this line


# 1641972, 2022-09-24 10:32:10, ---P[xx][xxxx] (17%)

def f1(a,b,c):
    a =int(a)
    b =int(b)
    c =int(c)
    d=[]
    if a >= 0:
        d += [a]
    if b >= 0:
        d += [b]
    if c >= 0:
        d += [c]
    d.sort()
    return(d[0])
def f2(a,b,c):
    a =int(a)
    b =int(b)
    c =int(c)
    d=[]
    if a <= 0:
        d += [a]
    if b <= 0:
        d += [b]
    if c <= 0:
        d += [c]
    d.sort()
    g = d[::-1]
    return(g[0])
def f3(a,b,c):
    a =int(a)
    b =int(b)
    c =int(c)
    d = a+b+c
    if d >0:
        d=d
    else:
        if d<0:
            d= (-1)*d
    return (d // 10)
def f4(a,b,c):
    a =int(a)
    b =int(b)
    c =int(c)
    d = a+b+c
    if d >0:
        d=d
    else:
        if d<0:
            d= (-1)*d
    return (d % 10)
exec(input().strip()) # DON'T remove this line

# 1642237, 2022-09-24 10:36:19, ---P[PP][P-P-] (33%)

def f1(a,b,c):
    a =int(a)
    b =int(b)
    c =int(c)
    d=[]
    if a >= 0:
        d += [a]
    if b >= 0:
        d += [b]
    if c >= 0:
        d += [c]
    d.sort()
    return(d[0])
def f2(a,b,c):
    a =int(a)
    b =int(b)
    c =int(c)
    d=[]
    if a <= 0:
        d += [a]
    if b <= 0:
        d += [b]
    if c <= 0:
        d += [c]
    d.sort()
    g = d[::-1]
    return(g[0])
def f3(a,b,c):
    a =int(a)
    b =int(b)
    c =int(c)
    d = a+b+c
    if d >0:
        d=d
    else:
        if d<0:
            d= (-1)*d
    return (d // 10)
def f4(a,b,c):
    a =int(a)
    b =int(b)
    c =int(c)
    d = a+b+c
    if d >0:
        d=d
    else:
        if d<0:
            d= (-1)*d
    return (d % 10)
def main():
    x = input().split()
    s1 = int(x[0])
    s2 = int(x[1])
    a = int(x[2])
    b = int(x[3])
    c = int(x[4])
    if s1==0 and s2 ==0:
        print(f1(a,b,c))
    elif s1==0 and s2 ==1:
        print(f2(a,b,c))
    elif s1==1 and s2 ==0:
        print(f3(a,b,c))
    elif s1==1 and s2 ==1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1642323, 2022-09-24 10:37:23, ----[--][----] (0%)

def f1(a,b,c):
    a =int(a)
    b =int(b)
    c =int(c)
    d=[]
    if a > 0:
        d += [a]
    if b > 0:
        d += [b]
    if c > 0:
        d += [c]
    d.sort()
    return(d[0])
def f2(a,b,c):
    a =int(a)
    b =int(b)
    c =int(c)
    d=[]
    if a < 0:
        d += [a]
    if b < 0:
        d += [b]
    if c < 0:
        d += [c]
    d.sort()
    g = d[::-1]
    return(g[0])
def f3(a,b,c):
    a =int(a)
    b =int(b)
    c =int(c)
    d = a+b+c
    if d >0:
        d=d
    else:
        if d<0:
            d= (-1)*d
    return (d // 10)
def f4(a,b,c):
    a =int(a)
    b =int(b)
    c =int(c)
    d = a+b+c
    if d >0:
        d=d
    else:
        if d<0:
            d= (-1)*d
    return (d % 10)
def main():
    x = input().split()
    s1 = int(x[0])
    s2 = int(x[1])
    a = int(x[2])
    b = int(x[3])
    c = int(x[4])
    if s1==0 and s2 ==0:
        print(f1(a,b,c))
    elif s1==0 and s2 ==1:
        print(f2(a,b,c))
    elif s1==1 and s2 ==0:
        print(f3(a,b,c))
    elif s1==1 and s2 ==1:
        print(f4(a,b,c))
    else:
        print('Error')

# 1642344, 2022-09-24 10:37:34, ----[--][----] (0%)

def f1(a,b,c):
    a =int(a)
    b =int(b)
    c =int(c)
    d=[]
    if a >= 0:
        d += [a]
    if b >= 0:
        d += [b]
    if c >= 0:
        d += [c]
    d.sort()
    return(d[0])
def f2(a,b,c):
    a =int(a)
    b =int(b)
    c =int(c)
    d=[]
    if a <= 0:
        d += [a]
    if b <= 0:
        d += [b]
    if c <= 0:
        d += [c]
    d.sort()
    g = d[::-1]
    return(g[0])
def f3(a,b,c):
    a =int(a)
    b =int(b)
    c =int(c)
    d = a+b+c
    if d >0:
        d=d
    else:
        if d<0:
            d= (-1)*d
    return (d // 10)
def f4(a,b,c):
    a =int(a)
    b =int(b)
    c =int(c)
    d = a+b+c
    if d >0:
        d=d
    else:
        if d<0:
            d= (-1)*d
    return (d % 10)
def main():
    x = input().split()
    s1 = int(x[0])
    s2 = int(x[1])
    a = int(x[2])
    b = int(x[3])
    c = int(x[4])
    if s1==0 and s2 ==0:
        print(f1(a,b,c))
    elif s1==0 and s2 ==1:
        print(f2(a,b,c))
    elif s1==1 and s2 ==0:
        print(f3(a,b,c))
    elif s1==1 and s2 ==1:
        print(f4(a,b,c))
    else:
        print('Error')

# 1642376, 2022-09-24 10:38:00, PP-P[PP][P-P-] (67%)

def f1(a,b,c):
    a =int(a)
    b =int(b)
    c =int(c)
    d=[]
    if a > 0:
        d += [a]
    if b > 0:
        d += [b]
    if c > 0:
        d += [c]
    d.sort()
    return(d[0])
def f2(a,b,c):
    a =int(a)
    b =int(b)
    c =int(c)
    d=[]
    if a < 0:
        d += [a]
    if b < 0:
        d += [b]
    if c < 0:
        d += [c]
    d.sort()
    g = d[::-1]
    return(g[0])
def f3(a,b,c):
    a =int(a)
    b =int(b)
    c =int(c)
    d = a+b+c
    if d >0:
        d=d
    else:
        if d<0:
            d= (-1)*d
    return (d // 10)
def f4(a,b,c):
    a =int(a)
    b =int(b)
    c =int(c)
    d = a+b+c
    if d >0:
        d=d
    else:
        if d<0:
            d= (-1)*d
    return (d % 10)
def main():
    x = input().split()
    s1 = int(x[0])
    s2 = int(x[1])
    a = int(x[2])
    b = int(x[3])
    c = int(x[4])
    if s1==0 and s2 ==0:
        print(f1(a,b,c))
    elif s1==0 and s2 ==1:
        print(f2(a,b,c))
    elif s1==1 and s2 ==0:
        print(f3(a,b,c))
    elif s1==1 and s2 ==1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line


6530171221
# 1639547, 2022-09-24 09:33:05, xxxx[xx][xxxx] (0%)

def f1(a, b, c):
    number = [a,b,c]
    for e in range(len(number)) :
        number[e] = int(number[e])
    for i in number:
        if i <= 0 :
            number.remove(i)
    return min(number)

def f2(a, b, c):
    number = [a,b,c]
    for e in range(len(number)) :
        number[e] = int(number[e])
    for i in number:
        if i >= 0 :
            number.remove(i)
    return max(number)
    
def f3(a, b, c):
    import math
    sum_ = math.fabs(a+b+c)
    sum_ = str(int(sum_))
    return sum_[0]
 
def f4(a, b, c):
    import math
    sum_ = math.fabs(a+b+c)
    sum_ = str(int(sum_))
    return sum_[-1]
     
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
exec(input().strip)
# 1639622, 2022-09-24 09:34:54, ----[PP][PPPP] (33%)

def f1(a, b, c):
    number = [a,b,c]
    for e in range(len(number)) :
        number[e] = int(number[e])
    for i in number:
        if i <= 0 :
            number.remove(i)
    return min(number)

def f2(a, b, c):
    number = [a,b,c]
    for e in range(len(number)) :
        number[e] = int(number[e])
    for i in number:
        if i >= 0 :
            number.remove(i)
    return max(number)
    
def f3(a, b, c):
    import math
    sum_ = math.fabs(a+b+c)
    sum_ = str(int(sum_))
    return sum_[0]
 
def f4(a, b, c):
    import math
    sum_ = math.fabs(a+b+c)
    sum_ = str(int(sum_))
    return sum_[-1]
     
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
exec(input().strip())
# 1640949, 2022-09-24 10:11:10, ----[PP][PPPP] (33%)

def f1(a, b, c):
    number = [a,b,c]
    for e in range(len(number)) :
        number[e] = int(number[e])
    if (a or b or c < 0) and (a or b or c > 0) :
        for i in number:
            if i <= 0 :
                number.remove(i)
    return min(number)
    
def f2(a, b, c):
    number = [a,b,c]
    for e in range(len(number)) :
        number[e] = int(number[e])
    for i in number:
        if i >= 0 :
            number.remove(i)
    return max(number)
    
def f3(a, b, c):
    import math
    sum_ = math.fabs(a+b+c)
    sum_ = str(int(sum_))
    return sum_[0]
 
def f4(a, b, c):
    import math
    sum_ = math.fabs(a+b+c)
    sum_ = str(int(sum_))
    return sum_[-1]
     
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
exec(input().strip())
# 1641744, 2022-09-24 10:28:07, PP--[PP][PPPP] (67%)


def f1(a, b, c):
    number = [a,b,c]
    r = []
    for e in range(len(number)) :
        number[e] = int(number[e])
#     if ((a and b and c) < 0) or ((a and b and c) > 0) :
#         pass
    else:
        for i in number:
            if i > 0 :
                r.append(i)
    return min(r)

def f2(a, b, c):
    number = [a,b,c]
    r = []
    for e in range(len(number)) :
        number[e] = int(number[e])
    for i in number:
        if i < 0 :
            r.append(i)
    return max(r)
    
def f3(a, b, c):
    import math
    sum_ = math.fabs(a+b+c)
    sum_ = str(int(sum_))
    return sum_[0]
 
def f4(a, b, c):
    import math
    sum_ = math.fabs(a+b+c)
    sum_ = str(int(sum_))
    return sum_[-1]
     
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
exec(input().strip())
# 1641888, 2022-09-24 10:30:31, PP--[PP][PPPP] (67%)


def f1(a, b, c):
    number = [a,b,c]
    r = []
    for e in range(len(number)) :
        number[e] = int(number[e])
    if (a < 0 and b < 0 and c < 0 ) or (a > 0 and b > 0 and c > 0 ) :
        return 
    else:
        for i in number:
            if i > 0 :
                r.append(i)
        return min(r)

def f2(a, b, c):
    number = [a,b,c]
    r = []
    for e in range(len(number)) :
        number[e] = int(number[e])
    for i in number:
        if i < 0 :
            r.append(i)
    return max(r)
    
def f3(a, b, c):
    import math
    sum_ = math.fabs(a+b+c)
    sum_ = str(int(sum_))
    return sum_[0]
 
def f4(a, b, c):
    import math
    sum_ = math.fabs(a+b+c)
    sum_ = str(int(sum_))
    return sum_[-1]
     
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
exec(input().strip())
# 1641957, 2022-09-24 10:31:46, PP--[PP][PPPP] (67%)


def f1(a, b, c):
    number = [a,b,c]
    r = []
    for e in range(len(number)) :
        number[e] = int(number[e])
    if (a < 0 and b < 0 and c < 0 ) or (a > 0 and b > 0 and c > 0 ) :
        return 
    else:
        for i in number:
            if i > 0 :
                r.append(i)
        return min(r)

def f2(a, b, c):
    number = [a,b,c]
    r = []
    for e in range(len(number)) :
        number[e] = int(number[e])
    if (a < 0 and b < 0 and c < 0 ) or (a > 0 and b > 0 and c > 0 ) :
        return 
    else:
        for i in number:
            if i < 0 :
                r.append(i)
        return max(r)
    
def f3(a, b, c):
    import math
    if (a < 0 and b < 0 and c < 0 ) or (a > 0 and b > 0 and c > 0 ) :
        return 
    else:
        sum_ = math.fabs(a+b+c)
        sum_ = str(int(sum_))
        return sum_[0]
 
def f4(a, b, c):
    import math
    if (a < 0 and b < 0 and c < 0 ) or (a > 0 and b > 0 and c > 0 ) :
        return 
    else:
        sum_ = math.fabs(a+b+c)
        sum_ = str(int(sum_))
        return sum_[-1]
     
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if (a < 0 and b < 0 and c < 0 ) or (a > 0 and b > 0 and c > 0 ) :
        return 
    else:
        if s1 == 0 and s2 == 0 :
            print(f1(a,b,c))
        elif s1 == 0 and s2 == 1 :
            print(f2(a,b,c))
        elif s1 == 1 and s2 == 0 :
            print(f3(a,b,c))
        elif s1 == 1 and s2 == 1 :
            print(f4(a,b,c))
        else :
            print('Error')
exec(input().strip())
# 1642029, 2022-09-24 10:33:16, PP--[PP][PPPP] (67%)


def f1(a, b, c):
    number = [a,b,c]
    r = []
    for e in range(len(number)) :
        number[e] = int(number[e])
    if (a < 0 and b < 0 and c < 0 ) or (a > 0 and b > 0 and c > 0 ) or  (-1000 > a > 1000) or (-1000 > b > 1000) or (-1000 > c > 1000):
        return 
    else:
        for i in number:
            if i > 0 :
                r.append(i)
        return min(r)

def f2(a, b, c):
    number = [a,b,c]
    r = []
    for e in range(len(number)) :
        number[e] = int(number[e])
    if (a < 0 and b < 0 and c < 0 ) or (a > 0 and b > 0 and c > 0 ) or  (-1000 > a > 1000) or (-1000 > b > 1000) or (-1000 > c > 1000) :
        return 
    else:
        for i in number:
            if i < 0 :
                r.append(i)
        return max(r)
    
def f3(a, b, c):
    import math
    if (a < 0 and b < 0 and c < 0 ) or (a > 0 and b > 0 and c > 0 ) or  (-1000 > a > 1000) or (-1000 > b > 1000) or (-1000 > c > 1000) :
        return 
    else:
        sum_ = math.fabs(a+b+c)
        sum_ = str(int(sum_))
        return sum_[0]
 
def f4(a, b, c):
    import math
    if (a < 0 and b < 0 and c < 0 ) or (a > 0 and b > 0 and c > 0 ) or  (-1000 > a > 1000) or (-1000 > b > 1000) or (-1000 > c > 1000) :
        return 
    else:
        sum_ = math.fabs(a+b+c)
        sum_ = str(int(sum_))
        return sum_[-1]
     
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if (a < 0 and b < 0 and c < 0 ) or (a > 0 and b > 0 and c > 0 ) or  (-1000 > a > 1000) or (-1000 > b > 1000) or (-1000 > c > 1000) :
        return 
    else:
        if s1 == 0 and s2 == 0 :
            print(f1(a,b,c))
        elif s1 == 0 and s2 == 1 :
            print(f2(a,b,c))
        elif s1 == 1 and s2 == 0 :
            print(f3(a,b,c))
        elif s1 == 1 and s2 == 1 :
            print(f4(a,b,c))
        else :
            print('Error')
exec(input().strip())

6530173521
# 1639476, 2022-09-24 09:31:24, PP--[PP][PPPP] (67%)

def f1(a,b,c):
    j = [a,b,c]
    min1 = []
    for i in j:
        if i > 0:
            min1.append(i)
    out = min(min1)
    return out
def f2(a,b,c):
    y = [a,b,c]
    max1 = []
    for i in y:
        if i < 0:
            max1.append(i)
    out = max(max1)
    return out
def f3(a,b,c):
    l = a+b+c
    if l > 0:
        return str(l)[0]
    if l < 0:
        return str(l)[1]
def f4(a,b,c):
    l = a+b+c
    return str(l)[-1]
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

exec(input().strip()) # DON'T remove this line
# 1639777, 2022-09-24 09:39:06, ----[PP][PPPP] (33%)

def f1(a,b,c):
    j = [a,b,c]
    min1 = []
    for i in j:
        if i >= 0:
            min1.append(i)
    out = min(min1)
    return out
def f2(a,b,c):
    y = [a,b,c]
    max1 = []
    for i in y:
        if i <= 0:
            max1.append(i)
    out = max(max1)
    return out
def f3(a,b,c):
    l = a+b+c
    if l >= 0:
        return str(l)[0]
    if l < 0:
        return str(l)[1]
def f4(a,b,c):
    l = a+b+c
    return str(l)[-1]
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

exec(input().strip()) # DON'T remove this line
# 1639790, 2022-09-24 09:39:21, PP--[PP][PPPP] (67%)

def f1(a,b,c):
    j = [a,b,c]
    min1 = []
    for i in j:
        if i > 0:
            min1.append(i)
    out = min(min1)
    return out
def f2(a,b,c):
    y = [a,b,c]
    max1 = []
    for i in y:
        if i < 0:
            max1.append(i)
    out = max(max1)
    return out
def f3(a,b,c):
    l = a+b+c
    if l > 0:
        return str(l)[0]
    if l < 0:
        return str(l)[1]
def f4(a,b,c):
    l = a+b+c
    return str(l)[-1]
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

exec(input().strip()) # DON'T remove this line
# 1642174, 2022-09-24 10:35:25, PP--[PP][PPPP] (67%)

def f1(a,b,c):
    j = [a,b,c]
    min1 = []
    for i in j:
        if i > 0:
            min1.append(i)
    out = min(min1)
    return out
def f2(a,b,c):
    y = [a,b,c]
    max1 = []
    for i in y:
        if i < 0:
            max1.append(i)
    out = max(max1)
    return out
def f3(a,b,c):
    l = a+b+c
    if l >= 0:
        return str(l)[0]
    if l < 0:
        return str(l)[1]
def f4(a,b,c):
    l = a+b+c
    return str(l)[-1]
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

exec(input().strip()) # DON'T remove this line
# 1642333, 2022-09-24 10:37:28, PP--[xx][xxxx] (33%)

def f1(a,b,c):
    j = [a,b,c]
    min1 = []
    for i in j:
        if i > 0:
            min1.append(i)
    out = min(min1)
    return out
def f2(a,b,c):
    y = [a,b,c]
    max1 = []
    for i in y:
        if i < 0:
            max1.append(i)
    out = max(max1)
    return out
def f3(a,b,c):
    l = a+b+c
    if l >= 0:
        return str(l)[0]
    if l < 0:
        return str(l)[1]
def f4(a,b,c):
    l = a+b+c
    return str(l)[-1]
    
def main():
    if -1000 < a < 1000 and -1000 < b < 1000 and -1000 < c < 1000 :
        if s1 == 0 and s2 == 0:
            print(f1(a,b,c))
        elif s1 == 0 and s2 == 1:
            print(f2(a,b,c))
        elif s1 == 1 and s2 == 0:
            print(f3(a,b,c))
        elif s1 == 1 and s2 == 1:
            print(f4(a,b,c))
        else:
            print('Error')


exec(input().strip()) # DON'T remove this line
# 1642363, 2022-09-24 10:37:46, PP--[xx][xxxx] (33%)

def f1(a,b,c):
    j = [a,b,c]
    min1 = []
    for i in j:
        if i > 0:
            min1.append(i)
    out = min(min1)
    return out
def f2(a,b,c):
    y = [a,b,c]
    max1 = []
    for i in y:
        if i < 0:
            max1.append(i)
    out = max(max1)
    return out
def f3(a,b,c):
    l = a+b+c
    if l >= 0:
        return str(l)[0]
    if l < 0:
        return str(l)[1]
def f4(a,b,c):
    l = a+b+c
    return str(l)[-1]
    
def main():
      if s1 == 0 and s2 == 0:
          print(f1(a,b,c))
      elif s1 == 0 and s2 == 1:
          print(f2(a,b,c))
      elif s1 == 1 and s2 == 0:
          print(f3(a,b,c))
      elif s1 == 1 and s2 == 1:
          print(f4(a,b,c))
      else:
          print('Error')


exec(input().strip()) # DON'T remove this line
# 1642399, 2022-09-24 10:38:17, PP--[PP][PPPP] (67%)

def f1(a,b,c):
    j = [a,b,c]
    min1 = []
    for i in j:
        if i > 0:
            min1.append(i)
    out = min(min1)
    return out
def f2(a,b,c):
    y = [a,b,c]
    max1 = []
    for i in y:
        if i < 0:
            max1.append(i)
    out = max(max1)
    return out
def f3(a,b,c):
    l = a+b+c
    if l >= 0:
        return str(l)[0]
    if l < 0:
        return str(l)[1]
def f4(a,b,c):
    l = a+b+c
    return str(l)[-1]
    
def main():
      s1,s2,a,b,c = [int(e) for e in input().split()]
      if s1 == 0 and s2 == 0:
          print(f1(a,b,c))
      elif s1 == 0 and s2 == 1:
          print(f2(a,b,c))
      elif s1 == 1 and s2 == 0:
          print(f3(a,b,c))
      elif s1 == 1 and s2 == 1:
          print(f4(a,b,c))
      else:
          print('Error')


exec(input().strip()) # DON'T remove this line

6530008721
# 1639404, 2022-09-24 09:29:33, ----[PP][PPPP] (33%)

def f1(a, b, c):
    y = [a,b,c]
    for e in y:
        if e < 0:
            y.remove(e)
    return min(y)

def f2(a, b, c):
    y = [a,b,c]
    for e in y:
        if e > 0:
            y.remove(e)
    return max(y)
    
def f3(a, b, c):
    y = [a,b,c]
    z = 0
    if sum(y)>=0:
        z = str(sum(y))
    else:
        z = str(-sum(y))
    return z[0]
    

def f4(a, b, c):
    y = [a,b,c]
    z = 0
    if sum(y)>=0:
        z = str(sum(y))
    else:
        z = str(-sum(y))
    return z[-1]
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c,))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 ==1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
        
    
exec(input().strip()) # DON'T remove this line

# 1639453, 2022-09-24 09:30:49, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    y = [a,b,c]
    for e in y:
        if e < 0:
            y.remove(e)
    return int(min(y))

def f2(a, b, c):
    y = [a,b,c]
    for e in y:
        if e > 0:
            y.remove(e)
    return int(max(y))
    
def f3(a, b, c):
    y = [a,b,c]
    z = 0
    if sum(y)>=0:
        z = str(sum(y))
    else:
        z = str(-sum(y))
    return int(z[0])
    

def f4(a, b, c):
    y = [a,b,c]
    z = 0
    if sum(y)>=0:
        z = str(sum(y))
    else:
        z = str(-sum(y))
    return int(z[-1])
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c,))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 ==1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
        
    
exec(input().strip()) # DON'T remove this line

# 1640727, 2022-09-24 10:05:37, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    y = [a,b,c]
    for e in y:
        if e < 0:
            y.remove(e)
    return int(min(y))

def f2(a, b, c):
    y = [a,b,c]
    for e in y:
        if e > 0:
            y.remove(e)
    return int(max(y))
    
def f3(a, b, c):
    y = [a,b,c]
    z = 0
    if sum(y)>=0:
        z = str(sum(y))
    else:
        z = str(-sum(y))
    return int(z[0])
    

def f4(a, b, c):
    y = [a,b,c]
    z = 0
    if sum(y)>=0:
        z = str(sum(y))
    else:
        z = str(-sum(y))
    return int(z[-1])
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c,))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 ==1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
        
    
exec(input().strip()) # DON'T remove this line
# 1640970, 2022-09-24 10:11:43, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    y = [a,b,c]
    for e in y:
        if e < 0:
            y.remove(e)
    return int(min(y))

def f2(a, b, c):
    y = [a,b,c]
    for e in y:
        if e > 0:
            y.remove(e)
    return int(max(y))
    
def f3(a, b, c):
    y = [a,b,c]
    z = 0
    if sum(y)>=0:
        z = str(sum(y))
    else:
        z = str(-sum(y))
    return int(z[0])
    

def f4(a, b, c):
    y = [a,b,c]
    z = 0
    if sum(y)>=0:
        z = str(sum(y))
    else:
        z = str(-sum(y))
    return int(z[-1])
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c,))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 ==1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
        
    
exec(input().strip())

# 1640998, 2022-09-24 10:12:34, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    y = [a,b,c]
    for e in y:
        if e <= 0:
            y.remove(e)
    return int(min(y))

def f2(a, b, c):
    y = [a,b,c]
    for e in y:
        if e >= 0:
            y.remove(e)
    return int(max(y))
    
def f3(a, b, c):
    y = [a,b,c]
    z = 0
    if sum(y)>=0:
        z = str(sum(y))
    else:
        z = str(-sum(y))
    return int(z[0])
    

def f4(a, b, c):
    y = [a,b,c]
    z = 0
    if sum(y)>=0:
        z = str(sum(y))
    else:
        z = str(-sum(y))
    return int(z[-1])
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c,))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 ==1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
        
    
exec(input().strip())

# 1641644, 2022-09-24 10:26:18, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    y = [a,b,c]
    for e in y:
        if e <= 0:
            y.remove(e)
    return int(min(y))

def f2(a, b, c):
    y = [a,b,c]
    for e in y:
        if e >= 0:
            y.remove(e)
    return int(max(y))
    
def f3(a, b, c):
    y = [a,b,c]
    z = 0
    if sum(y)>=0:
        z = str(sum(y))
    else:
        z = str(-sum(y))
    return int(z[0])
    

def f4(a, b, c):
    y = [a,b,c]
    z = 0
    if sum(y)>=0:
        z = str(sum(y))
    else:
        z = str(-sum(y))
    return int(z[-1])
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 ==1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
        
    
exec(input().strip())


6530027621
# 1640386, 2022-09-24 09:56:20, PPPP[--][P-P-] (67%)

def f1(a,b,c):
    x = [a,b,c]
    y = [] 
    for i in range(3):
        if int(x[i]) > 0 :
            y.append(x[i])
    y.sort()
    ans = int(y[0])
    return int(ans)
        
def f2(a,b,c):
    x = [a,b,c]
    y = [] 
    for i in range(3):
        if int(x[i]) < 0 :
            y.append(x[i])
    y.sort()
    ans = int(y[-1])
    return int(ans)
                  
def f3(a,b,c):
    x = int(a)+int(b)+int(c)
    y = ""
    for e in str(x):
        if e not in "-":
            y += e
    ans = int(y[0])
    return int(ans)

def f4(a,b,c):
    x = int(a)+int(b)+int(c)
    y = ""
    for e in str(x):
        if e not in "-":
            y += e
    ans = int(y[-1])
    return int(ans)

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 ==0 and s2 ==0 :
        print(f1(a,b,c))
    if s1 ==0 and s2 ==1 :
        print(f2(a,b,c))
    if s1 ==1 and s2 ==0 :
        print(f3(a,b,c))
    if s1 ==1 and s2 ==1 :
        print(f4(a,b,c))
    else:
        print("Error")
        
exec(input().strip()) # DON'T remove this line

    
        

# 1640526, 2022-09-24 09:59:53, PPPP[xx][xxxx] (67%)

def f1(a,b,c):
    x = [a,b,c]
    y = [] 
    for i in range(3):
        if int(x[i]) > 0 :
            y.append(x[i])
    y.sort()
    ans = int(y[0])
    return int(ans)
        
def f2(a,b,c):
    x = [a,b,c]
    y = [] 
    for i in range(3):
        if int(x[i]) < 0 :
            y.append(x[i])
    y.sort()
    ans = int(y[-1])
    return int(ans)
                  
def f3(a,b,c):
    x = int(a)+int(b)+int(c)
    y = ""
    for e in str(x):
        if e not in "-":
            y += e
    ans = int(y[0])
    return int(ans)

def f4(a,b,c):
    x = int(a)+int(b)+int(c)
    y = ""
    for e in str(x):
        if e not in "-":
            y += e
    ans = int(y[-1])
    return int(ans)

def main():
    s1,s2,a,b,c = [int(e) for e in int(input()).split()]
    if s1 ==0 and s2 ==0 :
        print(f1(a,b,c))
    if s1 ==0 and s2 ==1 :
        print(f2(a,b,c))
    if s1 ==1 and s2 ==0 :
        print(f3(a,b,c))
    if s1 ==1 and s2 ==1 :
        print(f4(a,b,c))
    else:
        print("Error")
        
exec(input().strip()) # DON'T remove this line

    
        

# 1640723, 2022-09-24 10:05:31, PPxP[xx][xxxx] (50%)

def f1(a,b,c):
    x = [a,b,c]
    y = [] 
    for i in range(3):
        if int(x[i]) > 0 :
            y.append(x[i])
    y.sort()
    ans = int(y[0])
    return ans
        
def f2(a,b,c):
    x = [a,b,c]
    y = [] 
    for i in range(3):
        if int(x[i]) < 0 :
            y.append(x[i])
    y.sort()
    ans = int(y[-1])
    return ans
                  
def f3(a,b,c):
    x = int(a)+int(b)+int(c)
    y = " "
    for e in str(x):
        if e not in "-+":
            y += e
    ans = int(y[0])
    return ans

def f4(a,b,c):
    x = int(a)+int(b)+int(c)
    y = " "
    for e in str(x):
        if e not in "-+":
            y += e
    ans = int(y[-1])
    return ans

def main():
    s1,s2,a,b,c = [int(e) for e in int(input()).split()]
    if s1 ==0 and s2 ==0 :
        print(f1(a,b,c))
    if s1 ==0 and s2 ==1 :
        print(f2(a,b,c))
    if s1 ==1 and s2 ==0 :
        print(f3(a,b,c))
    if s1 ==1 and s2 ==1 :
        print(f4(a,b,c))
    else:
        print("Error")
        
exec(input().strip()) # DON'T remove this line

    
        

# 1640736, 2022-09-24 10:05:49, PPxP[xx][xxxx] (50%)

def f1(a,b,c):
    x = [a,b,c]
    y = [] 
    for i in range(3):
        if int(x[i]) > 0 :
            y.append(x[i])
    y.sort()
    ans = int(y[0])
    return ans
        
def f2(a,b,c):
    x = [a,b,c]
    y = [] 
    for i in range(3):
        if int(x[i]) < 0 :
            y.append(x[i])
    y.sort()
    ans = int(y[-1])
    return ans
                  
def f3(a,b,c):
    x = int(a)+int(b)+int(c)
    y = " "
    for e in str(x):
        if e not in "-":
            y += e
    ans = int(y[0])
    return ans

def f4(a,b,c):
    x = int(a)+int(b)+int(c)
    y = " "
    for e in str(x):
        if e not in "-":
            y += e
    ans = int(y[-1])
    return ans

def main():
    s1,s2,a,b,c = [int(e) for e in int(input()).split()]
    if s1 ==0 and s2 ==0 :
        print(f1(a,b,c))
    if s1 ==0 and s2 ==1 :
        print(f2(a,b,c))
    if s1 ==1 and s2 ==0 :
        print(f3(a,b,c))
    if s1 ==1 and s2 ==1 :
        print(f4(a,b,c))
    else:
        print("Error")
        
exec(input().strip()) # DON'T remove this line
# 1640781, 2022-09-24 10:06:49, PPxP[xx][xxxx] (50%)

def f1(a,b,c):
    x = [a,b,c]
    y = [] 
    for i in range(3):
        if int(x[i]) > 0 :
            y.append(x[i])
    y.sort()
    ans = int(y[0])
    return int(ans)
        
def f2(a,b,c):
    x = [a,b,c]
    y = [] 
    for i in range(3):
        if int(x[i]) < 0 :
            y.append(x[i])
    y.sort()
    ans = int(y[-1])
    return int(ans)
                  
def f3(a,b,c):
    x = int(a)+int(b)+int(c)
    y = " "
    for e in str(x):
        if e not in "-+":
            y += e
    ans = int(y[0])
    return int(ans)

def f4(a,b,c):
    x = int(a)+int(b)+int(c)
    y = " "
    for e in str(x):
        if e not in "-+":
            y += e
    ans = int(y[-1])
    return int(ans)

def main():
    s1,s2,a,b,c = [int(e) for e in int(input()).split()]
    if s1 ==0 and s2 ==0 :
        print(f1(a,b,c))
    if s1 ==0 and s2 ==1 :
        print(f2(a,b,c))
    if s1 ==1 and s2 ==0 :
        print(f3(a,b,c))
    if s1 ==1 and s2 ==1 :
        print(f4(a,b,c))
    else:
        print("Error")
        
exec(input().strip()) # DON'T remove this line

    
        

# 1640795, 2022-09-24 10:07:14, PPPP[xx][xxxx] (67%)

def f1(a,b,c):
    x = [a,b,c]
    y = [] 
    for i in range(3):
        if int(x[i]) > 0 :
            y.append(x[i])
    y.sort()
    ans = int(y[0])
    return int(ans)
        
def f2(a,b,c):
    x = [a,b,c]
    y = [] 
    for i in range(3):
        if int(x[i]) < 0 :
            y.append(x[i])
    y.sort()
    ans = int(y[-1])
    return int(ans)
                  
def f3(a,b,c):
    x = int(a)+int(b)+int(c)
    y = ""
    for e in str(x):
        if e not in "-":
            y += e
    ans = int(y[0])
    return int(ans)

def f4(a,b,c):
    x = int(a)+int(b)+int(c)
    y = ""
    for e in str(x):
        if e not in "-":
            y += e
    ans = int(y[-1])
    return int(ans)

def main():
    s1,s2,a,b,c = [int(e) for e in int(input()).split()]
    if s1 ==0 and s2 ==0 :
        print(f1(a,b,c))
    if s1 ==0 and s2 ==1 :
        print(f2(a,b,c))
    if s1 ==1 and s2 ==0 :
        print(f3(a,b,c))
    if s1 ==1 and s2 ==1 :
        print(f4(a,b,c))
    else:
        print("Error")
        
exec(input().strip()) # DON'T remove this line

6530151721
# 1639518, 2022-09-24 09:32:15, ----[--][----] (0%)

def f1 (a,b,c):
    d=[]
    if a >0:
        d.append((a))
    if b >0:
        d.append((b))
    if c >0:
        d.append((c))
    ans=min(d)
    return (ans)
def f2(a, b, c):
    d=[]
    if a <0:
        d.append((a))
    if b <0:
        d.append((b))
    if c <0:
        d.append((c))
    ans=max(d)
    return (ans)
def f3(a, b, c):
    d=str((a+b+c))
    if d[0]=='-':
        ans=d[1]
    else:
        ans=d[0]
    return ans
def f4(a, b, c):
    d=str((a+b+c))
    ans=d[-1]
    return ans
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))      
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
                


# 1639536, 2022-09-24 09:32:42, PP--[PP][PPPP] (67%)

def f1 (a,b,c):
    d=[]
    if a >0:
        d.append((a))
    if b >0:
        d.append((b))
    if c >0:
        d.append((c))
    ans=min(d)
    return (ans)
def f2(a, b, c):
    d=[]
    if a <0:
        d.append((a))
    if b <0:
        d.append((b))
    if c <0:
        d.append((c))
    ans=max(d)
    return (ans)
def f3(a, b, c):
    d=str((a+b+c))
    if d[0]=='-':
        ans=d[1]
    else:
        ans=d[0]
    return ans
def f4(a, b, c):
    d=str((a+b+c))
    ans=d[-1]
    return ans
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))      
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())

# 1639761, 2022-09-24 09:38:42, P---[PP][PPPP] (50%)

def f1 (a,b,c):
    d=[]
    if a >0:
        d.append((a))
    if b >0:
        d.append((b))
    if c >0:
        d.append((c))
    ans=min(d)
    return (ans)
def f2(a, b, c):
    d=[]
    if a <0:
        d.append((a))
    if b <0:
        d.append((b))
    if c <0:
        d.append((c))
    for i in range(len(d)):
        d[i]=abs(d[i])
    ans='-'
    ans+=str(min(d))
    return (ans)
def f3(a, b, c):
    d=str((a+b+c))
    if d[0]=='-':
        ans=d[1]
    else:
        ans=d[0]
    return ans
def f4(a, b, c):
    d=str((a+b+c))
    ans=d[-1]
    return ans
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))      
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
                
exec(input().strip())

# 1639953, 2022-09-24 09:43:56, PP--[PP][PPPP] (67%)

def f1 (a,b,c):
    d=[]
    if a >0:
        d.append((a))
    if b >0:
        d.append((b))
    if c >0:
        d.append((c))
    ans=min(d)
    return (ans)
def f2(a, b, c):
    d=[]
    if a <0:
        d.append((a))
    if b <0:
        d.append((b))
    if c <0:
        d.append((c))
    ans=max(d)
    return (ans)
def f3(a, b, c):
    d=str((a+b+c))
    if d[0]=='-':
        ans=d[1]
    else:
        ans=d[0]
    return ans
def f4(a, b, c):
    d=str((a+b+c))
    ans=d[-1]
    return ans
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))      
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
                
exec(input().strip())

# 1639971, 2022-09-24 09:44:19, PP--[PP][PPPP] (67%)

def f1 (a,b,c):
    d=[]
    if a >0:
        d.append((a))
    if b >0:
        d.append((b))
    if c >0:
        d.append((c))
    ans=min(d)
    return (ans)
def f2(a, b, c):
    d=[]
    if a <0:
        d.append((a))
    if b <0:
        d.append((b))
    if c <0:
        d.append((c))
    ans=max(d)
    return (ans)
def f3(a, b, c):
    d=str((a+b+c))
    if d[0]=='-':
        ans=d[1]
    else:
        ans=d[0]
    return ans
def f4(a, b, c):
    d=str((a+b))
    ans=d[-1]
    return ans
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))      
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
                
exec(input().strip())
# 1640015, 2022-09-24 09:45:54, PP--[PP][PPPP] (67%)

def f1 (a,b,c):
    d=[]
    if a >0:
        d.append((a))
    if b >0:
        d.append((b))
    if c >0:
        d.append((c))
    ans=min(d)
    return (ans)
def f2(a, b, c):
    d=[]
    if a <0:
        d.append((a))
    if b <0:
        d.append((b))
    if c <0:
        d.append((c))
    ans=max(d)
    return (ans)
def f3(a, b, c):
    d=str((a+b+c))
    if d[0]=='-':
        ans=d[1]
    else:
        ans=d[0]
    return ans
def f4(a, b, c):
    d=str((a))
    ans=d[-1]
    return ans
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))      
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
                
exec(input().strip())

6530159821
# 1639520, 2022-09-24 09:32:18, PP--[xx][xxxx] (33%)

def f1(a, b, c):
    x=[int(a),int(b),int(c)]
    sume=[]
    for a in x:
        if a>0:
            sume.append(a)
        else:
            pass
    ans=min(sume)
    return ans
    
def f2(a, b, c):
    x=[int(a),int(b),int(c)]
    sume=[]
    for a in x:
        if a<0:
            sume.append(a)
        else:
            pass
    ans=max(sume)
    return ans
def f3(a, b, c):
    x=abs(a+b+c)
    s=str(x)
    a=s[0]
    return a
def f4(a, b, c):
    x=abs(a+b+c)
    s=str(x)
    a=s[-1]
    return a

def main():
    print(f1(2, -18, 4))
    print(f2(-20, -18, 4))
    print(f3(2, -18, 4))
    print(f4(2, -18, 4))
    s1,s2,a,b,c = [int(e) for e in input()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print("Error")
        
exec(input().strip()) # DON'T remove this line
 
 
 
 

# 1639606, 2022-09-24 09:34:37, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x=[int(a),int(b),int(c)]
    sume=[]
    for a in x:
        if a>0:
            sume.append(a)
        else:
            pass
    ans=min(sume)
    return ans
    
def f2(a, b, c):
    x=[int(a),int(b),int(c)]
    sume=[]
    for a in x:
        if a<0:
            sume.append(a)
        else:
            pass
    ans=max(sume)
    return ans
def f3(a, b, c):
    x=abs(a+b+c)
    s=str(x)
    a=s[0]
    return a
def f4(a, b, c):
    x=abs(a+b+c)
    s=str(x)
    a=s[-1]
    return a

def main():
#     print(f1(2, -18, 4))
#     print(f2(-20, -18, 4))
#     print(f3(2, -18, 4))
#     print(f4(2, -18, 4))
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print("Error")
        
exec(input().strip()) # DON'T remove this line
 
 
 
 

# 1639658, 2022-09-24 09:35:55, ----[--][----] (0%)

def f1(a, b, c):
    x=[int(a),int(b),int(c)]
    sume=[]
    for a in x:
        if a>0:
            sume.append(a)
        else:
            pass
    ans=min(sume)
    return ans
    
def f2(a, b, c):
    x=[int(a),int(b),int(c)]
    sume=[]
    for a in x:
        if a<0:
            sume.append(a)
        else:
            pass
    ans=max(sume)
    return ans
def f3(a, b, c):
    x=abs(a+b+c)
    s=str(x)
    a=s[0]
    return a
def f4(a, b, c):
    x=abs(a+b+c)
    s=str(x)
    a=s[-1]
    return a

def main():
#     print(f1(2, -18, 4))
#     print(f2(-20, -18, 4))
#     print(f3(2, -18, 4))
#     print(f4(2, -18, 4))
    s1,s2,a,b,c = [e for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print("Error")
        
#exec(input().strip()) # DON'T remove this line
 
 
 
 

# 1639665, 2022-09-24 09:36:01, PP--[--][P-P-] (33%)

def f1(a, b, c):
    x=[int(a),int(b),int(c)]
    sume=[]
    for a in x:
        if a>0:
            sume.append(a)
        else:
            pass
    ans=min(sume)
    return ans
    
def f2(a, b, c):
    x=[int(a),int(b),int(c)]
    sume=[]
    for a in x:
        if a<0:
            sume.append(a)
        else:
            pass
    ans=max(sume)
    return ans
def f3(a, b, c):
    x=abs(a+b+c)
    s=str(x)
    a=s[0]
    return a
def f4(a, b, c):
    x=abs(a+b+c)
    s=str(x)
    a=s[-1]
    return a

def main():
#     print(f1(2, -18, 4))
#     print(f2(-20, -18, 4))
#     print(f3(2, -18, 4))
#     print(f4(2, -18, 4))
    s1,s2,a,b,c = [e for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print("Error")
        
exec(input().strip()) # DON'T remove this line
# 1639671, 2022-09-24 09:36:14, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x=[int(a),int(b),int(c)]
    sume=[]
    for a in x:
        if a>0:
            sume.append(a)
        else:
            pass
    ans=min(sume)
    return ans
    
def f2(a, b, c):
    x=[int(a),int(b),int(c)]
    sume=[]
    for a in x:
        if a<0:
            sume.append(a)
        else:
            pass
    ans=max(sume)
    return ans
def f3(a, b, c):
    x=abs(a+b+c)
    s=str(x)
    a=s[0]
    return a
def f4(a, b, c):
    x=abs(a+b+c)
    s=str(x)
    a=s[-1]
    return a

def main():
#     print(f1(2, -18, 4))
#     print(f2(-20, -18, 4))
#     print(f3(2, -18, 4))
#     print(f4(2, -18, 4))
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print("Error")
        
exec(input().strip()) # DON'T remove this line
# 1640039, 2022-09-24 09:46:30, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x=[int(a),int(b),int(c)]
    sume=[]
    for a in x:
        if a>0:
            sume.append(a)
        else:
            pass
    ans=min(sume)
    return ans
    
def f2(a, b, c):
    x=[int(a),int(b),int(c)]
    sume=[]
    for a in x:
        if a<0:
            sume.append(a)
        else:
            pass
    ans=max(sume)
    return ans
def f3(a, b, c):
    x=abs(a+b+c)
    s=str(x)
    a=s[0]
    return a
def f4(a, b, c):
    x=abs(a+b+c)
    s=str(x)
    a=s[-1]
    return a

def main():
#     print(f1(2, -18, 4))
#     print(f2(-20, -18, 4))
#     print(f3(2, -18, 4))
#     print(f4(2, -18, 4))
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print("Error")
        
exec(input().strip()) # DON'T remove this line

6530166121
# 1639375, 2022-09-24 09:28:50, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    num = [a,b,c]; new = []
    for e in num:
        if e>0:
            new.append(e)
    return min(new)
    
def f2(a, b, c):
    num = [a,b,c]; new = []
    for e in num:
        if e<0:
            new.append(e)
    return max(new)
    
    
def f3(a, b, c):
    s = a+b+c
    return str(abs(s))[0]
    
def f4(a, b, c):
    s = a+b+c
    return str(abs(s))[-1]
    

def main():
    x = input().split()
    x = [int(e) for e in x]
    s1 = x[0]; s2 = x[1]; a = x[2]; b = x[3]; c = x[4]
    
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
        
exec(input().strip())

# 1640579, 2022-09-24 10:01:31, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    num = [a,b,c]; new = []
    for e in num:
        if e>0:
            new.append(e)
    return min(new)
    
def f2(a, b, c):
    num = [a,b,c]; new = []
    for e in num:
        if e<0:
            new.append(e)
    return max(new)
    
    
def f3(a, b, c):
    s = a+b+c
    return str(abs(s))[0]
    
def f4(a, b, c):
    s = a+b+c
    return str(abs(s))[-1]
    

def main():
    x = input().split()
    x = [int(e) for e in x]
    s1 = x[0]; s2 = x[1]; a = x[2]; b = x[3]; c = x[4]
    
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
        
exec(input().strip())

# 1641612, 2022-09-24 10:25:41, ----[PP][PPPP] (33%)

def f1(a, b, c):
    num = [a,b,c]
    for e in num:
        if e<0:
            num.remove(e)
    return min(num)
    
def f2(a, b, c):
    num = [a,b,c]
    for e in num:
        if e>0:
            num.remove(e)
    return max(num)
    
    
def f3(a, b, c):
    s = a+b+c
    return str(abs(s))[0]
    
def f4(a, b, c):
    s = a+b+c
    return str(abs(s))[-1]
    

def main():
    x = input().split()
    x = [int(e) for e in x]
    s1 = x[0]; s2 = x[1]; a = x[2]; b = x[3]; c = x[4]
    
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
        
exec(input().strip())

# 1641945, 2022-09-24 10:31:32, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    num = [a,b,c]; new = []
    for e in num:
        if e>0:
            new.append(e)
    return min(new)
    
def f2(a, b, c):
    num = [a,b,c]; new = []
    for e in num:
        if e<0:
            new.append(e)
    return max(new)
    
    
def f3(a, b, c):
    s = a+b+c
    return str(abs(s))[0]
    
def f4(a, b, c):
    s = a+b+c
    return str(abs(s))[-1]
    

def main():
    x = input().split()
    x = [int(e) for e in x]
    s1 = x[0]; s2 = x[1]; a = x[2]; b = x[3]; c = x[4]
    
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
        
exec(input().strip())

# 1642130, 2022-09-24 10:34:46, PP--[PP][----] (50%)

def f1(a, b, c):
    num = [a,b,c]; new = []
    for e in num:
        if e>0:
            new.append(e)
    return min(new)
    
def f2(a, b, c):
    num = [a,b,c]; new = []
    for e in num:
        if e<0:
            new.append(e)
    return max(new)
    
    
def f3(a, b, c):
    s = a+b+c
    return str(abs(s))[0]
    
def f4(a, b, c):
    s = a+b+c
    return str(abs(s))[-1]
    

def main():
    x = input().split()
    x = [int(e) for e in x]
    s1 = x[0]; s2 = x[1]; a = x[2]; b = x[3]; c = x[4]
    
    if -1000 <= a <= 1000 and -1000 <= b <= 1000 and -1000 <= c <= 1000:
        if s1 == 0 and s2 == 0:
            print(f1(a, b, c))
        elif s1 == 0 and s2 == 1:
            print(f2(a, b, c))
        elif s1 == 1 and s2 == 0:
            print(f3(a, b, c))
        elif s1 == 1 and s2 == 1:
            print(f4(a, b, c))
        else:
            print('Error')
        
exec(input().strip())

# 1642261, 2022-09-24 10:36:36, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    num = [a,b,c]; new = []
    for e in num:
        if e>0:
            new.append(e)
    return min(new)
    
def f2(a, b, c):
    num = [a,b,c]; new = []
    for e in num:
        if e<0:
            new.append(e)
    return max(new)
    
    
def f3(a, b, c):
    s = a+b+c
    return str(abs(s))[0]
    
def f4(a, b, c):
    s = a+b+c
    return str(abs(s))[-1]
    

def main():
    x = input().split()
    x = [int(e) for e in x]
    s1 = x[0]; s2 = x[1]; a = x[2]; b = x[3]; c = x[4]
    

    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
        
exec(input().strip())


6231120121
# 1640413, 2022-09-24 09:57:12, PPP-[--][P-P-] (50%)

def f1(a,b,c):
    x = []
    if int(a) > 0 :
        x.append(int(a))
    if int(b) > 0 :
        x.append(int(b))
    if int(c) > 0 :
        x.append(int(c))
    y = min(x)
    return y

def f2(a,b,c):
    x = []
    if int(a) < 0 :
        x.append(int(a))
    if int(b) < 0 :
        x.append(int(b))
    if int(c) < 0 :
        x.append(int(c))
    y = max(x)
    return y

def f3(a,b,c):
    y = abs(int(a)+int(b)+int(c))
    z = (str(y))
    p = int(z[0])
    return p

def f4(a,b,c):
    y = abs(int(a)+int(b)+int(c))
    z = (str(y))
    p = int(z[1])
    return p

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else:
        print("Error")
    return

exec(input().strip()) # DON'T remove this line



# 1640756, 2022-09-24 10:06:18, PPP-[--][P-P-] (50%)

def f1(a,b,c):
    x = []
    if int(a) > 0 :
        x.append(int(a))
    if int(b) > 0 :
        x.append(int(b))
    if int(c) > 0 :
        x.append(int(c))
    y = int(min(x))
    return y

def f2(a,b,c):
    x = []
    if int(a) < 0 :
        x.append(int(a))
    if int(b) < 0 :
        x.append(int(b))
    if int(c) < 0 :
        x.append(int(c))
    y = int(max(x))
    return y

def f3(a,b,c):
    y = abs(int(a)+int(b)+int(c))
    z = (str(y))
    p = int(z[0])
    return p

def f4(a,b,c):
    y = abs(int(a)+int(b)+int(c))
    z = (str(y))
    p = int(z[1])
    return p

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else:
        print("Error")
    return

exec(input().strip()) # DON'T remove this line
# 1641018, 2022-09-24 10:13:01, PPP-[--][P-P-] (50%)

def f1(a,b,c):
    x = []
    if float(a) > 0 :
        x.append(float(a))
    if float(b) > 0 :
        x.append(float(b))
    if float(c) > 0 :
        x.append(float(c))
    y = int(min(x))
    return y

def f2(a,b,c):
    x = []
    if float(a) < 0 :
        x.append(float(a))
    if float(b) < 0 :
        x.append(float(b))
    if float(c) < 0 :
        x.append(float(c))
    y = int(max(x))
    return y

def f3(a,b,c):
    y = abs(float(a)+float(b)+float(c))
    z = (str(y))
    p = int(z[0])
    return p

def f4(a,b,c):
    y = abs(float(a)+float(b)+float(c))
    z = (str(y))
    p = int(z[1])
    return p

def main():
    s1,s2,a,b,c = [float(e) for e in input().split()]

    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else:
        print("Error")
    return

exec(input().strip()) # DON'T remove this line


# 1642151, 2022-09-24 10:35:13, PPPP[--][P-P-] (67%)

def f1(a,b,c):
    x = []
    if int(a) > 0 :
        x.append(int(a))
    if int(b) > 0 :
        x.append(int(b))
    if int(c) > 0 :
        x.append(int(c))
    y = int(min(x))
    return y

def f2(a,b,c):
    x = []
    if int(a) < 0 :
        x.append(int(a))
    if int(b) < 0 :
        x.append(int(b))
    if int(c) < 0 :
        x.append(int(c))
    y = int(max(x))
    return y

def f3(a,b,c):
    y = abs(int(a)+int(b)+int(c))
    z = (str(y))
    p = int(z[0])
    return p

def f4(a,b,c):
    y = abs(int(a)+int(b)+int(c))
    z = (str(y))
    p = int(z[len(str(y))-1])
    return p

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else:
        print("Error")
    return

exec(input().strip()) # DON'T remove this line
# 1642402, 2022-09-24 10:38:18, PPPP[--][P-P-] (67%)

def f1(a,b,c):
    x = []
    if int(a) > 0 :
        x.append(int(a))
    if int(b) > 0 :
        x.append(int(b))
    if int(c) > 0 :
        x.append(int(c))
    y = int(min(x))
    return y

def f2(a,b,c):
    x = []
    if int(a) < 0 :
        x.append(int(a))
    if int(b) < 0 :
        x.append(int(b))
    if int(c) < 0 :
        x.append(int(c))
    y = int(max(x))
    return y

def f3(a,b,c):
    y = abs(int(a)+int(b)+int(c))
    z = (str(y))
    p = int(z[0])
    return p

def f4(a,b,c):
    y = abs(int(a)+int(b)+int(c))
    z = (str(y))
    p = int(z[len(str(y))-1])
    return p

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else:
        print("Error")
    return

exec(input().strip()) # DON'T remove this line

6431501821
# 1640336, 2022-09-24 09:54:50, PP--[--][P-P-] (33%)

def f1(a,b,c):
    x = [a,b,c]
    out = []
    for e in x:
        if e > 0:
            out.append(e)
    return min(out)

def f2(a,b,c):
    x = [a,b,c]
    out = []
    for e in x:
        if e < 0:
            out.append(e)
    return max(out)

def f3(a,b,c):
    x = [a,b,c]
    out = 0
    for e in x:
        out += e
    if out < 0:
        out = out * -1
    elif 0 < out < 100:
        out = out // 10 % 10
    elif out >= 100:
        out = out //100%10
    out = str(out)
    return out[:1]

def f4(a,b,c):
    x = [a,b,c]
    out = 0
    for e in x:
        out += e
    out = str(out)
    return out[-1]    
        
def main():
    s1,s2,a,b,c = input().split()
    if s1==0 and s2 == 0:
        print(f1(a, b, c))
    elif s1==0 and s2 == 1:
        print(f2(a, b, c))
    elif s1==1 and s2 == 0:
        print(f3(a, b, c))
    elif s1==1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
    
exec(input().strip())        
        
        
        
        
        
        
        
        

# 1640429, 2022-09-24 09:57:39, PP--[PP][P-PP] (50%)

def f1(a,b,c):
    x = [a,b,c]
    out = []
    for e in x:
        if e > 0:
            out.append(e)
    return min(out)

def f2(a,b,c):
    x = [a,b,c]
    out = []
    for e in x:
        if e < 0:
            out.append(e)
    return max(out)

def f3(a,b,c):
    x = [a,b,c]
    out = 0
    for e in x:
        out += e
    if out < 0:
        out = out * -1
    elif 0 < out < 100:
        out = out // 10 % 10
    elif out >= 100:
        out = out //100%10
    out = str(out)
    return out[:1]

def f4(a,b,c):
    x = [a,b,c]
    out = 0
    for e in x:
        out += e
    out = str(out)
    return out[-1]    
        
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    
    if s1==0 and s2 == 0:
        print(f1(a, b, c))
    elif s1==0 and s2 == 1:
        print(f2(a, b, c))
    elif s1==1 and s2 == 0:
        print(f3(a, b, c))
    elif s1==1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
    
exec(input().strip())        
        
        
        
        
        
        
        
        

# 1642051, 2022-09-24 10:33:35, PP--[PP][PPPP] (67%)

def f1(a,b,c):
    x = [a,b,c]
    out = []
    for e in x:
        if e > 0:
            out.append(e)
    return min(out)

def f2(a,b,c):
    x = [a,b,c]
    out = []
    for e in x:
        if e < 0:
            out.append(e)
    return max(out)

def f3(a,b,c):
    x = [a,b,c]
    out = 0
    for e in x:
        out += e
    if out < 0:
        out = out * -1
    elif 0 < out < 100:
        out = out // 10 % 10
    elif 100<=out <=999:
        out = out //100%10
    elif out >= 1000:
        out = out // 1000%10
    out = str(out)
    return out[:1]

def f4(a,b,c):
    x = [a,b,c]
    out = 0
    for e in x:
        out += e
    out = str(out)
    return out[-1]    
        
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    
    if s1==0 and s2 == 0:
        print(f1(a, b, c))
    elif s1==0 and s2 == 1:
        print(f2(a, b, c))
    elif s1==1 and s2 == 0:
        print(f3(a, b, c))
    elif s1==1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
        


exec(input().strip())        
        
        
        
        
        
        
        
        

# 1642159, 2022-09-24 10:35:19, ----[PP][PPPP] (33%)

def f1(a,b,c):
    x = [a,b,c]
    out = []
    for e in x:
        if e >= 0:
            out.append(e)
        
    return min(out)

def f2(a,b,c):
    x = [a,b,c]
    out = []
    for e in x:
        if e <= 0:
            out.append(e)
    return max(out)

def f3(a,b,c):
    x = [a,b,c]
    out = 0
    for e in x:
        out += e
    if out < 0:
        out = out * -1
    elif 0 < out < 100:
        out = out // 10 % 10
    elif 100<=out <=999:
        out = out //100%10
    elif out >= 1000:
        out = out // 1000%10
    out = str(out)
    return out[:1]

def f4(a,b,c):
    x = [a,b,c]
    out = 0
    for e in x:
        out += e
    out = str(out)
    return out[-1]    
        
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    
    if s1==0 and s2 == 0:
        print(f1(a, b, c))
    elif s1==0 and s2 == 1:
        print(f2(a, b, c))
    elif s1==1 and s2 == 0:
        print(f3(a, b, c))
    elif s1==1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
        


exec(input().strip())        
        
        
        
        
        
        
        
        

# 1642219, 2022-09-24 10:36:04, PP--[PP][PPPP] (67%)

def f1(a,b,c):
    x = [a,b,c]
    out = []
    for e in x:
        if e > 0:
            out.append(e)
        
    return min(out)

def f2(a,b,c):
    x = [a,b,c]
    out = []
    for e in x:
        if e < 0:
            out.append(e)
    return max(out)

def f3(a,b,c):
    x = [a,b,c]
    out = 0
    for e in x:
        out += e
    if out < 0:
        out = out * -1
    elif 0 < out < 100:
        out = out // 10 % 10
    elif 100<=out <=999:
        out = out //100%10
    elif out >= 1000:
        out = out // 1000%10
    out = str(out)
    return out[:1]

def f4(a,b,c):
    x = [a,b,c]
    out = 0
    for e in x:
        out += e
    out = str(out)
    return out[-1]    
        
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    
    if s1==0 and s2 == 0:
        print(f1(a, b, c))
    elif s1==0 and s2 == 1:
        print(f2(a, b, c))
    elif s1==1 and s2 == 0:
        print(f3(a, b, c))
    elif s1==1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
        


exec(input().strip())

6530021821
# 1640070, 2022-09-24 09:47:27, PPx-[--][P-P-] (33%)

import math
def f1(a,b,c):
    ls = []
    if a > 0:
        ls.append(a)
    if b > 0:
        ls.append(b)
    if c > 0:
        ls.append(c)
        
    min_n = min(ls)
    ans = math.floor(min_n)
    return ans

def f2(a,b,c):
    ls =[]
    if a < 0:
        ls.append(a)
    if b < 0:
        ls.append(b)
    if c < 0:
        ls.append(c)
    max_n = max(ls)
    if max_n == math.floor(max_n):
        return max_n
    else:
        max_n = math.floor(max_n)
        max_n +=1
        return max_n
    

def f3(a,b,c):
    ls = [a,b,c]
    s = 0
    for i in range(len(ls)):
        s+= ls[i]
    
    if s > 0:
        ans = str(s)
        ans = ans[0]
    
    else:
        ans = str(s)
        ans = ans[1]
    
    return ans

def f4(a,b,c):
    ls = [a,b,c]
    s = 0
    for i in range(len(ls)):
        s+= ls[i]
    
    ans = str(s)
    ans = ans[-1]
    return ans


def main():
    k = [int(e) for e in input().split() ]
    if k[0] == 0 and k[1] ==0:
        print(f1(k[2],k[3],k[4]))
    if k[0] == 0 and k[1] ==1:
        print(f2(k[2],k[3],k[4]))
    if k[0] == 1 and k[1] ==0:
        print(f3(k[2],k[3],k[4]))
    if k[0] == 1 and k[1] ==1:
        print(f4(k[2],k[3],k[4]))
    else:
        print('Error')
        
exec(input().strip())

# 1640143, 2022-09-24 09:49:22, PPx-[--][P-P-] (33%)

import math
def f1(a,b,c):
    ls = []
    if a > 0:
        ls.append(a)
    if b > 0:
        ls.append(b)
    if c > 0:
        ls.append(c)
        
    min_n = min(ls)
    return min_n

def f2(a,b,c):
    ls =[]
    if a < 0:
        ls.append(a)
    if b < 0:
        ls.append(b)
    if c < 0:
        ls.append(c)
    max_n = max(ls)
    return max_n
    

def f3(a,b,c):
    ls = [a,b,c]
    s = 0
    for i in range(len(ls)):
        s+= ls[i]
    
    if s > 0:
        ans = str(s)
        ans = ans[0]
    
    else:
        ans = str(s)
        ans = ans[1]
    
    return ans

def f4(a,b,c):
    ls = [a,b,c]
    s = 0
    for i in range(len(ls)):
        s+= ls[i]
    
    ans = str(s)
    ans = ans[-1]
    return ans


def main():
    k = [int(e) for e in input().split() ]
    if k[0] == 0 and k[1] ==0:
        print(f1(k[2],k[3],k[4]))
    if k[0] == 0 and k[1] ==1:
        print(f2(k[2],k[3],k[4]))
    if k[0] == 1 and k[1] ==0:
        print(f3(k[2],k[3],k[4]))
    if k[0] == 1 and k[1] ==1:
        print(f4(k[2],k[3],k[4]))
    else:
        print('Error')
        
exec(input().strip())

# 1640759, 2022-09-24 10:06:18, PPx-[--][P-P-] (33%)

def f1(a,b,c):
    ls = []
    if a > 0:
        ls.append(a)
    if b > 0:
        ls.append(b)
    if c > 0:
        ls.append(c)
        
    min_n = min(ls)
    return min_n

def f2(a,b,c):
    ls =[]
    if a < 0:
        ls.append(a)
    if b < 0:
        ls.append(b)
    if c < 0:
        ls.append(c)
    max_n = max(ls)
    return max_n
    

def f3(a,b,c):
    ls = [a,b,c]
    s = 0
    for i in range(len(ls)):
        s+= ls[i]
    
    if s > 0:
        ans = str(s)
        ans = ans[0]
    
    else:
        ans = str(s)
        ans = ans[1]
    
    return ans

def f4(a,b,c):
    ls = [a,b,c]
    s = 0
    for i in range(len(ls)):
        s+= ls[i]
    
    ans = str(s)
    ans = ans[-1]
    return ans


def main():
    k = [int(e) for e in input().split() ]
    if k[0] == 0 and k[1] ==0:
        print(f1(k[2],k[3],k[4]))
    if k[0] == 0 and k[1] ==1:
        print(f2(k[2],k[3],k[4]))
    if k[0] == 1 and k[1] ==0:
        print(f3(k[2],k[3],k[4]))
    if k[0] == 1 and k[1] ==1:
        print(f4(k[2],k[3],k[4]))
    else:
        print('Error')
        
exec(input().strip())

# 1641553, 2022-09-24 10:24:38, PPxP[--][P-P-] (50%)

def f1(a,b,c):
    ls = []
    if a > 0:
        ls.append(a)
    if b > 0:
        ls.append(b)
    if c > 0:
        ls.append(c)
        
    min_n = min(ls)
    return int(min_n)

def f2(a,b,c):
    ls =[]
    if a < 0:
        ls.append(a)
    if b < 0:
        ls.append(b)
    if c < 0:
        ls.append(c)
    max_n = max(ls)
    return int(max_n)
    

def f3(a,b,c):
    ls = [a,b,c]
    s = 0
    for i in range(len(ls)):
        s+= ls[i]
    
    if s > 0:
        ans = str(s)
        ans = ans[0]
    
    else:
        ans = str(s)
        ans = ans[1]
    
    return int(ans)

def f4(a,b,c):
    ls = [a,b,c]
    s = 0
    for i in range(len(ls)):
        s+= ls[i]
    
    ans = str(s)
    ans = ans[-1]
    return int(ans)


def main():
    k = [int(e) for e in input().split() ]
    if k[0] == 0 and k[1] ==0:
        print(f1(k[2],k[3],k[4]))
    if k[0] == 0 and k[1] ==1:
        print(f2(k[2],k[3],k[4]))
    if k[0] == 1 and k[1] ==0:
        print(f3(k[2],k[3],k[4]))
    if k[0] == 1 and k[1] ==1:
        print(f4(k[2],k[3],k[4]))
    else:
        print('Error')
        
exec(input().strip())

# 1641803, 2022-09-24 10:29:16, PPPP[--][P-P-] (67%)

def f1(a,b,c):
    ls = []
    if a > 0:
        ls.append(a)
    if b > 0:
        ls.append(b)
    if c > 0:
        ls.append(c)
        
    min_n = min(ls)
    return int(min_n)

def f2(a,b,c):
    ls =[]
    if a < 0:
        ls.append(a)
    if b < 0:
        ls.append(b)
    if c < 0:
        ls.append(c)
    max_n = max(ls)
    return int(max_n)
    

def f3(a,b,c):
    ls = [a,b,c]
    s = 0
    for i in range(len(ls)):
        s+= ls[i]
    
    if s >=0:
        ans = str(s)
        ans = ans[0]
    
    else:
        ans = str(s)
        ans = ans[1]
    
    return int(ans)

def f4(a,b,c):
    ls = [a,b,c]
    s = 0
    for i in range(len(ls)):
        s+= ls[i]
    
    ans = str(s)
    ans = ans[-1]
    return int(ans)


def main():
    k = [int(e) for e in input().split() ]
    if k[0] == 0 and k[1] ==0:
        print(f1(k[2],k[3],k[4]))
    if k[0] == 0 and k[1] ==1:
        print(f2(k[2],k[3],k[4]))
    if k[0] == 1 and k[1] ==0:
        print(f3(k[2],k[3],k[4]))
    if k[0] == 1 and k[1] ==1:
        print(f4(k[2],k[3],k[4]))
    else:
        print('Error')
        
exec(input().strip())


6530038521
# 1639703, 2022-09-24 09:37:14, PP--[PP][P-P-] (50%)

def f1(a,b,c):
    set1=[]
    if a > 0:
        set1.append(a)
    if b > 0:
        set1.append(b)
    if c > 0:
        set1.append(c)
    set1.sort()
    return set1[0]

def f2(a,b,c):
    set2=[]
    if a < 0:
        set2.append(a)
    if b < 0:
        set2.append(b)
    if c < 0:
        set2.append(c)
    set2.sort()
    return set2[-1]

def f3(a,b,c):
    set3 = [a,b,c]
    for k in range(len(set3)):
        if set3[k] < 0:
            set3[k] = (-1)*set3[k]
    for c in range(len(set3)):
        set3[c] = str(set3[c])
    set3_1 = []
    for c1 in range(len(set3)):
        set3_1.append(int(set3[c1][0]))
    s1 = 0
    for c2 in range(len(set3_1)):
        s1 += set3_1[c2]
    return s1
    
def f4(a,b,c):
    set4 = [a,b,c]
    for k in range(len(set4)):
        if set4[k] < 0:
            set4[k] = (-1)*set4[k]
    for c in range(len(set4)):
        set4[c] = str(set4[c])
    set4_1 = []
    for c1 in range(len(set4)):
        set4_1.append(int(set4[c1][-1]))
    s2 = 0
    for c2 in range(len(set4_1)):
        s2 += set4_1[c2]
    return s2
    
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
        
exec(input().strip())
# 1640828, 2022-09-24 10:08:04, Px--[Px][P-P-] (17%)

def f1(a,b,c):
    set=[a,b,c]
    set1=[]
    for i in range(len(set)):
        if set[i] > 0:
            set1.append(set[i])
    s = min(set1)
    return s

def f2(a,b,c):
    set=[a,b,c]
    set2=[]
    for i in range(len(set)):
        if set[i] < 0:
            set1.append(set[i])
    s = max(set1)
    return s

def f3(a,b,c):
    set3 = [a,b,c]
    for k in range(len(set3)):
        if set3[k] < 0:
            set3[k] = (-1)*set3[k]
    for c in range(len(set3)):
        set3[c] = str(set3[c])
    set3_1 = []
    for c1 in range(len(set3)):
        set3_1.append(int(set3[c1][0]))
    s1 = 0
    for c2 in range(len(set3_1)):
        s1 += set3_1[c2]
    return s1
    
def f4(a,b,c):
    set4 = [a,b,c]
    for k in range(len(set4)):
        if set4[k] < 0:
            set4[k] = (-1)*set4[k]
    for c in range(len(set4)):
        set4[c] = str(set4[c])
    set4_1 = []
    for c1 in range(len(set4)):
        set4_1.append(int(set4[c1][-1]))
    s2 = 0
    for c2 in range(len(set4_1)):
        s2 += set4_1[c2]
    return s2
    
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
        
exec(input().strip())
# 1640854, 2022-09-24 10:08:41, PP--[PP][P-P-] (50%)

def f1(a,b,c):
    set1=[]
    if a > 0:
        set1.append(a)
    if b > 0:
        set1.append(b)
    if c > 0:
        set1.append(c)
    set1.sort()
    return set1[0]

def f2(a,b,c):
    set2=[]
    if a < 0:
        set2.append(a)
    if b < 0:
        set2.append(b)
    if c < 0:
        set2.append(c)
    set2.sort()
    return set2[-1]

def f3(a,b,c):
    set3 = [a,b,c]
    for k in range(len(set3)):
        if set3[k] < 0:
            set3[k] = (-1)*set3[k]
    for c in range(len(set3)):
        set3[c] = str(set3[c])
    set3_1 = []
    for c1 in range(len(set3)):
        set3_1.append(int(set3[c1][0]))
    s1 = 0
    for c2 in range(len(set3_1)):
        s1 += set3_1[c2]
    return s1
    
def f4(a,b,c):
    set4 = [a,b,c]
    for k in range(len(set4)):
        if set4[k] < 0:
            set4[k] = (-1)*set4[k]
    for c in range(len(set4)):
        set4[c] = str(set4[c])
    set4_1 = []
    for c1 in range(len(set4)):
        set4_1.append(int(set4[c1][-1]))
    s2 = 0
    for c2 in range(len(set4_1)):
        s2 += set4_1[c2]
    return s2
    
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
        
exec(input().strip())
# 1641248, 2022-09-24 10:18:30, PP--[PP][PPPP] (67%)

def f1(a,b,c):
    set1=[]
    if a > 0:
        set1.append(a)
    if b > 0:
        set1.append(b)
    if c > 0:
        set1.append(c)
    set1.sort()
    return set1[0]

def f2(a,b,c):
    set2=[]
    if a < 0:
        set2.append(a)
    if b < 0:
        set2.append(b)
    if c < 0:
        set2.append(c)
    set2.sort()
    return set2[-1]

def f3(a,b,c):
    s_0 = 0
    set3 = [a,b,c]
    for i in range(len(set3)):
        s_0 += set3[i]
    if s_0 < 0:
        s_0 = (-1)*s_0
    s = str(s_0)
    s1 = s[0]
    return s1
        
def f4(a,b,c):
    s_0 = 0
    set3 = [a,b,c]
    for i in range(len(set3)):
        s_0 += set3[i]
    if s_0 < 0:
        s_0 = (-1)*s_0
    s = str(s_0)
    s2 = s[-1]
    return s2
    
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
        
exec(input().strip())

# 1641395, 2022-09-24 10:21:22, PP--[PP][PPPP] (67%)

def f1(a,b,c):
    set=[a,b,c]
    s = []
    for i in range(len(set)):
        if set[i] > 0:
            s.append(set[i])
    s.sort()
    return s[0]

def f2(a,b,c):
    set=[a,b,c]
    s = []
    for i in range(len(set)):
        if set[i] < 0:
            s.append(set[i])
    s.sort()
    return s[-1]

def f3(a,b,c):
    s_0 = 0
    set3 = [a,b,c]
    for i in range(len(set3)):
        s_0 += set3[i]
    if s_0 < 0:
        s_0 = (-1)*s_0
    s = str(s_0)
    s1 = s[0]
    return s1
        
def f4(a,b,c):
    s_0 = 0
    set3 = [a,b,c]
    for i in range(len(set3)):
        s_0 += set3[i]
    if s_0 < 0:
        s_0 = (-1)*s_0
    s = str(s_0)
    s2 = s[-1]
    return s2
    
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
        
exec(input().strip())

6530066021
# 1641551, 2022-09-24 10:24:36, compilation error (0%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for i in range (len(x)) :
        if (x[i] > 0) :
            y.append(x[i])
    return(min(y))
    
def f2(a, b, c):
    x = [a,b,c]
    y = []
    for i in range (len(x)) :
        if (x[i] < 0) :
            y.append(x[i])
    return(max(y))
    
def f3(a, b, c):
    x = a + b + c
    if (x<0) :
        x = str(x)
        x = x[1:len(x)]
        return(int(x[0])) 
    else :
        x = str(x)
        return(int(x[0]))
    
def f4(a, b, c):
    x = a + b + c
    if (-10 < x < 10) :
        x = str(x)
        x = x[1:len(x)]
        return(int(x))
    else :
        x = str(x)
        x = x[-1]
        return(int(x))

def main():
exec(input().strip())
# 1641572, 2022-09-24 10:24:51, ----[--][----] (0%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for i in range (len(x)) :
        if (x[i] > 0) :
            y.append(x[i])
    return(min(y))
    
def f2(a, b, c):
    x = [a,b,c]
    y = []
    for i in range (len(x)) :
        if (x[i] < 0) :
            y.append(x[i])
    return(max(y))
    
def f3(a, b, c):
    x = a + b + c
    if (x<0) :
        x = str(x)
        x = x[1:len(x)]
        return(int(x[0])) 
    else :
        x = str(x)
        return(int(x[0]))
    
def f4(a, b, c):
    x = a + b + c
    if (-10 < x < 10) :
        x = str(x)
        x = x[1:len(x)]
        return(int(x))
    else :
        x = str(x)
        x = x[-1]
        return(int(x))


# 1641911, 2022-09-24 10:30:54, PPPP[--][P-P-] (67%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for i in range (len(x)) :
        if (x[i] > 0) :
            y.append(x[i])
    return(min(y))
    
def f2(a, b, c):
    x = [a,b,c]
    y = []
    for i in range (len(x)) :
        if (x[i] < 0) :
            y.append(x[i])
    return(max(y))
    
def f3(a, b, c):
    x = a + b + c
    if (x<0) :
        x = str(x)
        x = x[1:len(x)]
        return(int(x[0])) 
    else :
        x = str(x)
        return(int(x[0]))
    
def f4(a, b, c):
    x = a + b + c
    if (-10 < x < 10) :
        x = str(x)
        x = x[1:len(x)]
        return(int(x))
    else :
        x = str(x)
        x = x[-1]
        return(int(x))

def main():
    x =  [int(e) for e in input().split()]
    a = x[2]
    b = x[3]
    c = x[4]
    if (x[0] == 0 and x[1] == 0 ) :
        print(f1(a, b, c))
    if (x[0] == 0 and x[1] == 1 ) :
        print(f2(a, b, c))
    if (x[0] == 1 and x[1] == 0 ) :
        print(f3(a, b, c))
    if (x[0] == 1 and x[1] == 1 ) :
        print(f4(a, b, c))
    else :
        print('Error')
exec(input().strip())
# 1642202, 2022-09-24 10:35:49, PPPP[--][P-P-] (67%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for i in range (len(x)) :
        if (x[i] > 0) :
            y.append(x[i])
    return(min(y))
    
def f2(a, b, c):
    x = [a,b,c]
    y = []
    for i in range (len(x)) :
        if (x[i] < 0) :
            y.append(x[i])
    return(max(y))
    
def f3(a, b, c):
    x = a + b + c
    if (x<0) :
        x = str(x)
        x = x[1:len(x)]
        return(int(x[0])) 
    else :
        x = str(x)
        return(int(x[0]))
    
def f4(a, b, c):
    x = a + b + c
    if (-10 < x < 0) :
        x = str(x)
        x = x[1:len(x)]
        return(int(x))
    else :
        x = str(x)
        x = x[-1]
        return(int(x))

def main():
    x =  [int(e) for e in input().split()]
    a = x[2]
    b = x[3]
    c = x[4]
    if (x[0] == 0 and x[1] == 0 ) :
        print(f1(a, b, c))
    if (x[0] == 0 and x[1] == 1 ) :
        print(f2(a, b, c))
    if (x[0] == 1 and x[1] == 0 ) :
        print(f3(a, b, c))
    if (x[0] == 1 and x[1] == 1 ) :
        print(f4(a, b, c))
    else :
        print('Error')
exec(input().strip())
# 1642282, 2022-09-24 10:36:52, PPPP[--][P-P-] (67%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for i in range (len(x)) :
        if (x[i] > 0) :
            y.append(x[i])
    return(min(y))
    
def f2(a, b, c):
    x = [a,b,c]
    y = []
    for i in range (len(x)) :
        if (x[i] < 0) :
            y.append(x[i])
    return(max(y))
    
def f3(a, b, c):
    x = a + b + c
    if (x<0) :
        x = str(x)
        x = x[1:len(x)]
        return(int(x[0])) 
    else :
        x = str(x)
        return(int(x[0]))
    
def f4(a, b, c):
    x = a + b + c
    if (-10 < x < 0) :
        x = str(x)
        x = x[1:len(x)]
        return(int(x))
    else :
        x = str(x)
        x = x[-1]
        return(int(x))

def main():
    x =  [int(e) for e in input().split()]
    a = x[2]
    b = x[3]
    c = x[4]
    if (x[0] == 0 and x[1] == 0 ) :
        print(f1(a, b, c))
    if (x[0] == 0 and x[1] == 1 ) :
        print(f2(a, b, c))
    if (x[0] == 1 and x[1] == 0 ) :
        print(f3(a, b, c))
    if (x[0] == 1 and x[1] == 1 ) :
        print(f4(a, b, c))
    else :
        print('Error')
exec(input().strip())

6530152321
# 1639343, 2022-09-24 09:28:05, PP--[PP][-P-P] (50%)

def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    p = []
    if a>0:
        p.append(a)
    if b>0:
        p.append(b)
    if c>0:
        p.append(c)
    return min(p)
def f2(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    p = []
    if a<0:
        p.append(a)
    if b<0:
        p.append(b)
    if c<0:
        p.append(c)
    return max(p)
def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    p = a+b+c
    p = str(p)
    if '-' in p:
        return p[1]
    else:
        return p[0]
def f4(a, b, c):

    a = int(a)
    b = int(b)
    c = int(c)
    p = a+b+c
    p = str(p)
    return p[-1]
def main():

    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
exec(input().strip())
# 1639474, 2022-09-24 09:31:22, PP--[PP][----] (50%)

def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    p = []
    if a>0:
        p.append(a)
    if b>0:
        p.append(b)
    if c>0:
        p.append(c)
    return min(p)
def f2(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    p = []
    if a<0:
        p.append(a)
    if b<0:
        p.append(b)
    if c<0:
        p.append(c)
    return max(p)
def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    p = a+b+c
    p = str(p)
    if '-' in p:
        return p[1]
    else:
        return p[0]
def f4(a, b, c):

    a = int(a)
    b = int(b)
    c = int(c)
    p = a+b+c
    p = str(p)
    return p[-1]
def main():

    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    if s1 or s2 != 0:
        if s1 or s2 != 1:
            print('ERROR')
exec(input().strip())
# 1639516, 2022-09-24 09:32:11, PP--[PP][P-P-] (50%)

def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    p = []
    if a>0:
        p.append(a)
    if b>0:
        p.append(b)
    if c>0:
        p.append(c)
    return min(p)
def f2(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    p = []
    if a<0:
        p.append(a)
    if b<0:
        p.append(b)
    if c<0:
        p.append(c)
    return max(p)
def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    p = a+b+c
    p = str(p)
    if '-' in p:
        return p[1]
    else:
        return p[0]
def f4(a, b, c):

    a = int(a)
    b = int(b)
    c = int(c)
    p = a+b+c
    p = str(p)
    return p[-1]
def main():

    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    if s1 or s2 != 0:
        if s1 or s2 != 1:
            print('Error')
exec(input().strip())
# 1639659, 2022-09-24 09:35:55, PP--[PP][P-P-] (50%)

def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    p = []
    if a>0:
        p.append(a)
    if b>0:
        p.append(b)
    if c>0:
        p.append(c)
    return min(p)
def f2(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    p = []
    if a<0:
        p.append(a)
    if b<0:
        p.append(b)
    if c<0:
        p.append(c)
    return max(p)
def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    p = a+b+c
    p = str(p)
    if p[0] == '-':
        return p[1]
    else:
        return p[0]
def f4(a, b, c):

    a = int(a)
    b = int(b)
    c = int(c)
    p = a+b+c
    p = str(p)
    return p[-1]
def main():

    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    if s1 or s2 != 0:
        if s1 or s2 != 1:
            print('Error')
exec(input().strip())
# 1640350, 2022-09-24 09:55:25, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    p = []
    if a>0:
        p.append(a)
    if b>0:
        p.append(b)
    if c>0:
        p.append(c)
    return min(p)
def f2(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    p = []
    if a<0:
        p.append(a)
    if b<0:
        p.append(b)
    if c<0:
        p.append(c)
    return max(p)
def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    p = a+b+c
    p = str(p)
    if p[0] == '-':
        return p[1]
    else:
        return p[0]
def f4(a, b, c):

    a = int(a)
    b = int(b)
    c = int(c)
    p = a+b+c
    p = str(p)
    return p[-1]
def main():

    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    if (s1 != 0 and s1 != 1) or (s2 != 0 and s2 != 1):
        print('Error')
exec(input().strip())

6530183821
# 1641010, 2022-09-24 10:12:52, PP--[xx][xxxx] (33%)

def f1(a, b, c):
    l=[]
    if a>0:
        l.append(a)
    if b>0:
        l.append(b)
    if c>0:
        l.append(c)
    return min(l)
def f2(a, b, c):
    l=[]
    if a<0:
        l.append(a)
    if b<0:
        l.append(b)
    if c<0:
        l.append(c)
    return max(l)
def f3(a, b, c):
    s=a+b+c
    if s<0:
        s=s*(-1)
    return str(s)[0]
def f4(a, b, c):
    s=a+b+c
    if s<0:
        s=s*(-1)
    return str(s)[-1]
def main():
    x=input().strip()
    s1,s2,a,b,c=[int(e) for e in x.split]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip())
    
# 1641272, 2022-09-24 10:19:02, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    l=[]
    if a>0:
        l.append(a)
    if b>0:
        l.append(b)
    if c>0:
        l.append(c)
    return min(l)
def f2(a, b, c):
    l=[]
    if a<0:
        l.append(a)
    if b<0:
        l.append(b)
    if c<0:
        l.append(c)
    return max(l)
def f3(a, b, c):
    s=a+b+c
    if s<0:
        s=s*(-1)
    return str(s)[0]
def f4(a, b, c):
    s=a+b+c
    if s<0:
        s=s*(-1)
    return str(s)[-1]
def main():
    x=input().split()
    x=[int(e) for e in x]
    if x[0]==0 and x[1]==0:
        print(f1(x[2],x[3],x[4]))
    elif x[0]==0 and x[1]==1:
        print(f2(x[2],x[3],x[4]))
    elif x[0]==1 and x[1]==0:
        print(f3(x[2],x[3],x[4]))
    elif x[0]==1 and x[1]==1:
        print(f4(x[2],x[3],x[4]))
    else:
        print("Error")
exec(input().strip())
    
# 1641697, 2022-09-24 10:27:13, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    l=[]
    if a>0:
        l.append(a)
    if b>0:
        l.append(b)
    if c>0:
        l.append(c)
    return min(l)
def f2(a, b, c):
    l=[]
    if a<0:
        l.append(a)
    if b<0:
        l.append(b)
    if c<0:
        l.append(c)
    return max(l)
def f3(a, b, c):
    s=a+b+c
    if s<0:
        s=s*(-1)
    return str(s)[0]
def f4(a, b, c):
    s=a+b+c
    if s<0:
        s=s*(-1)
    return str(s)[-1]
def main():
    x=input().split()
    x=[int(e) for e in x]
    if x[0]==0 and x[1]==0:
        print(f1(x[2],x[3],x[4]))
    elif x[0]==0 and x[1]==1:
        print(f2(x[2],x[3],x[4]))
    elif x[0]==1 and x[1]==0:
        print(f3(x[2],x[3],x[4]))
    elif x[0]==1 and x[1]==1:
        print(f4(x[2],x[3],x[4]))
    else:
        print("Error")
exec(input().strip())
# 1641897, 2022-09-24 10:30:40, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    l=[]
    if a>0:
        l.append(a)
    if b>0:
        l.append(b)
    if c>0:
        l.append(c)
    return min(l)
def f2(a, b, c):
    l=[]
    if a<0:
        l.append(a)
    if b<0:
        l.append(b)
    if c<0:
        l.append(c)
    return max(l)
def f3(a, b, c):
    s=a+b+c
    if s<0:
        s=s*(-1)
    return str(s)[0]
def f4(a, b, c):
    s=a+b+c
    if s<0:
        s=s*(-1)
    return str(s)[-1]
def main():
    x=[0]*10
    x=input().split()
    x=[int(e) for e in x]
    if x[0]==0 and x[1]==0:
        print(f1(x[2],x[3],x[4]))
    elif x[0]==0 and x[1]==1:
        print(f2(x[2],x[3],x[4]))
    elif x[0]==1 and x[1]==0:
        print(f3(x[2],x[3],x[4]))
    elif x[0]==1 and x[1]==1:
        print(f4(x[2],x[3],x[4]))
    else:
        print("Error")
exec(input().strip())
# 1641905, 2022-09-24 10:30:51, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    l=[]
    if a>0:
        l.append(a)
    if b>0:
        l.append(b)
    if c>0:
        l.append(c)
    return min(l)
def f2(a, b, c):
    l=[]
    if a<0:
        l.append(a)
    if b<0:
        l.append(b)
    if c<0:
        l.append(c)
    return max(l)
def f3(a, b, c):
    s=a+b+c
    if s<0:
        s=s*(-1)
    return str(s)[0]
def f4(a, b, c):
    s=a+b+c
    if s<0:
        s=s*(-1)
    return str(s)[-1]
def main():
    x=input().split()
    x=[int(e) for e in x]
    if x[0]==0 and x[1]==0:
        print(f1(x[2],x[3],x[4]))
    elif x[0]==0 and x[1]==1:
        print(f2(x[2],x[3],x[4]))
    elif x[0]==1 and x[1]==0:
        print(f3(x[2],x[3],x[4]))
    elif x[0]==1 and x[1]==1:
        print(f4(x[2],x[3],x[4]))
    else:
        print("Error")
exec(input().strip())

6530195321
# 1639331, 2022-09-24 09:27:42, PPxx[PP][PxPx] (50%)

def f1(a, b, c):
    for i in range(-1000,10001):
        if (i == a or i == b or i == c) and i>0:
            return i
    
 
def f2(a, b, c):
    for i in range(1000,-1001,-1):
        if (i == a or i == b or i == c) and i<0:
            return i
def f3(a, b, c):
    sum_ = a + b + c
    return sum_[0]
 
def f4(a, b, c):
    sum_ = a + b + c
    return sum_[-1]
 
def main():
    s1,s2,a,b,c = input().split()
    if int(s1) == 0 and int(s2) == 0:
        print(f1(int(a), int(b), int(c)))
    elif int(s1) == 0 and int(s2) == 1:
        print(f2(int(a), int(b), int(c)))
    elif int(s1) == 1 and int(s2) == 0:
        print(f3(int(a), int(b), int(c)))
    elif int(s1) == 1 and int(s2) == 1:
        print(f4(int(a), int(b), int(c)))
    else:
        print("Error")
        
exec(input().strip()) # DON'T remove this lin
# 1639445, 2022-09-24 09:30:31, PP--[PP][PPP-] (50%)

def f1(a, b, c):
    for i in range(-1000,10001):
        if (i == a or i == b or i == c) and i>0:
            return i
    
 
def f2(a, b, c):
    for i in range(1000,-1001,-1):
        if (i == a or i == b or i == c) and i<0:
            return i
def f3(a, b, c):
    sum_ = a + b + c
    return str(sum_)[0]
 
def f4(a, b, c):
    sum_ = a + b + c
    return str(sum_)[-1]
 
def main():
    s1,s2,a,b,c = input().split()
    if int(s1) == 0 and int(s2) == 0:
        print(f1(int(a), int(b), int(c)))
    elif int(s1) == 0 and int(s2) == 1:
        print(f2(int(a), int(b), int(c)))
    elif int(s1) == 1 and int(s2) == 0:
        print(f3(int(a), int(b), int(c)))
    elif int(s1) == 1 and int(s2) == 1:
        print(f4(int(a), int(b), int(c)))
    else:
        print("Error")
        
exec(input().strip()) # DON'T remove this lin
# 1641111, 2022-09-24 10:15:36, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    for i in range(-1000,10001):
        if (i == a or i == b or i == c) and i>0:
            return i
    
 
def f2(a, b, c):
    for i in range(1000,-1001,-1):
        if (i == a or i == b or i == c) and i<0:
            return i
def f3(a, b, c):
    sum_ = a + b + c
    if str(sum_)[0] == '-':
        return str(sum_)[1]
    else: return str(sum_)[0]
 
def f4(a, b, c):
    sum_ = a + b + c
    if str(sum_)[0] == '-':
        return str(sum_)[1]
    else: return str(sum_)[0]
 
def main():
    s1,s2,a,b,c = input().split()
    if int(s1) == 0 and int(s2) == 0:
        print(f1(int(a), int(b), int(c)))
    elif int(s1) == 0 and int(s2) == 1:
        print(f2(int(a), int(b), int(c)))
    elif int(s1) == 1 and int(s2) == 0:
        print(f3(int(a), int(b), int(c)))
    elif int(s1) == 1 and int(s2) == 1:
        print(f4(int(a), int(b), int(c)))
    else:
        print("Error")
        
exec(input().strip()) # DON'T remove this lin
# 1641304, 2022-09-24 10:19:37, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    for i in range(-1000,10001):
        if (i == a or i == b or i == c) and i>0:
            return i
    
 
def f2(a, b, c):
    for i in range(1000,-1001,-1):
        if (i == a or i == b or i == c) and i<0:
            return i
def f3(a, b, c):
    sum_ = a + b + c
    if str(sum_)[0] == '-':
        return str(sum_)[1]
    else: return str(sum_)[0]
 
def f4(a, b, c):
    sum_ = a + b + c
    if str(sum_)[0] == '-':
        return str(sum_)[-1]
    else: return str(sum_)[-1]
 
def main():
    s1,s2,a,b,c = input().split()
    if int(s1) == 0 and int(s2) == 0:
        print(f1(int(a), int(b), int(c)))
    elif int(s1) == 0 and int(s2) == 1:
        print(f2(int(a), int(b), int(c)))
    elif int(s1) == 1 and int(s2) == 0:
        print(f3(int(a), int(b), int(c)))
    elif int(s1) == 1 and int(s2) == 1:
        print(f4(int(a), int(b), int(c)))
    else:
        print("Error")
        
exec(input().strip()) # DON'T remove this lin
# 1641441, 2022-09-24 10:22:19, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    for i in range(-1000,10001):
        if (i == a or i == b or i == c) and i>0:
            return i
    
 
def f2(a, b, c):
    for i in range(1000,-1001,-1):
        if (i == a or i == b or i == c) and i<0:
            return i
def f3(a, b, c):
    sum_ = a + b + c
    if str(sum_)[0] == '-':
        return str(sum_)[1]
    else: return str(sum_)[0]
 
def f4(a, b, c):
    sum_ = a + b + c
    return str(sum_)[-1]
 
def main():
    s1,s2,a,b,c = input().split()
    if int(s1) == 0 and int(s2) == 0:
        print(f1(int(a), int(b), int(c)))
    elif int(s1) == 0 and int(s2) == 1:
        print(f2(int(a), int(b), int(c)))
    elif int(s1) == 1 and int(s2) == 0:
        print(f3(int(a), int(b), int(c)))
    elif int(s1) == 1 and int(s2) == 1:
        print(f4(int(a), int(b), int(c)))
    else:
        print("Error")
        
exec(input().strip()) # DON'T remove this lin

6530213021
# 1640447, 2022-09-24 09:58:11, PP--[--][----] (33%)

def f1(a, b, c):

    pos = []
    if a > 0:
        pos.append(a)
    if b > 0:
        pos.append(b)
    if c > 0:
        pos.append(c)
    pos.sort()
    return pos[0]

def f2(a, b, c):

    pos = []
    if a < 0:
        pos.append(a)
    if b < 0:
        pos.append(b)
    if c < 0:
        pos.append(c)
    pos.sort()
    return pos[-1]

def f3(a, b, c):

    sum = 0
    for e in (a,b,c):
        sum += e
    if sum>=0:
        sum2 = sum
    else:
        sum2 = (-1)*sum
    sum3 = ""
    sum3 += str(sum2)
    return sum3[0]

def f4(a, b, c):
    sum = 0
    for e in (a,b,c):
        sum += e
    if sum>=0:
        sum2 = sum
    else:
        sum2 = (-1)*sum
    sum3 = ""
    sum3 += str(sum2)
    return sum3[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 not in (0,1) or s2 not in (0,1):
        return "Error"
    elif s1 == 0:
        if s2 == 0:
            return f1(a, b, c)
        else:
            return f2(a, b, c)

    else:
        if s2 == 0:
            return f3(a, b, c)
        else:
            return f4(a, b, c)

    
            

exec(input().strip()) # DON'T remove this line
# 1640594, 2022-09-24 10:02:04, -P--[--][----] (17%)

def f1(a, b, c):

    pos = []
    if a > 0:
        pos.append(int(a))
    if b > 0:
        pos.append(int(b))
    if c > 0:
        pos.append(int(c))
    
    return pos[0]

def f2(a, b, c):

    pos = []
    if a < 0:
        pos.append(int(a))
    if b < 0:
        pos.append(int(b))
    if c < 0:
        pos.append(int(c))
    pos.sort()
    return pos[-1]

def f3(a, b, c):

    a = int(a)
    b = int(b)
    c = int(c)
    sum = 0
    for e in (a,b,c):
        sum += e
    if sum>=0:
        sum2 = sum
    else:
        sum2 = (-1)*sum
    sum3 = ""
    sum3 += str(sum2)
    return sum3[0]

def f4(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    sum = 0
    for e in (a,b,c):
        sum += e
    if sum>=0:
        sum2 = sum
    else:
        sum2 = (-1)*sum
    sum3 = ""
    sum3 += str(sum2)
    return sum3[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 not in (0,1) or s2 not in (0,1):
        return "Error"
    elif s1 == 0:
        if s2 == 0:
            return f1(a, b, c)
        else:
            return f2(a, b, c)

    else:
        if s2 == 0:
            return f3(a, b, c)
        else:
            return f4(a, b, c)

    
            

exec(input().strip()) # DON'T remove this line
# 1640792, 2022-09-24 10:07:12, PPPP[--][----] (67%)

def f1(a, b, c):

    pos = []
    if a > 0:
        pos.append(int(a))
    if b > 0:
        pos.append(int(b))
    if c > 0:
        pos.append(int(c))
    pos.sort()
    return pos[0]

def f2(a, b, c):

    pos = []
    if a < 0:
        pos.append(int(a))
    if b < 0:
        pos.append(int(b))
    if c < 0:
        pos.append(int(c))
    pos.sort()
    return pos[-1]

def f3(a, b, c):

    a = int(a)
    b = int(b)
    c = int(c)
    sum = 0
    for e in (a,b,c):
        sum += e
    if sum>=0:
        sum2 = sum
    else:
        sum2 = (-1)*sum
    sum3 = ""
    sum3 += str(sum2)
    return int(sum3[0])

def f4(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    sum = 0
    for e in (a,b,c):
        sum += e
    if sum>=0:
        sum2 = sum
    else:
        sum2 = (-1)*sum
    sum3 = ""
    sum3 += str(sum2)
    return int(sum3[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 not in (0,1) or s2 not in (0,1):
        return "Error"
    elif s1 == 0:
        if s2 == 0:
            return f1(a, b, c)
        else:
            return f2(a, b, c)

    else:
        if s2 == 0:
            return f3(a, b, c)
        else:
            return f4(a, b, c)

    
            

exec(input().strip()) # DON'T remove this line
# 1640848, 2022-09-24 10:08:31, PPPP[--][----] (67%)

def f1(a, b, c):

    pos = []
    if a > 0:
        pos.append(int(a))
    if b > 0:
        pos.append(int(b))
    if c > 0:
        pos.append(int(c))
    pos.sort()
    return int(pos[0])

def f2(a, b, c):

    pos = []
    if a < 0:
        pos.append(int(a))
    if b < 0:
        pos.append(int(b))
    if c < 0:
        pos.append(int(c))
    pos.sort()
    return (pos[-1])

def f3(a, b, c):

    a = int(a)
    b = int(b)
    c = int(c)
    sum = 0
    for e in (a,b,c):
        sum += e
    if sum>=0:
        sum2 = sum
    else:
        sum2 = (-1)*sum
    sum3 = ""
    sum3 += str(sum2)
    return int(sum3[0])

def f4(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    sum = 0
    for e in (a,b,c):
        sum += e
    if sum>=0:
        sum2 = sum
    else:
        sum2 = (-1)*sum
    sum3 = ""
    sum3 += str(sum2)
    return int(sum3[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 not in (0,1) or s2 not in (0,1):
        return "Error"
    elif s1 == 0:
        if s2 == 0:
            return f1(a, b, c)
        else:
            return f2(a, b, c)

    else:
        if s2 == 0:
            return f3(a, b, c)
        else:
            return f4(a, b, c)

    
            

exec(input().strip()) # DON'T remove this line
# 1641049, 2022-09-24 10:13:52, PPPP[--][----] (67%)

def f1(a, b, c):

    pos = []
    if a > 0:
        pos.append(int(a))
    if b > 0:
        pos.append(int(b))
    if c > 0:
        pos.append(int(c))
    pos.sort()
    return int(pos[0])

def f2(a, b, c):

    pos = []
    if a < 0:
        pos.append(int(a))
    if b < 0:
        pos.append(int(b))
    if c < 0:
        pos.append(int(c))
    pos.sort()
    return int(pos[-1])

def f3(a, b, c):

    a = int(a)
    b = int(b)
    c = int(c)
    sum = 0
    for e in (a,b,c):
        sum += e
    if sum>=0:
        sum2 = sum
    else:
        sum2 = (-1)*sum
    sum3 = ""
    sum3 += str(sum2)
    return int(sum3[0])

def f4(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    sum = 0
    for e in (a,b,c):
        sum += e
    if sum>=0:
        sum2 = sum
    else:
        sum2 = (-1)*sum
    sum3 = ""
    sum3 += str(sum2)
    return int(sum3[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 not in (0,1) or s2 not in (0,1):
        return "Error"
    elif s1 == 0:
        if s2 == 0:
            return f1(a, b, c)
        else:
            return f2(a, b, c)

    else:
        if s2 == 0:
            return f3(a, b, c)
        else:
            return f4(a, b, c)

    
            

exec(input().strip()) # DON'T remove this line

6231718521
# 1639501, 2022-09-24 09:31:50, PP--[--][P-P-] (33%)

def f1(a, b, c):
    x=[]
    if a>0:
        x.append(a)
    if b>0:
        x.append(b)
    if c>0:
        x.append(c)
    return sorted(x)[0]

def f2(a, b, c):
    x=[]
    if a<0:
        x.append(a)
    if b<0:
        x.append(b)
    if c<0:
        x.append(c)
    return sorted(x)[-1]
def f3(a, b, c):
    sum=a+b+c
    if sum>=0:
        return (str(sum))[0]
    if sum<0:
        return(str(sum*-1))[0]
def f4(a, b, c):
    sum=a+b+c
    if sum>=0:
        return (str(sum))[-1]
    if sum<0:
        return(str(sum*-1))[-1]
def main():
    s1,s2,a,b,c= [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    if s1==0 and s2==1:
        print(f2(a,b,c))
    if s1==1 and s2==0:
        print(f3(a,b,c))
    if s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line


# 1642275, 2022-09-24 10:36:48, PPPP[--][P-P-] (67%)

def f1(a, b, c):
    x=[]
    if a>0:
        x.append(a)
    if b>0:
        x.append(b)
    if c>0:
        x.append(c)
    return int(sorted(x)[0])

def f2(a, b, c):
    x=[]
    if a<0:
        x.append(a)
    if b<0:
        x.append(b)
    if c<0:
        x.append(c)
    return int(sorted(x)[-1])
def f3(a, b, c):
    sum=a+b+c
    if sum>=0:
        return int((str(sum))[0])
    if sum<0:
        return int((str(sum*-1))[0])
def f4(a, b, c):
    sum=a+b+c
    if sum>=0:
        return (str(sum))[-1]
    if sum<0:
        return int((str(sum*-1))[-1])
def main():
    s1,s2,a,b,c= [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    if s1==0 and s2==1:
        print(f2(a,b,c))
    if s1==1 and s2==0:
        print(f3(a,b,c))
    if s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line


# 1642339, 2022-09-24 10:37:29, PPPP[--][P-P-] (67%)

def f1(a, b, c):
    x=[]
    if a>0:
        x.append(a)
    if b>0:
        x.append(b)
    if c>0:
        x.append(c)
    return int(sorted(x)[0])

def f2(a, b, c):
    x=[]
    if a<0:
        x.append(a)
    if b<0:
        x.append(b)
    if c<0:
        x.append(c)
    return int(sorted(x)[-1])
def f3(a, b, c):
    sum=a+b+c
    if sum>=0:
        return int((str(sum))[0])
    if sum<0:
        return int((str(sum*-1))[0])
def f4(a, b, c):
    sum=a+b+c
    if sum>=0:
        return int((str(sum))[-1])
    if sum<0:
        return int((str(sum*-1))[-1])
def main():
    s1,s2,a,b,c= [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    if s1==0 and s2==1:
        print(f2(a,b,c))
    if s1==1 and s2==0:
        print(f3(a,b,c))
    if s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line
# 1642384, 2022-09-24 10:38:04, PPPP[--][P-P-] (67%)

def f1(a, b, c):
    x=[]
    if a>0:
        x.append(a)
    if b>0:
        x.append(b)
    if c>0:
        x.append(c)
    return int(sorted(x)[0])

def f2(a, b, c):
    x=[]
    if a<0:
        x.append(a)
    if b<0:
        x.append(b)
    if c<0:
        x.append(c)
    return int(sorted(x)[-1])
def f3(a, b, c):
    sum=a+b+c
    if sum>=0:
        return int((str(sum))[0])
    if sum<0:
        return int((str(sum*-1))[0])
def f4(a, b, c):
    sum=a+b+c
    if sum>=0:
        return int((str(sum))[-1])
    if sum<0:
        return int((str(sum*-1))[-1])
def main():
    s1,s2,a,b,c= [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    if s1==0 and s2==1:
        print(f2(a,b,c))
    if s1==1 and s2==0:
        print(f3(a,b,c))
    if s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

6431133521
# 1639985, 2022-09-24 09:44:39, PPx-[xx][P-P-] (33%)

def f1(a,b,c):
    x = [a,b,c]
    x.sort()
    for i in x:
        if i > 0:
            mn = i
            break
    return mn

def f2(a,b,c):
    x = [a,b,c]
    x.sort()
    for i in x[-1::-1]:
        if i < 0:
            mx = i
            break
    return mx

def f3(a,b,c):
    x = a + b + c
    x = str(x)
    if x[0] in [0,1,2,3,4,5,6,7,8,9]:
        return x[0]
    else:
        return x[1]

def f4(a,b,c):
    x = a + b + c
    x = str(x)
    return x[-1]

def main():
    s1,s2,a,b,c = input().split()
    if int(s1) == 0 and int(s2) == 0:
        print(f1(a,b,c))
    elif int(s1) == 0 and int(s2) == 1:
        print(f2(a,b,c))
    elif int(s2) == 1 and int(s2) == 0:
        print(f3(a,b,c))
    elif int(s1) == 1 and int(s2) == 1:
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip())
# 1641025, 2022-09-24 10:13:07, PPx-[PP][P-P-] (50%)

def f1(a,b,c):
    x = [a,b,c]
    x.sort()
    for i in x:
        if i > 0:
            mn = i
            break
    return mn

def f2(a,b,c):
    x = [a,b,c]
    x.sort()
    for i in x[-1::-1]:
        if i < 0:
            mx = i
            break
    return mx

def f3(a,b,c):
    x = a + b + c
    x = str(x)
    if x[0] in [0,1,2,3,4,5,6,7,8,9]:
        return x[0]
    else:
        return x[1]

def f4(a,b,c):
    x = a + b + c
    x = str(x)
    return x[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if int(s1) == 0 and int(s2) == 0:
        print(f1(a,b,c))
    elif int(s1) == 0 and int(s2) == 1:
        print(f2(a,b,c))
    elif int(s2) == 1 and int(s2) == 0:
        print(f3(a,b,c))
    elif int(s1) == 1 and int(s2) == 1:
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip())
# 1641263, 2022-09-24 10:18:54, PPxP[PP][P-P-] (67%)

def f1(a,b,c):
    x = [a,b,c]
    x.sort()
    for i in x:
        if i > 0:
            mn = i
            break
    return mn

def f2(a,b,c):
    x = [a,b,c]
    x.sort()
    for i in x[-1::-1]:
        if i < 0:
            mx = i
            break
    return mx

def f3(a,b,c):
    x = a + b + c
    x = str(x)
    if x[0] in [0,1,2,3,4,5,6,7,8,9]:
        return int(x[0])
    else:
        return int(x[1])

def f4(a,b,c):
    x = a + b + c
    x = str(x)
    return int(x[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if int(s1) == 0 and int(s2) == 0:
        print(f1(a,b,c))
    elif int(s1) == 0 and int(s2) == 1:
        print(f2(a,b,c))
    elif int(s2) == 1 and int(s2) == 0:
        print(f3(a,b,c))
    elif int(s1) == 1 and int(s2) == 1:
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip())
# 1641309, 2022-09-24 10:19:41, PPxP[PP][P-P-] (67%)

def f1(a,b,c):
    x = [a,b,c]
    x.sort()
    for i in x:
        if i > 0:
            mn = i
            break
    return mn

def f2(a,b,c):
    x = [a,b,c]
    x.sort()
    for i in x[-1::-1]:
        if i < 0:
            mx = i
            break
    return mx

def f3(a,b,c):
    x = a + b + c
    x = str(x)
    if int(x[0]) in [0,1,2,3,4,5,6,7,8,9]:
        return int(x[0])
    else:
        return int(x[1])

def f4(a,b,c):
    x = a + b + c
    x = str(x)
    return int(x[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if int(s1) == 0 and int(s2) == 0:
        print(f1(a,b,c))
    elif int(s1) == 0 and int(s2) == 1:
        print(f2(a,b,c))
    elif int(s2) == 1 and int(s2) == 0:
        print(f3(a,b,c))
    elif int(s1) == 1 and int(s2) == 1:
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip())

6530033321
# 1640987, 2022-09-24 10:12:21, P-x-[P-][P-PP] (17%)

def f1(a, b, c):
    y = []
    for x in [a,b,c]:
        if x > 0:
            y.append(int(x))
    return min(y)
               
def f2(a, b, c):
    y = []
    for x in [a,b,c]:
        if x > 0:
            y.append(int(x))
    return max(y)
            
def f3(a, b, c):
    x = a + b + c
    x = str(x)
    return x[1]

def f4(a, b, c):
    x = a + b + c
    x = str(x)
    return x[2]
    
def main():
    s1,s2,a,b,c = input().split()
    s1 = int(s1)
    s2 = int(s2)
    a = int(a)
    b = int(b)
    c = int(c)
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line
# 1641128, 2022-09-24 10:16:04, P---[P-][PPPP] (33%)

def f1(a, b, c):
    y = []
    for x in [a,b,c]:
        if x > 0:
            y.append(int(x))
    return min(y)
               
def f2(a, b, c):
    y = []
    for x in [a,b,c]:
        if x > 0:
            y.append(int(x))
    return max(y)
            
def f3(a, b, c):
    x = a + b + c
    if x < 0:
        x = str(x)
        return x[1]
    else:
        x = str(x)
        return x[0]

def f4(a, b, c):
    x = a + b + c
    x = str(x)
    return x[2]
    
def main():
    s1,s2,a,b,c = input().split()
    s1 = int(s1)
    s2 = int(s2)
    a = int(a)
    b = int(b)
    c = int(c)
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line
# 1641262, 2022-09-24 10:18:51, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    y = []
    for x in [a,b,c]:
        if x > 0:
            y.append(int(x))
    return min(y)
               
def f2(a, b, c):
    y = []
    for x in [a,b,c]:
        if x < 0:
            y.append(int(x))
    return max(y)
            
def f3(a, b, c):
    x = a + b + c
    if x < 0:
        x = str(x)
        return x[1]
    else:
        x = str(x)
        return x[0]

def f4(a, b, c):
    x = a + b + c
    x = str(x)
    return x[2]
    
def main():
    s1,s2,a,b,c = input().split()
    s1 = int(s1)
    s2 = int(s2)
    a = int(a)
    b = int(b)
    c = int(c)
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line
# 1641374, 2022-09-24 10:20:58, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    y = []
    for x in [a,b,c]:
        if x > 0:
            y.append(int(x))
    return min(y)
               
def f2(a, b, c):
    y = []
    for x in [a,b,c]:
        if x < 0:
            y.append(int(x))
    return max(y)
            
def f3(a, b, c):
    x = a + b + c
    if x < 0:
        x = str(x)
        return x[1]
    else:
        x = str(x)
        return x[0]

def f4(a, b, c):
    x = a + b + c
    if x > 0:
        x = str(x)
        return x[2]
    else:
        x = str(x)
        return x[3]

    
def main():
    s1,s2,a,b,c = input().split()
    s1 = int(s1)
    s2 = int(s2)
    a = int(a)
    b = int(b)
    c = int(c)
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line

6530048821
# 1640038, 2022-09-24 09:46:27, PP--[P-][----] (33%)

def f1(a, b, c):
    x = [a,b,c]
    while True:
        if min(x) <= 0:
            x.remove(min(x))
        else:
            return min(x)
    
def f2(a, b, c):
    x = [a,b,c]
    while True:
        if max(x) >= 0:
            x.remove(max(x))
        else:
            return max(x)

def f3(a, b, c):
    x = a+b+c
    if x < 0: x = -x
    x = str(x)
    return x[0]
    
    

def f4(a, b, c):
    x = str(a+b+c)
    return x[len(x)-1]

def main():
    x = input().split()
    s1 = int(x[0])
    s2 = int(x[1])
    a = int(x[2])
    b = int(x[3])
    c = int(x[4])
    while True:
        if s1 == 0:
            if s2 == 0:
                print(f1(a,b,c))
                break
        else:
            print(f2(a,b,c))
            break
        if s1 == 1:
            if s2 == 0:
                print(f3(a,b,c))
                break
        else:
            print(f4(a,b,c))
            break
        print("Error")
        break
exec(input().strip())

# 1640292, 2022-09-24 09:53:25, PP--[PP][-PPP] (50%)

def f1(a, b, c):
    x = [a,b,c]
    while True:
        if min(x) <= 0:
            x.remove(min(x))
        else:
            return min(x)
    
def f2(a, b, c):
    x = [a,b,c]
    while True:
        if max(x) >= 0:
            x.remove(max(x))
        else:
            return max(x)

def f3(a, b, c):
    x = a+b+c
    if x < 0: x = -x
    x = str(x)
    return x[0]
    
    

def f4(a, b, c):
    x = str(a+b+c)
    return x[len(x)-1]

def main():
    x = input().split()
    s1 = int(x[0])
    s2 = int(x[1])
    a = int(x[2])
    b = int(x[3])
    c = int(x[4])
    while True:
        if s1 == 0:
            if s2 == 0:
                print(f1(a,b,c))
                break
            else:
                print(f2(a,b,c))
                break
        elif s1 == 1:
            if s2 == 0:
                print(f3(a,b,c))
                break
            else:
                print(f4(a,b,c))
                break
        else:
            print("Error")
            break
exec(input().strip())
# 1641137, 2022-09-24 10:16:17, PP--[PP][TPPP] (50%)

def f1(a, b, c):
    x = [a,b,c]
    while True:
        if min(x) <= 0:
            x.remove(min(x))
        else:
            return min(x)
    
def f2(a, b, c):
    x = [a,b,c]
    while True:
        if max(x) >= 0:
            x.remove(max(x))
        else:
            return max(x)

def f3(a, b, c):
    x = a+b+c
    if x < 0: x = -x
    x = str(x)
    return x[0]
    
    

def f4(a, b, c):
    x = str(a+b+c)
    return x[len(x)-1]

def main():
    x = input().split()
    s1 = int(x[0])
    s2 = int(x[1])
    a = int(x[2])
    b = int(x[3])
    c = int(x[4])
    while True:
        if s1 == 0:
            if s2 == 0:
                print(f1(a,b,c))
                break
            elif s2 == 1:
                print(f2(a,b,c))
                break
        elif s1 == 1:
            if s2 == 0:
                print(f3(a,b,c))
                break
            elif s2 == 1:
                print(f4(a,b,c))
                break
        else:
            print("Error")
            break
exec(input().strip())

# 1641595, 2022-09-24 10:25:26, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x = [a,b,c]
    while True:
        if min(x) <= 0:
            x.remove(min(x))
        else:
            return min(x)
    
def f2(a, b, c):
    x = [a,b,c]
    while True:
        if max(x) >= 0:
            x.remove(max(x))
        else:
            return max(x)

def f3(a, b, c):
    x = a+b+c
    if x < 0: x = -x
    x = str(x)
    return x[0]
    
    

def f4(a, b, c):
    x = str(a+b+c)
    return x[len(x)-1]

def main():
    x = input().split()
    s1 = int(x[0])
    s2 = int(x[1])
    a = int(x[2])
    b = int(x[3])
    c = int(x[4])
    while True:
        if s1 == 0:
            if s2 == 0:
                print(f1(a,b,c))
                break
            elif s2 == 1:
                print(f2(a,b,c))
                break
            else:
                print("Error")
                break
        elif s1 == 1:
            if s2 == 0:
                print(f3(a,b,c))
                break
            elif s2 == 1:
                print(f4(a,b,c))
                break
            else:
                print("Error")
                break
        else:
            print("Error")
            break
exec(input().strip())


6530068321
# 1639482, 2022-09-24 09:31:27, ----[--][----] (0%)

def f1(a,b,c):
    x=[]
    if a>0:
        x.append(a)
    if b>0:
        x.append(b)
    if c>0:
        x.append(c)
    x.sort()
    return(int(x[0]))
def f2(a,b,c):
    x=[]
    if a<0:
        x.append(a)
    if b<0:
        x.append(b)
    if c<0:
        x.append(c)
    x.sort()
    return(int(x[-1]))
def f3(a,b,c):
    x=a+b+c
    y=str(abs(x))
    return(int(y[0]))
def f4(a,b,c):
    x=a+b+c
    y=str(abs(x))
    return(int(y[-1]))
def main():
    s1,s2,a,b,c= [int(e) for e in input().split()]
    if s1==0and s2==0:
        print(f1(a,b,c))
    if s1==0and s2==1:
        print(f2(a,b,c))
    if s1==1and s2==0:
        print(f3(a,b,c))
    if s1==1and s2==1:
        print(f4(a,b,c))
    else:
        print("Error")
# 1639537, 2022-09-24 09:32:45, PPPP[--][P-P-] (67%)

def f1(a,b,c):
    x=[]
    if a>0:
        x.append(a)
    if b>0:
        x.append(b)
    if c>0:
        x.append(c)
    x.sort()
    return(int(x[0]))
def f2(a,b,c):
    x=[]
    if a<0:
        x.append(a)
    if b<0:
        x.append(b)
    if c<0:
        x.append(c)
    x.sort()
    return(int(x[-1]))
def f3(a,b,c):
    x=a+b+c
    y=str(abs(x))
    return(int(y[0]))
def f4(a,b,c):
    x=a+b+c
    y=str(abs(x))
    return(int(y[-1]))
def main():
    s1,s2,a,b,c= [int(e) for e in input().split()]
    if s1==0and s2==0:
        print(f1(a,b,c))
    if s1==0and s2==1:
        print(f2(a,b,c))
    if s1==1and s2==0:
        print(f3(a,b,c))
    if s1==1and s2==1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line
    


# 1640134, 2022-09-24 09:49:16, PPPP[--][P-P-] (67%)

def f1(a,b,c):
    x=[]
    if a>0:
        x.append(a)
    if b>0:
        x.append(b)
    if c>0:
        x.append(c)
    x.sort()
    return(int(x[0]))
def f2(a,b,c):
    x=[]
    if a<0:
        x.append(a)
    if b<0:
        x.append(b)
    if c<0:
        x.append(c)
    x.sort()
    return(int(x[-1]))
def f3(a,b,c):
    x=a+b+c
    y=str(abs(x))
    return(int(y[0]))
def f4(a,b,c):
    x=a+b+c
    y=str(abs(x))
    return(int(y[-1]))
def main():
    s1,s2,a,b,c= [int(e) for e in input().split()]
    if s1==0and s2==0:
        print(f1(a,b,c))
    if s1==0and s2==1:
        print(f2(a,b,c))
    if s1==1and s2==0:
        print(f3(a,b,c))
    if s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line
    


# 1641156, 2022-09-24 10:16:39, PPPP[--][P-P-] (67%)

def f1(a,b,c):
    x=[]
    if a>0:
        x.append(a)
    if b>0:
        x.append(b)
    if c>0:
        x.append(c)
    x.sort()
    return(int(x[0]))
def f2(a,b,c):
    x=[]
    if a<0:
        x.append(a)
    if b<0:
        x.append(b)
    if c<0:
        x.append(c)
    x.sort()
    return(int(x[-1]))
def f3(a,b,c):
    x=a+b+c
    y=str(abs(x))
    return(int(y[0]))
def f4(a,b,c):
    x=a+b+c
    y=str(abs(x))
    return(int(y[-1]))
def main():
    s1,s2,a,b,c= [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    if s1==0 and s2==1:
        print(f2(a,b,c))
    if s1==1 and s2==0:
        print(f3(a,b,c))
    if s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

6530102021
# 1640692, 2022-09-24 10:04:41, PP--[--][----] (33%)

def f1(a,b,c):
    e =[]
    if a>0:
        e+=[a]
    if b>0:
        e+=[b]
    if c>0:
        e+=[c]
    x = [int(A) for A in e]
    return min(e)
def f2(a,b,c):
    e =[]
    if a<0:
        e+=[a]
    if b<0:
        e+=[b]
    if c<0:
        e+=[c]
    x = [int(A) for A in e]
    return max(e)
def f3(a,b,c):
    x = a+b+c
    x = str(x)
    if x[0] in ['+','-']:
        return x[1]
    else:
        return x[0]
def f4(a,b,c):
    x = a+b+c
    x = str(x)
    return x[-1]
def main():
    s1,s2,a,b,c = [int(a) for a in input().split() ]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Eror')
    


    
exec(input())            
    

# 1640769, 2022-09-24 10:06:35, PPPx[--][----] (50%)

def f1(a,b,c):
    e =[]
    if a>0:
        e+=[a]
    if b>0:
        e+=[b]
    if c>0:
        e+=[c]
    x = [int(A) for A in e]
    return min(e)
def f2(a,b,c):
    e =[]
    if a<0:
        e+=[a]
    if b<0:
        e+=[b]
    if c<0:
        e+=[c]
    x = [int(A) for A in e]
    return max(e)
def f3(a,b,c):
    x = a+b+c
    x = str(x)
    if x[0] in ['+','-']:
        return abs(int(x[1]))
    else:
        return abs(int(x[0]))
def f4(a,b,c):
    x = a+b+c
    x = str(x)
    return ans(int(x[-1]))
def main():
    s1,s2,a,b,c = [int(a) for a in input().split() ]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Eror')
    


    
exec(input())            
    

# 1641334, 2022-09-24 10:20:07, PPPP[--][----] (67%)

def f1(a,b,c):
    e =[]
    if a>0:
        e+=[a]
    if b>0:
        e+=[b]
    if c>0:
        e+=[c]
    x = [int(A) for A in e]
    return min(e)
def f2(a,b,c):
    e =[]
    if a<0:
        e+=[a]
    if b<0:
        e+=[b]
    if c<0:
        e+=[c]
    x = [int(A) for A in e]
    return max(e)
def f3(a,b,c):
    x = a+b+c
    x = str(x)
    if x[0] in ['+','-']:
        return abs(int(x[1]))
    else:
        return abs(int(x[0]))
def f4(a,b,c):
    x = a+b+c
    x = str(x)
    return abs(int(x[-1]))
def main():
    s1,s2,a,b,c = [int(a) for a in input().split() ]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Eror')
    


    
exec(input())
# 1641506, 2022-09-24 10:23:49, PPPP[--][----] (67%)

def f1(a,b,c):
    e =[]
    if a>0:
        e+=[a]
    if b>0:
        e+=[b]
    if c>0:
        e+=[c]
    x = [int(A) for A in e]
    return min(e)
def f2(a,b,c):
    e =[]
    if a<0:
        e+=[a]
    if b<0:
        e+=[b]
    if c<0:
        e+=[c]
    x = [int(A) for A in e]
    return max(e)
def f3(a,b,c):
    x = a+b+c
    x = str(x)
    if x[0] in ['+','-']:
        return abs(int(x[1]))
    else:
        return abs(int(x[0]))
def f4(a,b,c):
    x = a+b+c
    x = str(x)
    return abs(int(x[-1]))
def main():
    s1,s2,a,b,c = [int(a) for a in input().split() ]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Eror')
    


    
exec(input())            
    


6530111621
# 1639574, 2022-09-24 09:33:47, --xP[--][---x] (17%)

def f1(a,b,c):
    use =[]
    if a>0:
        use.append(a)
    elif b>0:
        use.append(b)
    elif c>0:
        use.append(c)
    return int(min(use))
    
def f2(a,b,c):
    use =[]
    if a>0:
        use.append(a)
    elif b>0:
        use.append(b)
    elif c>0:
        use.append(c)
    return int(max(use))

def f3(a,b,c):
    x = a+b+c
    y = str(x)
    return int(y[0])

def f4(a,b,c):
    x = a+b+c
    y = str(x)
    return int(y[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2== 0:
        return f1(a,b,c)
    elif s1==0 and s2==1:
        return f2(a,b,c)
    elif s1==1 and s2==0:
        return f3(a,b,c)
    elif s1==1 and s2==1:
        return f4(a,b,c)
    else:
        return "Error"
    
exec(input().strip())
# 1639683, 2022-09-24 09:36:35, --xP[--][---x] (17%)

def f1(a,b,c):
    use =[]
    if a>0:
        use.append(a)
    elif b>0:
        use.append(b)
    elif c>0:
        use.append(c)
    return int(min(use))
    
def f2(a,b,c):
    use =[]
    if a<0:
        use.append(a)
    elif b<0:
        use.append(b)
    elif c<0:
        use.append(c)
    return int(max(use))

def f3(a,b,c):
    x = a+b+c
    y = str(x)
    return int(y[0])

def f4(a,b,c):
    x = a+b+c
    y = str(x)
    return int(y[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2== 0:
        return f1(a,b,c)
    elif s1==0 and s2==1:
        return f2(a,b,c)
    elif s1==1 and s2==0:
        return f3(a,b,c)
    elif s1==1 and s2==1:
        return f4(a,b,c)
    else:
        return "Error"
    
exec(input().strip())
    
# 1639917, 2022-09-24 09:42:52, --PP[--][----] (33%)

def f1(a,b,c):
    use =[]
    if a>0:
        use.append(a)
    elif b>0:
        use.append(b)
    elif c>0:
        use.append(c)
    return int(min(use))
    
def f2(a,b,c):
    use =[]
    if a<0:
        use.append(a)
    elif b<0:
        use.append(b)
    elif c<0:
        use.append(c)
    return int(max(use))

def f3(a,b,c):
    x = a+b+c
    y = str(x)
    if "-" in y:
        z = y[1]
    else:
        z = y[0]
    return int(z)

def f4(a,b,c):
    x = a+b+c
    y = str(x)
    if "-" in y:
        z = y[-2]
    z = y[-1]
    return int(z)

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2== 0:
        return f1(a,b,c)
    elif s1==0 and s2==1:
        return f2(a,b,c)
    elif s1==1 and s2==0:
        return f3(a,b,c)
    elif s1==1 and s2==1:
        return f4(a,b,c)
    else:
        return "Error"
    
exec(input().strip())
# 1640123, 2022-09-24 09:49:03, PPPP[--][----] (67%)

def f1(a,b,c):
    use =[]
    if a>0:
        use.append(a)
    if b>0:
        use.append(b)
    if c>0:
        use.append(c)
    return int(min(use))
    
def f2(a,b,c):
    use =[]
    if a<0:
        use.append(a)
    if b<0:
        use.append(b)
    if c<0:
        use.append(c)
    
    return int(max(use))

def f3(a,b,c):
    x = a+b+c
    y = str(x)
    if "-" in y:
        z = y[1]
    else:
        z = y[0]
    return int(z)

def f4(a,b,c):
    x = a+b+c
    y = str(x)
    if "-" in y:
        z = y[-2]
    z = y[-1]
    return int(z)

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2== 0:
        return f1(a,b,c)
    elif s1==0 and s2==1:
        return f2(a,b,c)
    elif s1==1 and s2==0:
        return f3(a,b,c)
    elif s1==1 and s2==1:
        return f4(a,b,c)
    else:
        return "Error"
    
exec(input().strip())

6530178721
# 1639493, 2022-09-24 09:31:38, -P--[PP][PPPP] (50%)

def f1(a, b, c):
    t = []
    t.append(a)
    t.append(b)
    t.append(c)
    t.sort()
    if t[1]>=0:
        return t[1]
    if t[1]<0:
        return t[2]

def f2(a, b, c):
    t = []
    t.append(a)
    t.append(b)
    t.append(c)
    t.sort()
    if t[1]>=0:
        return t[0]
    if t[1]<0:
        return t[1]
    
def f3(a, b, c):
    t = abs(a+b+c)
    return str(t)[0]

def f4(a, b, c):
    t = abs(a+b+c)
    return str(t)[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
    
exec(input().strip())

# 1639611, 2022-09-24 09:34:41, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    t = []
    t.append(a)
    t.append(b)
    t.append(c)
    t.sort()
    if t[1]>0:
        return t[1]
    elif t[1]<=0:
        return t[2]

def f2(a, b, c):
    t = []
    t.append(a)
    t.append(b)
    t.append(c)
    t.sort()
    if t[1]>=0:
        return t[0]
    elif t[1]<0:
        return t[1]
    
def f3(a, b, c):
    t = abs(a+b+c)
    return str(t)[0]

def f4(a, b, c):
    t = abs(a+b+c)
    return str(t)[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
    
exec(input().strip())

# 1639689, 2022-09-24 09:36:45, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    t = []
    t.append(int(a))
    t.append(int(b))
    t.append(int(c))
    t.sort()
    if t[1]>0:
        return t[1]
    elif t[1]<=0:
        return t[2]

def f2(a, b, c):
    t = []
    t.append(int(a))
    t.append(int(b))
    t.append(int(c))
    t.sort()
    if t[1]>=0:
        return t[0]
    elif t[1]<0:
        return t[1]
    
def f3(a, b, c):
    t = abs(a+b+c)
    return str(t)[0]

def f4(a, b, c):
    t = abs(a+b+c)
    return str(t)[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
    
exec(input().strip())

# 1640877, 2022-09-24 10:09:07, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    t = []
    t.append(int(a))
    t.append(int(b))
    t.append(int(c))
    t.sort()
    if t[1]>0:
        return t[1]
    elif t[1]<=0:
        return t[2]

def f2(a, b, c):
    t = []
    t.append(int(a))
    t.append(int(b))
    t.append(int(c))
    t.sort()
    if t[1]>=0:
        return t[0]
    elif t[1]<0:
        return t[1]
    
def f3(a, b, c):
    t = abs(a+b+c)
    return str(t)[0]

def f4(a, b, c):
    t = abs(a+b+c)
    return str(t)[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
    
exec(input().strip())


6530203721
# 1640327, 2022-09-24 09:54:31, ----[--][P-P-] (0%)

def f1(a,b,c):
    a=int(a)
    b=int(b)
    c=int(c)
    if a<0:
        minf1=(b,c)
    if b<0:
        minf1=(a,c)
    if c<0:
        minf1=(a,b)
    min_f1=min(minf1)
    return min_f1

def f2(a,b,c):
    a=int(a)
    b=int(b)
    c=int(c)
    if a>0:
        maxf2=(b,c)
    if b>0:
        maxf2=(a,c)
    if c>0:
        maxf2=(a,b)
    max_f2=max(maxf2)
    return max_f2

def f3(a,b,c):
    a=int(a)
    b=int(b)
    c=int(c)
    sumf3=abs(a+b+c)
    ans=str(sumf3)
#     print(type(ans))
    return ans[0]

def f4(a,b,c):
    a=int(a)
    b=int(b)
    c=int(c)
    sumf4=abs(a+b+c)
    ans=str(sumf4)
    return ans[-1]

def main():
    s1,s2,a,b,c=(input().split())
    s1=int(s1)
    s2=int(s2)
    a=int(a)
    b=int(b)
    c=int(c)
    if s1==0 and s2==0:
        print (f1(a,b,c))
    if s1==0 and s2==1:
        print (f2(a,b,c))
    if s1==1 and s2==0:
        print (f3(a,b,c))
    if s1==1 and s2==1:
        print (f4(a,b,c))
    else:
        print (('Error'))

exec(input().strip()) # DON'T remove this line
# 1640410, 2022-09-24 09:57:10, --PP[--][P-P-] (33%)

def f1(a,b,c):
    a=int(a)
    b=int(b)
    c=int(c)
    if a<0:
        minf1=(b,c)
    if b<0:
        minf1=(a,c)
    if c<0:
        minf1=(a,b)
    min_f1=min(minf1)
    return int(min_f1)

def f2(a,b,c):
    a=int(a)
    b=int(b)
    c=int(c)
    if a>0:
        maxf2=(b,c)
    if b>0:
        maxf2=(a,c)
    if c>0:
        maxf2=(a,b)
    max_f2=max(maxf2)
    return int(max_f2)

def f3(a,b,c):
    a=int(a)
    b=int(b)
    c=int(c)
    sumf3=abs(a+b+c)
    ans=str(sumf3)
#     print(type(ans))
    return int(ans[0])

def f4(a,b,c):
    a=int(a)
    b=int(b)
    c=int(c)
    sumf4=abs(a+b+c)
    ans=str(sumf4)
    return int(ans[-1])

def main():
    s1,s2,a,b,c=(input().split())
    s1=int(s1)
    s2=int(s2)
    a=int(a)
    b=int(b)
    c=int(c)
    if s1==0 and s2==0:
        print (f1(a,b,c))
    if s1==0 and s2==1:
        print (f2(a,b,c))
    if s1==1 and s2==0:
        print (f3(a,b,c))
    if s1==1 and s2==1:
        print (f4(a,b,c))
    else:
        print (('Error'))

exec(input().strip()) # DON'T remove this line
# 1640535, 2022-09-24 10:00:10, --PP[PP][PPPP] (67%)

def f1(a,b,c):
    a=int(a)
    b=int(b)
    c=int(c)
    if a<0:
        minf1=(b,c)
    if b<0:
        minf1=(a,c)
    if c<0:
        minf1=(a,b)
    min_f1=min(minf1)
    return int(min_f1)

def f2(a,b,c):
    a=int(a)
    b=int(b)
    c=int(c)
    if a>0:
        maxf2=(b,c)
    if b>0:
        maxf2=(a,c)
    if c>0:
        maxf2=(a,b)
    max_f2=max(maxf2)
    return int(max_f2)

def f3(a,b,c):
    a=int(a)
    b=int(b)
    c=int(c)
    sumf3=abs(a+b+c)
    ans=str(sumf3)
#     print(type(ans))
    return int(ans[0])

def f4(a,b,c):
    a=int(a)
    b=int(b)
    c=int(c)
    sumf4=abs(a+b+c)
    ans=str(sumf4)
    return int(ans[-1])

def main():
    s1,s2,a,b,c=(input().split())
    s1=int(s1)
    s2=int(s2)
    a=int(a)
    b=int(b)
    c=int(c)
    if s1==0 and s2==0:
        print (f1(a,b,c))
    elif s1==0 and s2==1:
        print (f2(a,b,c))
    elif s1==1 and s2==0:
        print (f3(a,b,c))
    elif s1==1 and s2==1:
        print (f4(a,b,c))
    else:
        print (('Error'))

exec(input().strip()) # DON'T remove this line
# 1640599, 2022-09-24 10:02:10, --PP[PP][PPPP] (67%)

def f1(a,b,c):
    a=int(a)
    b=int(b)
    c=int(c)
    if a<0:
        minf1=(b,c)
    elif b<0:
        minf1=(a,c)
    elif c<0:
        minf1=(a,b)
    min_f1=min(minf1)
    return int(min_f1)

def f2(a,b,c):
    a=int(a)
    b=int(b)
    c=int(c)
    if a>0:
        maxf2=(b,c)
    elif b>0:
        maxf2=(a,c)
    elif c>0:
        maxf2=(a,b)
    max_f2=max(maxf2)
    return int(max_f2)

def f3(a,b,c):
    a=int(a)
    b=int(b)
    c=int(c)
    sumf3=abs(a+b+c)
    ans=str(sumf3)
#     print(type(ans))
    return int(ans[0])

def f4(a,b,c):
    a=int(a)
    b=int(b)
    c=int(c)
    sumf4=abs(a+b+c)
    ans=str(sumf4)
    return int(ans[-1])

def main():
    s1,s2,a,b,c=(input().split())
    s1=int(s1)
    s2=int(s2)
    a=int(a)
    b=int(b)
    c=int(c)
    if s1==0 and s2==0:
        print (f1(a,b,c))
    elif s1==0 and s2==1:
        print (f2(a,b,c))
    elif s1==1 and s2==0:
        print (f3(a,b,c))
    elif s1==1 and s2==1:
        print (f4(a,b,c))
    else:
        print (('Error'))

exec(input().strip()) # DON'T remove this line

6230187021
# 1640167, 2022-09-24 09:50:12, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x=[a,b,c]
    y=[]
    for e in x:
        if e>0:
            y.append(e)
    return min(y)

def f2(a, b, c):
    x=[a,b,c]
    y=[]
    for e in x:
        if e<0:
            y.append(e)
    return max(y)

def f3(a, b, c):
    x=[a,b,c]
    z=sum(x)
    y=str(z)
    if z<=0:
        if z==0:
            return 0
        else:
            return y[1]
    else:
        return y[0]

def f4(a, b, c):

    x=[a,b,c]
    z=sum(x)
    y=str(z)
    if z==0:
        return 0
    else:
        return y[-1]

def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    else:
        if s1==0 and s2==1:
            print(f2(a, b, c))
        else:
            if s1==1 and s2==0:
                print(f3(a, b, c)
)
            else:
                if s1==1 and s2==1:
                    print(f4(a, b, c))
                else:
                    print("Error")
exec(input().strip()) # DON'T remove this line



# 1640820, 2022-09-24 10:07:55, PP--[PP][----] (50%)

def f1(a, b, c):
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000:
        x=[a,b,c]
        y=[]
        for e in x:
            if e>0:
                y.append(e)
        return min(y)

def f2(a, b, c):
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000:
        x=[a,b,c]
        y=[]
        for e in x:
            if e<0:
                y.append(e)
        return max(y)

def f3(a, b, c):
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000:
        x=[a,b,c]
        z=sum(x)
        y=str(z)
        if z<=0:
            if z==0:
                return 0
            else:
                return y[1]
        else:
            return y[0]

def f4(a, b, c):

    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000:
        x=[a,b,c]
        z=sum(x)
        y=str(z)
        if z==0:
            return 0
        else:
            return y[-1]

def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000:
        if s1==0 and s2==0:
            print(f1(a, b, c))
        else:
            if s1==0 and s2==1:
                print(f2(a, b, c))
            else:
                if s1==1 and s2==0:
                    print(f3(a, b, c)
)
                else:
                    if s1==1 and s2==1:
                        print(f4(a, b, c))
                    else:
                        print("Error")
exec(input().strip()) # DON'T remove this line



# 1640859, 2022-09-24 10:08:47, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x=[a,b,c]
    y=[]
    for e in x:
        if e>0:
            y.append(e)
    return min(y)

def f2(a, b, c):
    x=[a,b,c]
    y=[]
    for e in x:
        if e<0:
            y.append(e)
    return max(y)

def f3(a, b, c):
    x=[a,b,c]
    z=sum(x)
    y=str(z)
    if z<=0:
        if z==0:
            return 0
        else:
            return y[1]
    else:
        return y[0]

def f4(a, b, c):

    x=[a,b,c]
    z=sum(x)
    y=str(z)
    if z==0:
        return 0
    else:
        return y[-1]

def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    else:
        if s1==0 and s2==1:
            print(f2(a, b, c))
        else:
            if s1==1 and s2==0:
                print(f3(a, b, c)
)
            else:
                if s1==1 and s2==1:
                    print(f4(a, b, c))
                else:
                    print("Error")
exec(input().strip()) # DON'T remove this line

6530024721
# 1639579, 2022-09-24 09:33:51, PP-P[PP][P-P-] (67%)

def f1(a, b, c):
    l1 = [a,b,c]
    l1.sort()
    if l1[0] > 0 :
        return l1[0]
    elif l1[1] > 0 :
        return l1[1]
    else :
        return l1[2]
def f2(a, b, c):
    l2 = [a,b,c]
    l2.sort()
    if l2[2] < 0 :
        return l2[2]
    elif l2[1] < 0 :
        return l2[1]
    else :
        return l2[0]
def f3(a, b, c):
    total = a+b+c
    if total < 0 :
        total *= -1
    return total//10
def f4(a, b, c):
    total = a+b+c
    if total < 0 :
        total *= -1
    return total%10
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))    
    else :
        print('Error')

exec(input().strip()) # DON'T remove this line

# 1641240, 2022-09-24 10:18:24, PP-P[PP][P-P-] (67%)

def f1(a, b, c):
    l1 = [a,b,c]
    l1.sort()
    if l1[0] > 0 :
        return l1[0]
    elif l1[1] > 0 :
        return l1[1]
    else :
        return l1[2]

def f2(a, b, c):
    l2 = [a,b,c]
    l2.sort()
    if l2[2] < 0 :
        return l2[2]
    elif l2[1] < 0 :
        return l2[1]
    else :
        return l2[0]

def f3(a, b, c):
    total = a+b+c
    if total < 0 :
        total *= -1
    return total//10

def f4(a, b, c):
    total = a+b+c
    if total < 0 :
        total *= -1
    return total%10

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))    
    else :
        print('Error')

exec(input().strip()) # DON'T remove this line

# 1641471, 2022-09-24 10:23:07, PP-P[PP][P-P-] (67%)

def f1(a, b, c):
    l1 = [a,b,c]
    l1.sort()
    if l1[0] > 0 :
        return l1[0]
    elif l1[1] > 0 :
        return l1[1]
    else :
        return int(l1[2])

def f2(a, b, c):
    l2 = [a,b,c]
    l2.sort()
    if l2[2] < 0 :
        return l2[2]
    elif l2[1] < 0 :
        return l2[1]
    else :
        return int(l2[0])

def f3(a, b, c):
    total = a+b+c
    if total < 0 :
        total *= -1
    return int(total//10)

def f4(a, b, c):
    total = a+b+c
    if total < 0 :
        total *= -1
    return int(total%10)

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))    
    else :
        print('Error')

exec(input().strip()) # DON'T remove this line


6531404721
# 1641312, 2022-09-24 10:19:44, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x = []
    if a > 0:
        x.append(a)
    if b > 0:
        x.append(b)
    if c > 0:
        x.append(c)
    x.sort()
    m = x[0]
    return m
        
        
        

# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
def f2(a, b, c):
    x =[]
    if a < 0:
        x.append(a)
    if b < 0:
        x.append(b)
    if c < 0:
        x.append(c)
    x.sort()
    m = x[-1]
    return m
    
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
def f3(a, b, c):
    m = abs(a + b + c)
    m = str(m)
    return m[0]
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c

def f4(a, b, c):
    m = abs(a + b + c)
    m = str(m)
    return m[-1]
    
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c

def main():
    x = [int(e) for e in input().split()]
    s1 = x[0]
    s2 = x[1]
    a = x[2]
    b =x[3]
    c = x[4]
    while s1 ==0 or s1 == 1 and s2 == 0 or s2 == 1:         
        if s1 == 0 and s2 == 0:
            return print(f1(a, b, c))
            
            
        if s1 ==0 and s2 == 1:
            return print(f2(a, b, c))
            
            
        if s1 ==1 and s2 == 0:
            return print(f3(a, b, c))
            
            
        if s1 ==1 and s2 == 1:
            return print(f4(a, b, c))
        break
     
    return print('Error')
     
            
    
    
        
        
    
    # รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
# ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
# ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error


exec(input().strip()) # DON'T remove this line
# 1641384, 2022-09-24 10:21:04, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x = []
    if a > 0:
        x.append(a)
    if b > 0:
        x.append(b)
    if c > 0:
        x.append(c)
    x.sort()
    m = x[0]
    return m
        
        
        

# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
def f2(a, b, c):
    x =[]
    if a < 0:
        x.append(a)
    if b < 0:
        x.append(b)
    if c < 0:
        x.append(c)
    x.sort(reverse = True)
    m = x[0]
    return m
    
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
def f3(a, b, c):
    m = abs(a + b + c)
    m = str(m)
    return m[0]
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c

def f4(a, b, c):
    m = abs(a + b + c)
    m = str(m)
    return m[-1]
    
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c

def main():
    x = [int(e) for e in input().split()]
    s1 = x[0]
    s2 = x[1]
    a = x[2]
    b =x[3]
    c = x[4]
    while s1 ==0 or s1 == 1 and s2 == 0 or s2 == 1:         
        if s1 == 0 and s2 == 0:
            return print(f1(a, b, c))
            
            
        if s1 ==0 and s2 == 1:
            return print(f2(a, b, c))
            
            
        if s1 ==1 and s2 == 0:
            return print(f3(a, b, c))
            
            
        if s1 ==1 and s2 == 1:
            return print(f4(a, b, c))
        break
     
    return print('Error')
     
            
    
    
        
        
    
    # รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
# ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
# ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error


exec(input().strip()) # DON'T remove this line
# 1641435, 2022-09-24 10:22:08, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x = []
    if a > 0:
        x.append(a)
    if b > 0:
        x.append(b)
    if c > 0:
        x.append(c)
    x.sort()
    m = x[0]
    return m
        
        
        

# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
def f2(a, b, c):
    x =[]
    if a < 0:
        x.append(a)
    if b < 0:
        x.append(b)
    if c < 0:
        x.append(c)
    x.sort(reverse = True)
    k = x[0]
    return k
    
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
def f3(a, b, c):
    m = abs(a + b + c)
    m = str(m)
    return m[0]
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c

def f4(a, b, c):
    m = abs(a + b + c)
    m = str(m)
    return m[-1]
    
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c

def main():
    x = [int(e) for e in input().split()]
    s1 = x[0]
    s2 = x[1]
    a = x[2]
    b =x[3]
    c = x[4]
    while s1 ==0 or s1 == 1 and s2 == 0 or s2 == 1:         
        if s1 == 0 and s2 == 0:
            return print(f1(a, b, c))
        if s1 ==0 and s2 == 1:
            return print(f2(a, b, c))
        if s1 ==1 and s2 == 0:
            return print(f3(a, b, c))
        if s1 ==1 and s2 == 1:
            return print(f4(a, b, c))
        break
    return print('Error')
     
            
    
    
        
        
    
    # รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
# ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
# ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error


exec(input().strip()) # DON'T remove this line

6530062521
# 1641178, 2022-09-24 10:17:09, xP--[xx][xxxx] (17%)

def f1(a, b, c):
    x=[a,b,c]
    y=[]
    for e in x :
        if e > 0:
            y.append(e)
    y.sort()
    return y[1]

def f2(a, b, c):
    x=[a,b,c]
    y=[]
    for e in x :
        if e < 0:
            y.append(e)
    y.sort()
    return y[-1]
    
def f3(a, b, c):
    x=abs(a+b+c)
    y=str(x)
    return y[0]

def f4(a, b, c):
    x=abs(a+b+c)
    y=str(x)
    return y[-1]

def main():
    s1,s2,a,b,c,d = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print('Error')

exec(input().strip()) # DON'T remove this line
# 1641323, 2022-09-24 10:19:56, PP--[xx][xxxx] (33%)

def f1(a, b, c):
    x=[a,b,c]
    y=[]
    for e in x :
        if e > 0:
            y.append(e)
    y.sort()
    return y[0]

def f2(a, b, c):
    x=[a,b,c]
    y=[]
    for e in x :
        if e < 0:
            y.append(e)
    y.sort()
    return y[-1]
    
def f3(a, b, c):
    x=abs(a+b+c)
    y=str(x)
    return y[0]

def f4(a, b, c):
    x=abs(a+b+c)
    y=str(x)
    return y[-1]

def main():
    s1,s2,a,b,c,d = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print('Error')

exec(input().strip()) # DON'T remove this line
# 1641601, 2022-09-24 10:25:30, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x=[a,b,c]
    y=[]
    for e in x :
        if e > 0:
            y.append(e)
    y.sort()
    return y[0]

def f2(a, b, c):
    x=[a,b,c]
    y=[]
    for e in x :
        if e < 0:
            y.append(e)
    y.sort()
    return y[-1]
    
def f3(a, b, c):
    x=abs(a+b+c)
    y=str(x)
    return y[0]

def f4(a, b, c):
    x=abs(a+b+c)
    y=str(x)
    return y[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print('Error')

exec(input().strip()) # DON'T remove this line

6530091721
# 1639647, 2022-09-24 09:35:37, PPxx[PP][PxPx] (50%)

def f1(a,b,c):
    z=[]
    for x in (a,b,c):
        if x>0:
            z.append(x)
    return min(z)
def f2(a,b,c):
    z=[]
    for x in (a,b,c):
        if x<0:
            z.append(x)
    return max(z)
def f3(a,b,c):
    x=sum(a,b,c)
    return abs(x//10)
def f4(a,b,c):
    x=sum(a,b,c)
    return abs(x%10)
def main():
    x=input().split()
    for i in range (len(x)):
        x[i]=int(x[i])
    s1=x[0]
    s2=x[1]
    a=x[2]
    b=x[3]
    c=x[4]
    if s1==0 and s2==0 :
        print(f1(a,b,c))
    elif s1==0 and s2==1 :
        print(f2(a,b,c))
    elif s1==1 and s2==0 :
        print(f3(a,b,c))
    elif s1==1 and s2==1 :
        print(f4(a,b,c))
    else :
        print('Error')
exec(input().strip())
# 1639982, 2022-09-24 09:44:34, PP-P[PP][P-P-] (67%)

def f1(a,b,c):
    z=[]
    for x in (a,b,c):
        if x>0:
            z.append(x)
    return min(z)
def f2(a,b,c):
    z=[]
    for x in (a,b,c):
        if x<0:
            z.append(x)
    return max(z)
def f3(a,b,c):
    x=abs(a+b+c)
    return x//10
def f4(a,b,c):
    x=abs(a+b+c)
    return x%10
def main():
    x=input().split()
    for i in range (len(x)):
        x[i]=int(x[i])
    s1=x[0]
    s2=x[1]
    a=x[2]
    b=x[3]
    c=x[4]
    if s1==0 and s2==0 :
        print(f1(a,b,c))
    elif s1==0 and s2==1 :
        print(f2(a,b,c))
    elif s1==1 and s2==0 :
        print(f3(a,b,c))
    elif s1==1 and s2==1 :
        print(f4(a,b,c))
    else :
        print('Error')
exec(input().strip())
# 1640014, 2022-09-24 09:45:51, PP-P[PP][P-P-] (67%)

def f1(a,b,c):
    z=[]
    for x in (a,b,c):
        if x>0:
            z.append(x)
    return min(z)
def f2(a,b,c):
    z=[]
    for x in (a,b,c):
        if x<0:
            z.append(x)
    return max(z)
def f3(a,b,c):
    x=abs(a+b+c)
    return x//10
def f4(a,b,c):
    x=abs(a+b+c)
    return x%10
def main():
    x=input().split()
    for i in range (len(x)):
        x[i]=int(x[i])
    s1=x[0]
    s2=x[1]
    a=x[2]
    b=x[3]
    c=x[4]
    if s1==0 and s2==0 :
        print(f1(a,b,c))
    elif s1==0 and s2==1 :
        print(f2(a,b,c))
    elif s1==1 and s2==0 :
        print(f3(a,b,c))
    elif s1==1 and s2==1 :
        print(f4(a,b,c))
    else :
        print('Error')
exec(input().strip())

6530180921
# 1639911, 2022-09-24 09:42:45, --PP[PP][PPPP] (67%)

def f1(a,b,c):
    li = []
    a = int(a)
    b = int(b)
    c = int(c)
    li.append(a)
    li.append(b)
    li.append(c)
    for x in li:
        if x <= 0:
            li.remove(x)
    return min(li)

def f2(a,b,c):
    l2 = []
    a = int(a)
    b = int(b)
    c = int(c)
    l2.append(a)
    l2.append(b)
    l2.append(c)
    for x in l2:
        if x >= 0:
            l2.remove(x)
    return max(l2)
    
def f3(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    s = abs(a+b+c)
    s = str(s)
    sl = s[0]
    return int(sl)
    
def f4(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    s = a+b+c
    s = str(s)
    sl = s[-1]
    return int(sl)
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 ==0 and s2==0:
        print(f1(a,b,c))
    elif s1 ==0 and s2==1:
        print(f2(a,b,c))
    elif s1 ==1 and s2==0:
        print(f3(a,b,c))
    elif s1 ==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
    
exec(input().strip())
# 1639984, 2022-09-24 09:44:37, --PP[PP][PPPP] (67%)

def f1(a,b,c):
    li = []
    li.append(int(a))
    li.append(int(b))
    li.append(int(c))
    for x in li:
        if x <= 0:
            li.remove(x)
    return min(li)

def f2(a,b,c):
    l2 = []
    l2.append(int(a))
    l2.append(int(b))
    l2.append(int(c))
    for x in l2:
        if x >= 0:
            l2.remove(x)
    return max(l2)
    
def f3(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    s = abs(a+b+c)
    s = str(s)
    sl = s[0]
    return int(sl)
    
def f4(a,b,c):
    a = int(a)
    b = int(b)
    c = int(c)
    s = a+b+c
    s = str(s)
    sl = s[-1]
    return int(sl)
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 ==0 and s2==0:
        print(f1(a,b,c))
    elif s1 ==0 and s2==1:
        print(f2(a,b,c))
    elif s1 ==1 and s2==0:
        print(f3(a,b,c))
    elif s1 ==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
    
exec(input().strip())
# 1640184, 2022-09-24 09:50:31, --PP[PP][PPPP] (67%)

def f1(a,b,c):
    li = []
    li.append(int(a))
    li.append(int(b))
    li.append(int(c))
    for x in li:
        if x <= 0:
            li.remove(x)
    return int(min(li))

def f2(a,b,c):
    l2 = []
    l2.append(int(a))
    l2.append(int(b))
    l2.append(int(c))
    for x in l2:
        if x >= 0:
            l2.remove(x)
    return int(max(l2))
    
def f3(a,b,c):
    s = abs(int(a)+int(b)+int(c))
    s = str(s)
    sl = s[0]
    return int(sl)
    
def f4(a,b,c):
    s = int(a)+int(b)+int(c)
    s = str(s)
    sl = s[-1]
    return int(sl)
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 ==0 and s2==0:
        print(f1(a,b,c))
    elif s1 ==0 and s2==1:
        print(f2(a,b,c))
    elif s1 ==1 and s2==0:
        print(f3(a,b,c))
    elif s1 ==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
    
exec(input().strip())

6531310321
# 1640108, 2022-09-24 09:48:20, -P--[PP][PPPP] (50%)

def f1(a,b,c):
    if a>=0 :
        min = a
    elif b>=0:
        min =b
    elif c>=0:
        min =c
    if min>a>0:
        min=a
    if min>b>0:
        min = b
    if min>c>0:
        min=c
    return min

def f2(a,b,c):
    if a<0:
        max=a
    elif b<0:
        max=b
    elif c<0:
        max=c
    if max<a<0:
        max=a
    if max<b<0:
        max=b
    if max<c<0:
        max=c
    return max

def f3(a,b,c):
    g=a+b+c
    if str(g)[0]!='-':
        return str(g)[0]
    elif str(g)[0]=='-':
        return str(g)[1]

def f4(a,b,c):
    g=a+b+c
    return str(g)[-1]

def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')   
exec(input().strip())
# 1640150, 2022-09-24 09:49:33, PP--[PP][PPPP] (67%)

def f1(a,b,c):
    if a>0 :
        min = a
    elif b>0:
        min =b
    elif c>0:
        min =c
    if min>a>0:
        min=a
    if min>b>0:
        min = b
    if min>c>0:
        min=c
    return min

def f2(a,b,c):
    if a<0:
        max=a
    elif b<0:
        max=b
    elif c<0:
        max=c
    if max<a<0:
        max=a
    if max<b<0:
        max=b
    if max<c<0:
        max=c
    return max

def f3(a,b,c):
    g=a+b+c
    if str(g)[0]!='-':
        return str(g)[0]
    elif str(g)[0]=='-':
        return str(g)[1]

def f4(a,b,c):
    g=a+b+c
    return str(g)[-1]

def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')   
exec(input().strip())
# 1642441, 2022-09-24 10:38:44, PP--[PP][PPPP] (67%)

def f1(a,b,c):
    if a>0 :
        min = a
    elif b>0:
        min =b
    elif c>0:
        min =c
    if min>a>0:
        min=a
    if min>b>0:
        min = b
    if min>c>0:
        min=c
    return min

def f2(a,b,c):
    if a<0:
        max=a
    elif b<0:
        max=b
    elif c<0:
        max=c
    if max<a<0:
        max=a
    if max<b<0:
        max=b
    if max<c<0:
        max=c
    return max

def f3(a,b,c):
    g=a+b+c
    if str(g)[0]!='-':
        return str(int(g))[0]
    elif str(g)[0]=='-':
        return str(int(g))[1]

def f4(a,b,c):
    g=a+b+c
    return str(int(g))[-1]

def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')   
exec(input().strip())

6431017421
# 1641290, 2022-09-24 10:19:18, xxPP[--][----] (33%)

def f1(a,b,c):
    a=int(a)
    b=int(b)
    c=int(c)
    if a > 0 and b>0 and c>0:
        x=min(a,b,c)
    elif a < 0 and b>0 and c>0:
        x=min(b,c)
    elif a < 0 and b<0 and c>0:
        x=c
    elif a > 0 and b>0 and c<0:
        x=min(a,b)
    elif a < 0 and b>0 and c<0:
        x=b
    elif a > 0 and b<0 and c<0:
        x=a
    elif a > 0 and b<0 and c>0:
        x=min(a,c)
    return x
    
    
def f2(a,b,c):
    a=int(a)
    b=int(b)
    c=int(c)
    if a < 0 and b<0 and c<0:
        x=max(a,b,c)
    elif a > 0 and b<0 and c<0:
        x=max(b,c)
    elif a > 0 and b>0 and c<0:
        x=c
    elif a < 0 and b<0 and c>0:
        x=max(a,b)
    elif a > 0 and b<0 and c>0:
        x=b
    elif a < 0 and b>0 and c>0:
        x=a
    elif a < 0 and b>0 and c<0:
        x=max(a,c)
    return x
    
    
    
    
def f3(a,b,c):
    a = (int(a))
    b = (int(b))
    c = (int(c))
    x = abs(a+b+c)
    x = str(x)
    y = int(x[0])
    return y
    
    
    
def f4(a,b,c):
    a = (int(a))
    b = (int(b))
    c = (int(c))
    x = abs(a+b+c)
    x = str(x)
    y = int(x[-1])
    return y
    
    
def main():
    pass

exec(input().strip())
# 1641774, 2022-09-24 10:28:43, xxPP[PP][PPPP] (67%)

def f1(a,b,c):
    a=int(a)
    b=int(b)
    c=int(c)
    if a > 0 and b>0 and c>0:
        x=min(a,b,c)
    elif a < 0 and b>0 and c>0:
        x=min(b,c)
    elif a < 0 and b<0 and c>0:
        x=c
    elif a > 0 and b>0 and c<0:
        x=min(a,b)
    elif a < 0 and b>0 and c<0:
        x=b
    elif a > 0 and b<0 and c<0:
        x=a
    elif a > 0 and b<0 and c>0:
        x=min(a,c)
    return x
    
    
def f2(a,b,c):
    a=int(a)
    b=int(b)
    c=int(c)
    if a < 0 and b<0 and c<0:
        x=max(a,b,c)
    elif a > 0 and b<0 and c<0:
        x=max(b,c)
    elif a > 0 and b>0 and c<0:
        x=c
    elif a < 0 and b<0 and c>0:
        x=max(a,b)
    elif a > 0 and b<0 and c>0:
        x=b
    elif a < 0 and b>0 and c>0:
        x=a
    elif a < 0 and b>0 and c<0:
        x=max(a,c)
    return x
    
    
    
    
def f3(a,b,c):
    a = (int(a))
    b = (int(b))
    c = (int(c))
    x = abs(a+b+c)
    x = str(x)
    y = int(x[0])
    return y
    
    
    
def f4(a,b,c):
    a = (int(a))
    b = (int(b))
    c = (int(c))
    x = abs(a+b+c)
    x = str(x)
    y = int(x[-1])
    return y
    
    
def main():
    x=[int(e) for e in input().split()]
    if x[0]==0 and x[1]==0 :
        print(f1(x[2],x[3],x[4]))
    elif x[0]==0 and x[1]==1 :
        print(f2(x[2],x[3],x[4]))
    elif x[0]==1 and x[1]==0 :
        print(f3(x[2],x[3],x[4]))
    elif x[0]==1 and x[1]==1 :
        print(f4(x[2],x[3],x[4]))
    else :
        print("Error")
    
    

exec(input().strip())

6530041321
# 1639811, 2022-09-24 09:40:04, PP--[PP][-PPP] (50%)

def f1(a, b, c):
    x=[]
    if a>0:
        x.append(int(a))
    if b>0:
        x.append(int(b))
    if c>0:
        x.append(int(c))
    return min(x)
    
    
def f2(a, b, c):
    x=[]
    if a<0:
        x.append(int(a))
    if b<0:
        x.append(int(b))
    if c<0:
        x.append(int(c))
    return max(x)


def f3(a, b, c):
    s = int(a)+int(b)+int(c)
    s = abs(s)
    s = str(s)
    return s[0]


def f4(a, b, c):
    s = int(a)+int(b)+int(c)
    s = abs(s)
    s = str(s)
    return s[-1]


def main():
    s1,s2,a,b,c = input().split()
    s1 = int(s1)
    s2 = int(s2)
    a = int(a)
    b = int(b)
    c = int(c)
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    if s1 != 0 and s1 != 1 and\
       s1 != 0 and s1 != 1:
        print('Error')
    
exec(input().strip()) # DON'T remove this line
# 1642293, 2022-09-24 10:37:00, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    x=[]
    if a>0:
        x.append(int(a))
    if b>0:
        x.append(int(b))
    if c>0:
        x.append(int(c))
    return min(x)
    
    
def f2(a, b, c):
    x=[]
    if a<0:
        x.append(int(a))
    if b<0:
        x.append(int(b))
    if c<0:
        x.append(int(c))
    return max(x)


def f3(a, b, c):
    s = int(a)+int(b)+int(c)
    s = abs(s)
    s = str(s)
    return s[0]


def f4(a, b, c):
    s = int(a)+int(b)+int(c)
    s = abs(s)
    s = str(s)
    return s[-1]


def main():
    s1,s2,a,b,c = input().split()
    s1 = int(s1)
    s2 = int(s2)
    a = int(a)
    b = int(b)
    c = int(c)
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    if s1 != 0 and s1 != 1:
        print('Error')
    else:
       if s2 != 0 and s2 != 1:
        print('Error')
    
exec(input().strip()) # DON'T remove this line

6530055121
# 1640560, 2022-09-24 10:00:54, ----[--][----] (0%)

def f1(a, b, c):
    t = [int(a),int(b),int(c)]
    t.sort()
    x = []
    for i in range(len(t)):
        if t[i] > 0:
            x.append(t[i])
    return x[0]

def f2(a, b, c):
    t = [int(a),int(b),int(c)]
    t.sort()
    x = []
    for i in range(len(t)):
        if t[i] < 0:
            x.append(t[i])
    return x[-1]


def f3(a, b, c):
    t = [int(a),int(b),int(c)]
    s = str(abs(a+b+c))
    return s[0]
def f4(a, b, c):
    t = [int(a),int(b),int(c)]
    s = str(abs(a+b+c))
    return s[-1]
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 ==0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
# 1641497, 2022-09-24 10:23:37, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    t = [int(a),int(b),int(c)]
    t.sort()
    x = []
    for i in range(len(t)):
        if t[i] > 0:
            x.append(t[i])
    return x[0]

def f2(a, b, c):
    t = [int(a),int(b),int(c)]
    t.sort()
    x = []
    for i in range(len(t)):
        if t[i] < 0:
            x.append(t[i])
    return x[-1]


def f3(a, b, c):
    t = [int(a),int(b),int(c)]
    s = str(abs(a+b+c))
    return s[0]
def f4(a, b, c):
    t = [int(a),int(b),int(c)]
    s = str(abs(a+b+c))
    return s[-1]
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 ==0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip())

6530094621
# 1640003, 2022-09-24 09:45:31, PP--[--][P-P-] (33%)

def f1(a,b,c) :
    ans = []
    if a > 0 :
        ans.append(a)
    if b > 0 :
        ans.append(b)
    if c > 0 :
        ans.append(c)
    return min(ans)

def f2(a, b, c) :
    ans = []
    if a < 0 :
        ans.append(a)
    if b < 0 :
        ans.append(b)
    if c < 0 :
        ans.append(c)
    return max(ans)

def f3(a, b, c):
    sum = a+b+c
    x = abs(sum)
    ans = str(x)[0]
    return(ans)

def f4(a, b, c):
    sum = a+b+c
    x = abs(sum)
    ans = str(x)[-1]
    return(ans)
    
def main():
    s1,s2,a,b,c = input().split()
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c)) 
    elif s1 == 1and s2  == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 ==1 :
        print(f4(a,b,c))
    else :
        print("Error")
        
exec(input().strip())

# 1640593, 2022-09-24 10:02:00, PP--[PP][PPPP] (67%)

def f1(a,b,c) :
    ans = []
    if a > 0 :
        ans.append(a)
    if b > 0 :
        ans.append(b)
    if c > 0 :
        ans.append(c)
    return min(ans)

def f2(a, b, c) :
    ans = []
    if a < 0 :
        ans.append(a)
    if b < 0 :
        ans.append(b)
    if c < 0 :
        ans.append(c)
    return max(ans)

def f3(a, b, c):
    summ = a+b+c
    x = abs(summ)
    ans = str(x)[0]
    return(ans)

def f4(a, b, c):
    summ = a+b+c
    x = abs(summ)
    ans = str(x)[-1]
    return(ans)
    
def main():
    s1,s2,a,b,c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c)) 
    elif s1 == 1 and s2  == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 ==1 :
        print(f4(a,b,c))
    else :
        print("Error")
        
exec(input().strip())


6530100721
# 1640496, 2022-09-24 09:59:18, ----[--][----] (0%)

1
# 1640509, 2022-09-24 09:59:31, PPPP[P-][PTPT] (67%)

def f1(a, b, c):
    d = 1000
    e = 1000
    f = 1000
    if a > 0:
        d = a
    if b > 0:
        e = b
    if c > 0:
        f = c
    min1 = min(d,e,f)
    return min1
def f2(a, b, c):

    d = -1000
    e = -1000
    f = -1000
    if a < 0:
        d = a
    if b < 0:
        e = b
    if c < 0:
        f = c
    max1 = max(d,e,f)
    return max1
def f3(a, b, c):

    sum1 = a+b+c
    sum1 = abs(sum1)
    while sum1 >= 10:
        sum1 = sum1//10
    return sum1
def f4(a, b, c):
    sum2 = a+b+c
    sum2 = abs(sum2)
    sum2 = sum2%10
    return sum2    

def main():
    s = input().split()
    s1 = int(s[0])
    s2 = int(s[1])
    a = int(s[2])
    b = int(s[3])
    c = int(s[4])
    if s1 == 0 and s2 == 0:
        d = 1000
        e = 1000
        f = 1000
        if a > 0:
            d = a
        if b > 0:
            e = b
        if c > 0:
            f = c
        x = min(d,e,f)
    if s1 == 0 and s2 == 1:
        d = -1000
        e = -1000
        f = -1000
        if a < 0:
            d = a
        if b < 0:
            e = b
        if c < 0:
            f = c
        x = max(d,e,f)
    if s1 == 1 and s2 == 0:
        sum1 = a+b+c
        sum1 = abs(sum1)
        while sum1 >= 10:
            x = sum1//10
    if s1 == 1 and s2 == 1:
        sum2 = a+b+c
        sum2 = abs(sum2)
        x = sum2%10
    elif s1 or s2 != 0 and 1:
        x = "Error"
    print(x)
exec(input().strip())

6530118021
# 1640013, 2022-09-24 09:45:50, PP--[PP][PPPP] (67%)

def f1(a, b, c) :
  d = [a,b,c]
  d.sort()
  for a in d :
    if a > 0 :
      break
  return a
def f2(a, b, c):
  d = [a,b,c]
  d.sort()
  for i in range(len(d)):
    if d[i] >= 0 :
      return d[i-1]
def f3(a, b, c):
  d = [a,b,c]
  s = 0
  for e in d :
      s += e
  if s < 0 :
    return str(s)[1]
  else :
    return str(s)[0]
def f4(a, b, c):
  d = [a,b,c]
  s = 0
  for e in d :
    s += e
  return str(s)[-1]
def main() :
  s1,s2,a,b,c = [int(e) for e in input().split()]
  if s1 == 0 and s2 == 0 :
    print(f1(a,b,c))
  elif s1 == 0 and s2 == 1 :
    print(f2(a,b,c))
  elif s1 == 1 and s2 == 0 :
    print(f3(a,b,c))
  elif s1 == 1 and s2 == 1 :
    print(f4(a,b,c))
  else :
    print("Error")

exec(input().strip())
# 1642001, 2022-09-24 10:32:48, PP--[PP][PPPP] (67%)

def f1(a, b, c) :
  d = [a,b,c]
  d.sort()
  for a in d :
    if a > 0 :
      break
  return a
def f2(a, b, c):
  d = [a,b,c]
  d.sort()
  for i in range(len(d)):
    if d[i] >= 0 :
      return d[i-1]
  return d[-1]
def f3(a, b, c):
  d = [a,b,c]
  s = 0
  for e in d :
      s += e
  if s < 0 :
    return str(s)[1]
  else :
    return str(s)[0]
def f4(a, b, c):
  d = [a,b,c]
  s = 0
  for e in d :
    s += e
  return str(s)[-1]
def main() :
  s1,s2,a,b,c = [int(e) for e in input().split()]
  if s1 == 0 and s2 == 0 :
    print(f1(a,b,c))
  elif s1 == 0 and s2 == 1 :
    print(f2(a,b,c))
  elif s1 == 1 and s2 == 0 :
    print(f3(a,b,c))
  elif s1 == 1 and s2 == 1 :
    print(f4(a,b,c))
  else :
    print("Error")

exec(input().strip())

6530177021
# 1640948, 2022-09-24 10:11:09, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    x = [a,b,c]
    for i in x:
        if i < 0:
            x.remove(i)
    k = min(x)
    return k

def f2(a, b, c):
    x = [a,b,c]
    for e in x:
        if e > 0:
            x.remove(e)
    m = max(x)
    return m

# ส่วนที่ผิด
# def f3(a, b, c):
#     a = str(a);b = str(b);c = str(c)
#     l = 0
#     if '-' in a:
#         a = a[1:]
#     if '-' in b:
#         b = b[1:]
#     if '-' in c:
#         c = c[1:]
#     l = int(a)+int(b)+int(c)
#     return l

def f3(a, b, c):
    z = ''
    l = a+b+c
    l = str(l)
    if '-' in l:
        z = l[1]
    else :
        z = l[0]
    z = int(z)
    return z

def f4(a, b, c):
    n = ''
    u = a+b+c
    u = str(u)
    n = u[-1]
    n = int(n)
    return n

def main():
    s1,s2,a,b,c = input().split()
    a = int(a);b= int(b) ;c = int(c)
    if s1 == '0' and s2 == '0' :
        print(f1(a, b, c)
)
    elif s1 == '0' and s2 == '1' :
        print(f2(a, b, c)
)
    elif s1 == '1' and s2 == '0' :
        print(f3(a, b, c)
)
    elif s1 == '1' and s2 == '1' :
        print(f4(a, b, c)
)
    else :
        print('Error')

#     print(type(s1),s2,type(a),b,c)

exec(input().strip())
# 1642463, 2022-09-24 10:39:01, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    x = [a,b,c]
    j = x
    for i in x:
        if i < 0:
            j.remove(i)
    k = min(j)
    return k

def f2(a, b, c):
    y = [a,b,c]
    p = y
    for e in y:
        if e > 0:
            p.remove(e)
    m = max(p)
    return m

def f3(a, b, c):
    z = ''
    l = a+b+c
    l = str(l)
    if '-' in l:
        z = l[1]
    else :
        z = l[0]
    z = int(z)
    return z

def f4(a, b, c):
    n = ''
    u = a+b+c
    u = str(u)
    n = u[-1]
    n = int(n)
    return n

def main():
    s1,s2,a,b,c = input().split()
    a = int(a);b= int(b) ;c = int(c)
    if s1 == '0' and s2 == '0' :
        print(f1(a, b, c))
    elif s1 == '0' and s2 == '1' :
        print(f2(a, b, c))
    elif s1 == '1' and s2 == '0' :
        print(f3(a, b, c))
    elif s1 == '1' and s2 == '1' :
        print(f4(a, b, c))
    else :
        print('Error')

#     print(type(s1),s2,type(a),b,c)

exec(input().strip())

6531407621
# 1640198, 2022-09-24 09:50:49, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    f1list = [a,b,c]
    for i in f1list:
        if i < 0 :
            f1list.remove(i)
    return min(f1list)

def f2(a, b, c):
    f2list = [a,b,c]
    for i in f2list:
        if i > 0 :
            f2list.remove(i)
    return max(f2list)

def f3(a, b, c):
    s = abs(a+b+c)
    return int(str(s)[0])

def f4(a, b, c):
    s = abs(a+b+c)
    return s%10

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
        
exec(input().strip()) # DON'T remove this line


6530147221
# 1640009, 2022-09-24 09:45:41, --PP[PP][PPPP] (67%)

def f1(a, b, c):
    if a > 0 and b >0 :
        if a > b :
            return b
        else:
            return a
    elif a > 0 and c> 0:
        if a > c:
            return c
        else:
            return a
    elif b > 0 and c > 0:
        if b > c:
            return c
        else:
            return b
    elif a > 0 and b < 0 and c <0:
        return a
    elif b > 0 and a < 0 and c < 0:
        return b
    elif c > 0 and a < 0 and b < 0:
        return c
    


def f2(a, b, c):
    if a < 0 and b <0 :
        if a < b :
            return b
        else:
            return a
    elif a < 0 and c< 0:
        if a < c:
            return c
        else:
            return a
    elif b < 0 and c < 0:
        if b < c:
            return c
        else:
            return b
    elif a < 0 and b > 0 and c >0:
        return a
    elif b < 0 and a > 0 and c > 0:
        return b
    elif c < 0 and a > 0 and b > 0:
        return c
    


def f3(a, b, c):
    x = a+b+c
    x = str(x)
    if x[0] == "-":
        y = int(x[1])
        return y
    else:
        y = int(x[0])
        return y
    
    
    
    
def f4(a, b, c):
    x = a+b+c
    x = str(x)
    y = int(x[-1])
    return y


def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 ==1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 ==0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 ==1 :
        print(f4(a, b, c))
    else :
        print("Error")
exec(input().strip()) #DON'T remove this line
        

6531801121
# 1639335, 2022-09-24 09:27:48, PP--[PP][PPPP] (67%)

def f1(a, b, c):
    check = [a, b, c]
    positive = []
    for i in check:
        if i > 0:
            positive.append(i)
        else:
            pass
    return min(positive)

def f2(a, b, c):
    check = [a, b, c]
    negative = []
    for i in check:
        if i < 0:
            negative.append(i)
        else:
            pass
    return max(negative)

def f3(a, b, c):
    total = abs(a + b + c)
    total_str = str(total)
    return total_str[0]

def f4(a, b, c):
    total = abs(a + b + c)
    total_str = str(total)
    return total_str[-1]

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip())   

6531805721
# 1639558, 2022-09-24 09:33:23, PP--[PP][PPPP] (67%)

def f1(a,b,c):
    a = [a,b,c]
    final = [e for e in a if e > 0]
    b = min(final)
    return b

def f2(a,b,c):
    a = [a,b,c]
    final = [e for e in a if e < 0]
    b = max(final)
    return b

def f3(a,b,c):
    s = abs(a + b + c)
    s1 = str(s)
    return s1[0]

def f4(a,b,c):
    s = abs(a + b + c)
    s1 = str(s)
    return s1[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
    
exec(input().strip())

Max Score = 50


6431120321
# 1639795, 2022-09-24 09:39:28, -xxx[xx][xxxx] (0%)

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    min = 0
    if b < abs(a) and b < abs(c) and b >= 0:
        min = b
    if a < abs(c) and a < abs(b) and a >= 0:
        min = a
    if c < abs(a) and c < abs(b) and c >= 0:
        min = c
    return min
exec(input().strip()) # DON'T remove this line
# 1640128, 2022-09-24 09:49:09, compilation error (0%)

# - เป็นจำนวนเต็ม มีค่าได้ตั้งแต่ -1000 ถึง 1000
# - มีอย่างน้อยค่าหนึ่งใน a, b หรือ c ที่มีค่ามากกว่า 0
# - มีอย่างน้อยค่าหนึ่งใน a, b หรือ c ที่มีค่าน้อยกว่า 0

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    x = [a,b,c]
    for i in x:
        if i < 0:
            x.remove(i)
    if x[0] > x[1] :
        m = x[1]
    else:
        m = x[0]
    return m

def f2(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    x = [a,b,c]
    for i in x:
        if i >= 0:
            x.remove(i)
    if x[0] > x[1] :
        m = x[0]
    else:
        m = x[1]
    return m
    
  exec(input().strip()) # DON'T remove this line
# 1640136, 2022-09-24 09:49:19, compilation error (0%)

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    x = [a,b,c]
    for i in x:
        if i < 0:
            x.remove(i)
    if x[0] > x[1] :
        m = x[1]
    else:
        m = x[0]
    return m

def f2(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    x = [a,b,c]
    for i in x:
        if i >= 0:
            x.remove(i)
    if x[0] > x[1] :
        m = x[0]
    else:
        m = x[1]
    return m
    
  exec(input().strip()) # DON'T remove this line
# 1640151, 2022-09-24 09:49:35, compilation error (0%)

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    x = [a,b,c]
    for i in x:
        if i < 0:
            x.remove(i)
    if x[0] > x[1] :
        m = x[1]
    else:
        m = x[0]
    return m

def f2(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    x = [a,b,c]
    for i in x:
        if i >= 0:
            x.remove(i)
    if x[0] > x[1] :
        m = x[0]
    else:
        m = x[1]
    return m
    
  exec(input().strip()) # DON'T remove this line
# 1640155, 2022-09-24 09:49:48, xxxx[xx][xxxx] (0%)

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    x = [a,b,c]
    for i in x:
        if i < 0:
            x.remove(i)
    if x[0] > x[1] :
        m = x[1]
    else:
        m = x[0]
    return m

def f2(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    x = [a,b,c]
    for i in x:
        if i >= 0:
            x.remove(i)
    if x[0] > x[1] :
        m = x[0]
    else:
        m = x[1]
    return m
    
exec(input().strip())
# 1640758, 2022-09-24 10:06:18, xxPP[P-][PPPP] (50%)

# - เป็นจำนวนเต็ม มีค่าได้ตั้งแต่ -1000 ถึง 1000
# - มีอย่างน้อยค่าหนึ่งใน a, b หรือ c ที่มีค่ามากกว่า 0
# - มีอย่างน้อยค่าหนึ่งใน a, b หรือ c ที่มีค่าน้อยกว่า 0

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    x = [a,b,c]
    for i in x:
        if i < 0:
            x.remove(i)
    if x[0] > x[1] :
        m = x[1]
    else:
        m = x[0]
    return m

def f2(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    x = [a,b,c]
    for i in x:
        if i >= 0:
            x.remove(i)
    if x[0] > x[1] :
        m = x[0]
    else:
        m = x[1]
    return m

def f3(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
    sum = a+b+c
    x = []
    for i in str(sum):
        x.append(i)
    if x[0] == '-':
        u = x[1]
    else:
        u = x[0]
    return int(u)

def f4(a, b, c):

    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    sum = a+b+c
    x = []
    for i in str(sum):
        x.append(i)
    return int(x[-1])    
        
def main():
    # รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
    # ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
    # ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
    # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
    # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
    # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
    # ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s2 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    if s1 not in [0,1] or s2 not in [0,1] :
        print('Error')
    
exec(input().strip())
# 1641476, 2022-09-24 10:23:13, xxPP[P-][PPPP] (50%)

# - เป็นจำนวนเต็ม มีค่าได้ตั้งแต่ -1000 ถึง 1000
# - มีอย่างน้อยค่าหนึ่งใน a, b หรือ c ที่มีค่ามากกว่า 0
# - มีอย่างน้อยค่าหนึ่งใน a, b หรือ c ที่มีค่าน้อยกว่า 0

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    x = [a,b,c]
    for i in x:
        if i < 0:
            x.remove(i)
    if x[0] > x[1] :
        m = x[1]
    else:
        m = x[0]
    return m

def f2(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    x = [a,b,c]
    for i in x:
        if i >= 0:
            x.remove(i)
    if x[0] > x[1] :
        m = x[0]
    else:
        m = x[1]
    return m

def f3(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
    sum = a+b+c
    x = []
    for i in str(sum):
        x.append(i)
    if x[0] == '-':
        u = x[1]
    else:
        u = x[0]
    return int(u)

def f4(a, b, c):

    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    sum = a+b+c
    x = []
    for i in str(sum):
        x.append(i)
    return int(x[-1])    
        
def main():
    # รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
    # ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
    # ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
    # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
    # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
    # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
    # ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s2 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    if s1 not in [0,1] or s2 not in [0,1] :
        print('Error')
    
exec(input().strip())
# 1641579, 2022-09-24 10:25:03, xxPP[P-][PPPP] (50%)

# - เป็นจำนวนเต็ม มีค่าได้ตั้งแต่ -1000 ถึง 1000
# - มีอย่างน้อยค่าหนึ่งใน a, b หรือ c ที่มีค่ามากกว่า 0
# - มีอย่างน้อยค่าหนึ่งใน a, b หรือ c ที่มีค่าน้อยกว่า 0

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    x = [a,b,c]
    for i in x:
        if i < 0:
            x.remove(i)
    if x[0] > x[1] :
        m = x[1]
    else:
        m = x[0]
    return m

def f2(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    x = [a,b,c]
    for i in x:
        if i > 0:
            x.remove(i)
    if x[0] > x[1] :
        m = x[0]
    else:
        m = x[1]
    return m

def f3(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
    sum = a+b+c
    x = []
    for i in str(sum):
        x.append(i)
    if x[0] == '-':
        u = x[1]
    else:
        u = x[0]
    return int(u)

def f4(a, b, c):

    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    sum = a+b+c
    x = []
    for i in str(sum):
        x.append(i)
    return int(x[-1])    
        
def main():
    # รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
    # ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
    # ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
    # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
    # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
    # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
    # ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s2 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    if s1 not in [0,1] or s2 not in [0,1] :
        print('Error')
    

    
exec(input().strip())
# 1641719, 2022-09-24 10:27:43, xxPP[P-][PPPP] (50%)

# - เป็นจำนวนเต็ม มีค่าได้ตั้งแต่ -1000 ถึง 1000
# - มีอย่างน้อยค่าหนึ่งใน a, b หรือ c ที่มีค่ามากกว่า 0
# - มีอย่างน้อยค่าหนึ่งใน a, b หรือ c ที่มีค่าน้อยกว่า 0

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    x = [a,b,c]
    for i in x:
        if i < 0:
            x.remove(i)
    if x[0] >= x[1] :
        m = x[1]
    else:
        m = x[0]
    return m

def f2(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    x = [a,b,c]
    for i in x:
        if i > 0:
            x.remove(i)
    if x[0] > x[1] :
        m = x[0]
    else:
        m = x[1]
    return m

def f3(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
    sum = a+b+c
    x = []
    for i in str(sum):
        x.append(i)
    if x[0] == '-':
        u = x[1]
    else:
        u = x[0]
    return int(u)

def f4(a, b, c):

    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    sum = a+b+c
    x = []
    for i in str(sum):
        x.append(i)
    return int(x[-1])    
        
def main():
    # รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
    # ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
    # ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
    # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
    # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
    # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
    # ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s2 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    if s1 not in [0,1] or s2 not in [0,1] :
        print('Error')
    

    
exec(input().strip())
# 1642156, 2022-09-24 10:35:16, -xPP[--][PPPP] (50%)

# - เป็นจำนวนเต็ม มีค่าได้ตั้งแต่ -1000 ถึง 1000
# - มีอย่างน้อยค่าหนึ่งใน a, b หรือ c ที่มีค่ามากกว่า 0
# - มีอย่างน้อยค่าหนึ่งใน a, b หรือ c ที่มีค่าน้อยกว่า 0

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    x = [0,1,-1]
    o = []
    for i in x:
        if i > 0 :
            o.append(i)
            if len(o) > 1 and o[0] >= o[1] :
                m = o[1]
            else:
                m = o[0]
    return m,o


def f2(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    x = [a,b,c]
    for i in x:
        if i > 0:
            x.remove(i)
    if x[0] > x[1] :
        m = x[0]
    else:
        m = x[1]
    return m

def f3(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
    sum = a+b+c
    x = []
    for i in str(sum):
        x.append(i)
    if x[0] == '-':
        u = x[1]
    else:
        u = x[0]
    return int(u)

def f4(a, b, c):

    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    sum = a+b+c
    x = []
    for i in str(sum):
        x.append(i)
    return int(x[-1])    
        
def main():
    # รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
    # ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
    # ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
    # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
    # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
    # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
    # ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s2 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    if s1 not in [0,1] or s2 not in [0,1] :
        print('Error')
    

    
exec(input().strip())
# 1642214, 2022-09-24 10:36:00, -xPP[P-][PPPP] (50%)

# - เป็นจำนวนเต็ม มีค่าได้ตั้งแต่ -1000 ถึง 1000
# - มีอย่างน้อยค่าหนึ่งใน a, b หรือ c ที่มีค่ามากกว่า 0
# - มีอย่างน้อยค่าหนึ่งใน a, b หรือ c ที่มีค่าน้อยกว่า 0

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    x = [0,1,-1]
    o = []
    for i in x:
        if i > 0 :
            o.append(i)
            if len(o) > 1 and o[0] >= o[1] :
                m = o[1]
            else:
                m = o[0]
    return m,o

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    x = [0,1,-1]
    o = []
    for i in x:
        if i > 0 :
            o.append(i)
            if len(o) > 1 and o[0] >= o[1] :
                m = o[1]
            else:
                m = o[0]
    return m

def f3(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
    sum = a+b+c
    x = []
    for i in str(sum):
        x.append(i)
    if x[0] == '-':
        u = x[1]
    else:
        u = x[0]
    return int(u)

def f4(a, b, c):

    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    sum = a+b+c
    x = []
    for i in str(sum):
        x.append(i)
    return int(x[-1])    
        
def main():
    # รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
    # ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
    # ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
    # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
    # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
    # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
    # ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s2 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    if s1 not in [0,1] or s2 not in [0,1] :
        print('Error')
    

    
exec(input().strip())
# 1642232, 2022-09-24 10:36:13, -xPP[P-][PPPP] (50%)

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    x = [0,1,-1]
    o = []
    for i in x:
        if i > 0 :
            o.append(i)
            if len(o) > 1 and o[0] >= o[1] :
                m = o[1]
            else:
                m = o[0]
    return m

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    x = [0,1,-1]
    o = []
    for i in x:
        if i > 0 :
            o.append(i)
            if len(o) > 1 and o[0] >= o[1] :
                m = o[1]
            else:
                m = o[0]
    return m

def f3(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
    sum = a+b+c
    x = []
    for i in str(sum):
        x.append(i)
    if x[0] == '-':
        u = x[1]
    else:
        u = x[0]
    return int(u)

def f4(a, b, c):

    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    sum = a+b+c
    x = []
    for i in str(sum):
        x.append(i)
    return int(x[-1])    
        
def main():
    # รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
    # ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
    # ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
    # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
    # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
    # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
    # ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s2 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    if s1 not in [0,1] or s2 not in [0,1] :
        print('Error')
    

    
exec(input().strip())
# 1642246, 2022-09-24 10:36:26, -xPP[P-][PPPP] (50%)


def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    x = [0,1,-1]
    o = []
    for i in x:
        if i > 0 :
            o.append(i)
            if len(o) > 1 and o[0] >= o[1] :
                m = o[1]
            else:
                m = o[0]
    return m

def f3(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
    sum = a+b+c
    x = []
    for i in str(sum):
        x.append(i)
    if x[0] == '-':
        u = x[1]
    else:
        u = x[0]
    return int(u)

def f4(a, b, c):

    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    sum = a+b+c
    x = []
    for i in str(sum):
        x.append(i)
    return int(x[-1])    
        
def main():
    # รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
    # ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
    # ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
    # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
    # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
    # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
    # ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s2 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    if s1 not in [0,1] or s2 not in [0,1] :
        print('Error')
    

    
exec(input().strip())
# 1642308, 2022-09-24 10:37:12, -xPP[P-][PPPP] (50%)

# - เป็นจำนวนเต็ม มีค่าได้ตั้งแต่ -1000 ถึง 1000
# - มีอย่างน้อยค่าหนึ่งใน a, b หรือ c ที่มีค่ามากกว่า 0
# - มีอย่างน้อยค่าหนึ่งใน a, b หรือ c ที่มีค่าน้อยกว่า 0
def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    x = [0,1,-1]
    o = []
    for i in x:
        if i > 0 :
            o.append(i)
            if len(o) > 1 and o[0] >= o[1] :
                m = o[1]
            else:
                m = o[0]
    return m

def f2(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    x = [a,b,c]
    for i in x:
        if i > 0:
            x.remove(i)
    if x[0] > x[1] :
        m = x[0]
    else:
        m = x[1]
    return m

def f3(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
    sum = a+b+c
    x = []
    for i in str(sum):
        x.append(i)
    if x[0] == '-':
        u = x[1]
    else:
        u = x[0]
    return int(u)

def f4(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    sum = a+b+c
    x = []
    for i in str(sum):
        x.append(i)
    return int(x[-1])    
        
def main():
    # รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
    # ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
    # ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
    # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
    # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
    # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
    # ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s2 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    if s1 not in [0,1] or s2 not in [0,1] :
        print('Error')
    

exec(input().strip())

6231401521
# 1640031, 2022-09-24 09:46:22, ---P[PP][P-P-] (33%)

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

def f1(a,b,c):
   if a <= 0:
       return min(b,c)
   if b <= 0:
       return min(a,c)
   if c <= 0:
       return min(a,b)
    
def f2(a,b,c):
    if a >= 0:
        return max(b,c)
    if b >= 0:
        return max(a,c)
    if c >= 0:
        return max(a,b)

def f3(a,b,c):
    x = a+b+c
    x = abs(x)//10
    return x

def f4(a,b,c):
    x = a+b+c
    x = abs(x)%10
    return x

exec(input().strip())
# 1640084, 2022-09-24 09:47:45, ---P[PP][P-P-] (33%)

def f1(a,b,c):
   if a <= 0:
       return min(b,c)
   if b <= 0:
       return min(a,c)
   if c <= 0:
       return min(a,b)
    
def f2(a,b,c):
    if a >= 0:
        return max(b,c)
    if b >= 0:
        return max(a,c)
    if c >= 0:
        return max(a,b)

def f3(a,b,c):
    x = a+b+c
    x = abs(x)//10
    return x

def f4(a,b,c):
    x = a+b+c
    x = abs(x)%10
    return x
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')


exec(input().strip())
# 1640275, 2022-09-24 09:52:53, ---P[PP][PPPP] (50%)

def f1(a,b,c):
   if a <= 0:
       return min(b,c)
   if b <= 0:
       return min(a,c)
   if c <= 0:
       return min(a,b)
    
def f2(a,b,c):
    if a >= 0:
        return max(b,c)
    if b >= 0:
        return max(a,c)
    if c >= 0:
        return max(a,b)

def f3(a,b,c):
    x = a+b+c
    x = abs(x)
    x = str(x)
    return x[0]

def f4(a,b,c):
    x = a+b+c
    x = abs(x)%10
    return x
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')


exec(input().strip())
# 1640289, 2022-09-24 09:53:24, ----[PP][PPPP] (33%)

def f1(a,b,c):
   if a <= 0:
       return min(b,c)
   if b <= 0:
       return min(a,c)
   if c <= 0:
       return min(a,b)
    
def f2(a,b,c):
    if a >= 0:
        return max(b,c)
    if b >= 0:
        return max(a,c)
    if c >= 0:
        return max(a,b)

def f3(a,b,c):
    x = a+b+c
    x = abs(x)
    x = str(x)
    return x[0]

def f4(a,b,c):
    x = a+b+c
    x = abs(x)
    x = str(x)
    return x[-1]
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')


exec(input().strip())
# 1640306, 2022-09-24 09:53:47, ---P[PP][PPPP] (50%)

def f1(a,b,c):
   if a <= 0:
       return min(b,c)
   if b <= 0:
       return min(a,c)
   if c <= 0:
       return min(a,b)
    
def f2(a,b,c):
    if a >= 0:
        return max(b,c)
    if b >= 0:
        return max(a,c)
    if c >= 0:
        return max(a,b)

def f3(a,b,c):
    x = a+b+c
    x = abs(x)
    x = str(x)
    return x[0]

def f4(a,b,c):
    x = a+b+c
    x = abs(x)%10
    return x
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')


exec(input().strip())
# 1640352, 2022-09-24 09:55:27, ---P[PP][PPPP] (50%)

def f1(a,b,c):
   if a < 0:
       return min(b,c)
   if b < 0:
       return min(a,c)
   if c < 0:
       return min(a,b)
    
def f2(a,b,c):
    if a > 0:
        return max(b,c)
    if b > 0:
        return max(a,c)
    if c > 0:
        return max(a,b)

def f3(a,b,c):
    x = a+b+c
    x = abs(x)
    x = str(x)
    return x[0]

def f4(a,b,c):
    x = a+b+c
    x = abs(x)%10
    return x
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')


exec(input().strip())
# 1640400, 2022-09-24 09:56:53, ---P[PP][PPPP] (50%)

def f1(a,b,c):
    if a < 0:
        return min(b,c)
    if b < 0:
        return min(a,c)
    if c < 0:
        return min(a,b)
    
def f2(a,b,c):
    if a > 0:
        return max(b,c)
    if b > 0:
        return max(a,c)
    if c > 0:
        return max(a,b)

def f3(a,b,c):
    x = a+b+c
    x = abs(x)
    x = str(x)
    return x[0]

def f4(a,b,c):
    x = a+b+c
    x = abs(x)%10
    return x
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')


exec(input().strip())
# 1640420, 2022-09-24 09:57:24, ---P[PP][PPPP] (50%)

def f1(a,b,c):
    if a <= 0:
        return min(b,c)
    if b <= 0:
        return min(a,c)
    if c <= 0:
        return min(a,b)
    
def f2(a,b,c):
    if a >= 0:
        return max(b,c)
    if b >= 0:
        return max(a,c)
    if c >= 0:
        return max(a,b)

def f3(a,b,c):
    x = a+b+c
    x = abs(x)
    x = str(x)
    return x[0]

def f4(a,b,c):
    x = a+b+c
    x = abs(x)%10
    return x
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')


exec(input().strip())
# 1640684, 2022-09-24 10:04:23, compilation error (0%)

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

def f1(a,b,c):
    if -1000 < a,b,c < 1000:
        if a <= 0:
           return min(b,c)
        if b <= 0:
           return min(a,c)
        if c <= 0:
           return min(a,b)
    
def f2(a,b,c):
    if -1000 < a,b,c < 1000:
        if a >= 0:
            return max(b,c)
        if b >= 0:
            return max(a,c)
        if c >= 0:
            return max(a,b)

def f3(a,b,c):
    if -1000 < a,b,c < 1000:
        x = a+b+c
        x = abs(x)
        x = str(x)
        return x[0]

def f4(a,b,c):
    if -1000 < a,b,c < 1000:
        x = a+b+c
        x = abs(x)%10
        return x

exec(input().strip())

# 1640724, 2022-09-24 10:05:34, ---P[PP][PPPP] (50%)

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

def f1(a,b,c):
        if a <= 0:
           return min(b,c)
        if b <= 0:
           return min(a,c)
        if c <= 0:
           return min(a,b)
    
def f2(a,b,c):
        if a >= 0:
            return max(b,c)
        if b >= 0:
            return max(a,c)
        if c >= 0:
            return max(a,b)

def f3(a,b,c):
        x = a+b+c
        x = abs(x)
        x = str(x)
        return x[0]

def f4(a,b,c):
        x = a+b+c
        x = abs(x)%10
        return x

exec(input().strip())

# 1641407, 2022-09-24 10:21:35, ---P[PP][PPPP] (50%)

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

def f1(a,b,c):
    if a < 0:
        return min(b,c)
    if b < 0:
        return min(a,c)
    if c < 0:
        return min(a,b)
    
def f2(a,b,c):
    if a > 0:
        return max(b,c)
    if b > 0:
        return max(a,c)
    if c > 0:
        return max(a,b)

def f3(a,b,c):
    x = a+b+c
    x = abs(x)
    x = str(x)
    return x[0]

def f4(a,b,c):
    x = a+b+c
    x = abs(x)%10
    return x

exec(input().strip())

# 1642119, 2022-09-24 10:34:36, ---P[PP][PPPP] (50%)

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

def f1(a,b,c):
    if a < 0 :
        return int(min(abs(b),abs(c)))
    if b < 0:
        return int(min(abs(a),abs(c)))
    if c < 0:
        return int(min(abs(a),abs(b)))
    
def f2(a,b,c):
    if a > 0:
        return max(b,c)
    if b > 0:
        return max(a,c)
    if c > 0:
        return max(a,b)

def f3(a,b,c):
    x = a+b+c
    x = abs(x)
    x = str(x)
    return x[0]

def f4(a,b,c):
    x = a+b+c
    x = abs(x)%10
    return x

exec(input().strip())
# 1642195, 2022-09-24 10:35:41, ---P[PP][PPPP] (50%)

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')

def f1(a,b,c):
    if a < 0 :
        return min(abs(b),abs(c))
    if b < 0:
        return min(abs(a),abs(c))
    if c < 0:
        return min(abs(a),abs(b))
    
def f2(a,b,c):
    if a > 0:
        return max(b,c)
    if b > 0:
        return max(a,c)
    if c > 0:
        return max(a,b)

def f3(a,b,c):
    x = a+b+c
    x = abs(x)
    x = str(x)
    return x[0]

def f4(a,b,c):
    x = a+b+c
    x = abs(x)%10
    return x

exec(input().strip())

6432032021
# 1639583, 2022-09-24 09:33:55, ----[--][----] (0%)

def f1(a, b, c):
    r = [a,b,c]
    if a <= 0:
        r.remove(a)
    if b <= 0:
        r.remove(b)
    if c <= 0:
        r.remove(c)
    return min(r)

def f2(a, b, c):
    r = [a,b,c]
    if a >= 0:
        r.remove(a)
    if b >= 0:
        r.remove(b)
    if c >= 0:
        r.remove(c)
    return max(r)

# 1639856, 2022-09-24 09:41:07, PPx-[xx][PxPx] (33%)

def f1(a, b, c):
    r = [a,b,c]
    if a <= 0:
        r.remove(a)
    if b <= 0:
        r.remove(b)
    if c <= 0:
        r.remove(c)
    return min(r)

def f2(a, b, c):
    r = [a,b,c]
    if a >= 0:
        r.remove(a)
    if b >= 0:
        r.remove(b)
    if c >= 0:
        r.remove(c)
    return max(r)

def f3(a, b, c):
    num = list(range(0,10,1))
    r = str(sum([a,b,c]))
    if r[0] in num:
        return r[0]
    else:
        return r[1]
    
def f4(a, b, c):
    num = list(range(0,10,1))
    r = str(sum([a,b,c]))
    return r[-1]
def main():
     s1,s2,a,b,c = input().split()
     if int(s1) == 0 and int(s2) == 0:
         print(f1(a, b, c))
     elif int(s1) == 0 and int(s2) == 1:
         print(f1(a, b, c))
     elif int(s1) == 1 and int(s2) == 0:
         print(f1(a, b, c))
     elif int(s1) == 1 and int(s2) == 1:
         print(f1(a, b, c))
     elif s1 != 1 and s1 != 0 and s2 != 1 and s2 != 0:
         print('Error')
     

    
    

exec(input().strip()) 
# 1641985, 2022-09-24 10:32:26, PPx-[P-][----] (33%)

def f1(a, b, c):
    r = [a,b,c]
    if int(a) <= 0:
        r.remove(a)
    if int(b) <= 0:
        r.remove(b)
    if int(c) <= 0:
        r.remove(c)
    return min(r)

def f2(a, b, c):
    r = [a,b,c]
    if int(a) >= 0:
        r.remove(a)
    if int(b) >= 0:
        r.remove(b)
    if int(c) >= 0:
        r.remove(c)
    return max(r)

def f3(a, b, c):
    num = list(range(0,10,1))
    r = str(sum([a,b,c]))
    if r[0] in num:
        return r[0]
    else:
        return r[1]
    
def f4(a, b, c):
    num = list(range(0,10,1))
    r = str(sum([a,b,c]))
    return r[-1]
def main():
     s1,s2,a,b,c = input().split()
     if int(s1) == 0 and int(s2) == 0:
         print(f1(a, b, c))
     elif int(s1) == 0 and int(s2) == 1:
         print(f1(a, b, c))
     elif int(s1) == 1 and int(s2) == 0:
         print(f1(a, b, c))
     elif int(s1) == 1 and int(s2) == 1:
         print(f1(a, b, c))
     elif int(s1) != 1 and int(s1) != 0 and int(s2) != 1 and int(s2) != 0:
         print('Error')
     

    
    

exec(input().strip())

# 1642055, 2022-09-24 10:33:40, PPx-[P-][P-P-] (33%)

def f1(a, b, c):
    r = [a,b,c]
    if int(a) <= 0:
        r.remove(a)
    if int(b) <= 0:
        r.remove(b)
    if int(c) <= 0:
        r.remove(c)
    return min(r)

def f2(a, b, c):
    r = [a,b,c]
    if int(a) >= 0:
        r.remove(a)
    if int(b) >= 0:
        r.remove(b)
    if int(c) >= 0:
        r.remove(c)
    return max(r)

def f3(a, b, c):
    num = list(range(0,10,1))
    r = str(sum([a,b,c]))
    if r[0] in num:
        return r[0]
    else:
        return r[1]
    
def f4(a, b, c):
    num = list(range(0,10,1))
    r = str(sum([a,b,c]))
    return r[-1]
def main():
     s1,s2,a,b,c = input().split()
     if int(s1) == 0 and int(s2) == 0:
         print(f1(a, b, c))
     elif int(s1) == 0 and int(s2) == 1:
         print(f1(a, b, c))
     elif int(s1) == 1 and int(s2) == 0:
         print(f1(a, b, c))
     elif int(s1) == 1 and int(s2) == 1:
         print(f1(a, b, c))
     elif int(s1) != 1 or int(s1) != 0 or int(s2) != 1 or int(s2) != 0:
         print('Error')
     

    
    

exec(input().strip())

# 1642183, 2022-09-24 10:35:32, PPx-[P-][P-PP] (33%)

def f1(a, b, c):
    r = [a,b,c]
    if int(a) <= 0:
        r.remove(a)
    if int(b) <= 0:
        r.remove(b)
    if int(c) <= 0:
        r.remove(c)
    return min(r)

def f2(a, b, c):
    r = [a,b,c]
    if int(a) >= 0:
        r.remove(a)
    if int(b) >= 0:
        r.remove(b)
    if int(c) >= 0:
        r.remove(c)
    return max(r)

def f3(a, b, c):
    num = list(range(0,10,1))
    r = str(sum([a,b,c]))
    if r[0] in num:
        return r[0]
    else:
        return r[1]
    
def f4(a, b, c):
    num = list(range(0,10,1))
    r = str(sum([a,b,c]))
    return r[-1]
def main():
     s1,s2,a,b,c = input().split()
     if int(s1) == 0 and int(s2) == 0:
         print(f1(a, b, c))
     elif int(s1) == 0 and int(s2) == 1:
         print(f2(a, b, c))
     elif int(s1) == 1 and int(s2) == 0:
         print(f3(int(a), int(b), int(c)))
     elif int(s1) == 1 and int(s2) == 1:
         print(f4(int(a), int(b), int(c)))
     elif int(s1) != 1 or int(s1) != 0 or int(s2) != 1 or int(s2) != 0:
         print('Error')
     

    
    

exec(input().strip())

# 1642194, 2022-09-24 10:35:41, PPx-[P-][P-PP] (33%)

def f1(a, b, c):
    r = [a,b,c]
    if int(a) <= 0:
        r.remove(a)
    if int(b) <= 0:
        r.remove(b)
    if int(c) <= 0:
        r.remove(c)
    return min(r)

def f2(a, b, c):
    r = [a,b,c]
    if int(a) >= 0:
        r.remove(a)
    if int(b) >= 0:
        r.remove(b)
    if int(c) >= 0:
        r.remove(c)
    return max(r)

def f3(a, b, c):
    num = list(range(0,10,1))
    r = str(sum([a,b,c]))
    if r[0] in num:
        return r[0]
    else:
        return r[1]
    
def f4(a, b, c):
    num = list(range(0,10,1))
    r = str(sum([a,b,c]))
    return r[-1]
def main():
     s1,s2,a,b,c = input().split()
     if int(s1) == 0 and int(s2) == 0:
         print(f1(a, b, c))
     elif int(s1) == 0 and int(s2) == 1:
         print(f2(a, b, c))
     elif int(s1) == 1 and int(s2) == 0:
         print(f3(int(a), int(b), int(c)))
     elif int(s1) == 1 and int(s2) == 1:
         print(f4(int(a), int(b), int(c)))
     elif int(s1) != 1 or int(s1) != 0 or int(s2) != 1 or int(s2) != 0:
         print('Error')
     

    
    

exec(input().strip())

# 1642462, 2022-09-24 10:39:01, PPxP[P-][P-PP] (50%)

def f1(a, b, c):
    r = [a,b,c]
    if int(a) <= 0:
        r.remove(a)
    if int(b) <= 0:
        r.remove(b)
    if int(c) <= 0:
        r.remove(c)
    return min(r)

def f2(a, b, c):
    r = [a,b,c]
    if int(a) >= 0:
        r.remove(a)
    if int(b) >= 0:
        r.remove(b)
    if int(c) >= 0:
        r.remove(c)
    return max(r)

def f3(a, b, c):
    num = list(range(0,10,1))
    r = str(sum([a,b,c]))
    if r[0] in num:
        return r[0]
    else:
        return int(r[1])
    
def f4(a, b, c):
    num = list(range(0,10,1))
    r = str(sum([a,b,c]))
    return int(r[-1])
def main():
     s1,s2,a,b,c = input().split()
     if int(s1) == 0 and int(s2) == 0:
         print(f1(a, b, c))
     elif int(s1) == 0 and int(s2) == 1:
         print(f2(a, b, c))
     elif int(s1) == 1 and int(s2) == 0:
         print(f3(int(a), int(b), int(c)))
     elif int(s1) == 1 and int(s2) == 1:
         print(f4(int(a), int(b), int(c)))
     elif int(s1) != 1 or int(s1) != 0 or int(s2) != 1 or int(s2) != 0:
         print('Error')
     

    
    

exec(input().strip())


6530126021
# 1639541, 2022-09-24 09:32:52, P---[P-][PPPP] (33%)

def f1(a,b,c):
    x = [a,b,c]
    if a <=0:
        x.remove(a)
    if b <=0:
        x.remove(b)
    if c <=0:
        x.remove(c)
    x.sort()
    return x[0]
def f2(a,b,c):
    x = [a,b,c]
    if a <=0:
        x.remove(a)
    if b <=0:
        x.remove(b)
    if c <=0:
        x.remove(c)
    x.sort()
    return x[-1]
def f3(a,b,c):
    x = a+b+c
    x = str(x)
    if x[0]=='-':
        return x[1]
    else:
        return x[0]
def f4(a,b,c):
    x = a+b+c
    x = str(x)
    return(x[-1])
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2==0:
        print(f1(a,b,c))
    else:
        if s1 == 0 and s2==1:
                print(f2(a,b,c))
        else:
            if s1==1 and s2==0:
                print(f3(a,b,c))
            else:
                if s1==1 and s2==1:
                    print(f4(a,b,c))
                else:
                    print('Error')
                        
exec(input().strip())



# 1639608, 2022-09-24 09:34:38, P---[PP][PPPP] (50%)

def f1(a,b,c):
    x = [a,b,c]
    if a <=0:
        x.remove(a)
    if b <=0:
        x.remove(b)
    if c <=0:
        x.remove(c)
    x.sort()
    return x[0]
def f2(a,b,c):
    x = [a,b,c]
    if a >0:
        x.remove(a)
    if b >0:
        x.remove(b)
    if c >0:
        x.remove(c)
    x.sort()
    return x[-1]
def f3(a,b,c):
    x = a+b+c
    x = str(x)
    if x[0]=='-':
        return x[1]
    else:
        return x[0]
def f4(a,b,c):
    x = a+b+c
    x = str(x)
    return(x[-1])
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2==0:
        print(f1(a,b,c))
    else:
        if s1 == 0 and s2==1:
                print(f2(a,b,c))
        else:
            if s1==1 and s2==0:
                print(f3(a,b,c))
            else:
                if s1==1 and s2==1:
                    print(f4(a,b,c))
                else:
                    print('Error')
                        
exec(input().strip())



# 1639629, 2022-09-24 09:34:59, P---[PP][PPPP] (50%)

def f1(a,b,c):
    x = [a,b,c]
    if a <=0:
        x.remove(a)
    if b <=0:
        x.remove(b)
    if c <=0:
        x.remove(c)
    x.sort()
    return x[0]
def f2(a,b,c):
    x = [a,b,c]
    if a >0:
        x.remove(a)
    if b >0:
        x.remove(b)
    if c >0:
        x.remove(c)
    x.sort()
    return x[-1]
def f3(a,b,c):
    x = a+b+c
    x = str(x)
    if x[0]=='-':
        return x[1]
    else:
        return x[0]
def f4(a,b,c):
    x = a+b+c
    x = str(x)
    return(x[-1])
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2==0:
        print(f1(a,b,c))
    else:
        if s1 == 0 and s2==1:
                print(f2(a,b,c))
        else:
            if s1==1 and s2==0:
                print(f3(a,b,c))
            else:
                if s1==1 and s2==1:
                    print(f4(a,b,c))
                else:
                    print('Error')
                        
exec(input().strip())



# 1639840, 2022-09-24 09:40:47, P---[PP][PPPP] (50%)

def f1(a,b,c):
    x = [a,b,c]
    if a <=0:
        x.remove(a)
    if b <=0:
        x.remove(b)
    if c <=0:
        x.remove(c)
    x.sort()
    return x[0]
def f2(a,b,c):
    x = [a,b,c]
    if a >0:
        x.remove(a)
    if b >0:
        x.remove(b)
    if c >0:
        x.remove(c)
    x.sort()
    return x[-1]
def f3(a,b,c):
    x = a+b+c
    x = str(x)
    if x[0]=='-':
        return x[1]
    else:
        return x[0]
def f4(a,b,c):
    x = a+b+c
    x = str(x)
    return(x[-1])
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2==0:
        print(f1(a,b,c))
    else:
        if s1 == 0 and s2==1:
                print(f2(a,b,c))
        else:
            if s1==1 and s2==0:
                print(f3(a,b,c))
            else:
                if s1==1 and s2==1:
                    print(f4(a,b,c))
                else:
                    print('Error')
                        
exec(input().strip())

# 1640272, 2022-09-24 09:52:44, P---[PP][PPPP] (50%)

def f1(a,b,c):
    x = [a,b,c]
    if a <=0:
        x.remove(a)
    if b <=0:
        x.remove(b)
    if c <=0:
        x.remove(c)
    x.sort()
    return x[0]
def f2(a,b,c):
    x = [a,b,c]
    if a >0:
        x.remove(a)
    if b >0:
        x.remove(b)
    if c >0:
        x.remove(c)
    x.sort()
    return x[-1]
def f3(a,b,c):
    x = a+b+c
    x = str(x)
    if x[0]=='-':
        return x[1]
    else:
        return x[0]
def f4(a,b,c):
    x = a+b+c
    x = str(x)
    return(x[-1])
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2==0:
        print(f1(a,b,c))
    else:
        if s1 == 0 and s2==1:
                print(f2(a,b,c))
        else:
            if s1==1 and s2==0:
                print(f3(a,b,c))
            else:
                if s1==1 and s2==1:
                    print(f4(a,b,c))
                else:
                    print('Error')
                        
exec(input().strip())
# 1642412, 2022-09-24 10:38:22, P---[PP][PPPP] (50%)

def f1(a,b,c):
    x = [a,b,c]
    if a <=0:
        x.remove(a)
    if b <=0:
        x.remove(b)
    if c <=0:
        x.remove(c)
    x.sort()
    return x[0]
def f2(a,b,c):
    x = [a,b,c]
    if a >0:
        x.remove(a)
    if b >0:
        x.remove(b)
    if c >0:
        x.remove(c)
    x.sort()
    return x[-1]
def f3(a,b,c):
    x = a+b+c
    x = str(x)
    if x[0]=='-':
        return x[1]
    else:
        return x[0]
def f4(a,b,c):
    x = a+b+c
    x = str(x)
    return(x[-1])
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2==0:
        print(f1(a,b,c))
    else:
        if s1 == 0 and s2==1:
                print(f2(a,b,c))
        else:
            if s1==1 and s2==0:
                print(f3(a,b,c))
            else:
                if s1==1 and s2==1:
                    print(f4(a,b,c))
                else:
                    print('Error')
                        
exec(input().strip())


6531808621
# 1640587, 2022-09-24 10:01:53, ----[--][----] (0%)

def f1(a, b, c):
    x = []
    s =[]
    s.append(int(a))
    s.append(int(b))
    s.append(int(c))
    for e in s:
        if e > 0:
            x.append(e)
        else:
            continue
    if x[0] >= x[1]:
        return(x[1])
    else:
        return(x[0])    
def f2(a, b, c):
    x = []
    s =[]
    s.append(int(a))
    s.append(int(b))
    s.append(int(c))
    for e in s:
        if e < 0:
            x.append(e)
        else:
            continue
    if x[0] >= x[1]:
        return(x[0])
    else:
        return(x[1])
def f3(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    s = a+b+c
    if s >= 0:
        return(str(s)[0])
    else:
        return(str(s)[1])
def f4(a, b, c):
    s = a+b+c
    if s>=0:
        return(str(s)[-1])
    else:
        return(str(s)[-1])
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 ==0 and s2 == 0:
        return(f1(a, b, c))
    else:
        if s1 ==0 and s2 == 1:
           return(f2(a, b, c))
        else:
            if s1 ==1 and s2 == 0:
                return(f2(a, b, c))
            else:
                if s1 ==1 and s2 == 1:
                    return(f2(a, b, c))
                else:
                    return("Error")
# 1640966, 2022-09-24 10:11:37, xx--[-P][PPPP] (17%)

def f1(a, b, c):
    x = []
    s =[]
    s.append(int(a))
    s.append(int(b))
    s.append(int(c))
    for e in s:
        if e > 0:
            x.append(e)
        else:
            continue
    if x[0] <= x[1] or len(x) == 1:
        return(x[0])
    else:
        return(x[1])    
def f2(a, b, c):
    x = []
    s =[]
    s.append(int(a))
    s.append(int(b))
    s.append(int(c))
    for e in s:
        if e < 0:
            x.append(e)
        else:
            continue
    if x[0] >= x[1] or len(x) == 1:
        return(x[0])
    else:
        return(x[1])
def f3(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    s = a+b+c
    if s >= 0:
        return(str(s)[0])
    else:
        return(str(s)[1])
def f4(a, b, c):
    s = a+b+c
    if s>=0:
        return(str(s)[-1])
    else:
        return(str(s)[-1])
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 ==0 and s2 == 0:
        return(f1(a, b, c))
    else:
        if s1 == 0 and s2 == 1:
           print(f2(a, b, c))
        else:
            if s1 == 1 and s2 == 0:
                print(f3(a, b, c))
            else:
                if s1 ==1 and s2 == 1:
                    print(f4(a, b, c))
                else:
                    print("Error")
                
    
exec(input().strip())
# 1641460, 2022-09-24 10:22:42, ----[--][----] (0%)

def f1(a, b, c):
    x = []
    s =[]
    s.append(int(a))
    s.append(int(b))
    s.append(int(c))
    for e in s:
        if e > 0:
            x.append(e)
        else:
            continue
    if x[0] <= x[1] or len(x) == 1:
        return(int(x[0]))
    else:
        return(int(x[1]))    
def f2(a, b, c):
    x = []
    s =[]
    s.append(int(a))
    s.append(int(b))
    s.append(int(c))
    for e in s:
        if e < 0:
            x.append(e)
        else:
            continue
    if x[0] >= x[1] or len(x) == 1:
        return(int(x[0]))
    else:
        return(int(x[1]))
def f3(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    s = a+b+c
    if s >= 0:
        z = str(s)[0]
        return(int(z))
    else:
        z = str(s)[1]
        return(int(z))
def f4(a, b, c):
    s = a+b+c
    z = str(s)[-1]
    return(int(z))
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 ==0 and s2 == 0:
        return(f1(a, b, c))
    else:
        if s1 == 0 and s2 == 1:
           print(f2(a, b, c))
        else:
            if s1 == 1 and s2 == 0:
                print(f3(a, b, c))
            else:
                if s1 ==1 and s2 == 1:
                    print(f4(a, b, c))
                else:
                    print("Error")
# 1641879, 2022-09-24 10:30:22, xxP-[-P][PPPP] (33%)

def f1(a, b, c):
    x = []
    s =[]
    s.append(int(a))
    s.append(int(b))
    s.append(int(c))
    for e in s:
        if e > 0:
            x.append(e)
        else:
            continue
    if x[0] <= x[1] or len(x) == 1:
        return(int(x[0]))
    else:
        return(int(x[1]))    
def f2(a, b, c):
    x = []
    s =[]
    s.append(int(a))
    s.append(int(b))
    s.append(int(c))
    for e in s:
        if e < 0:
            x.append(e)
        else:
            continue
    if x[0] >= x[1] or len(x) == 1:
        return(int(x[0]))
    else:
        return(int(x[1]))
def f3(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    s = a+b+c
    if s >= 0:
        z = str(s)[0]
        return(int(z))
    else:
        z = str(s)[1]
        return(int(z))
def f4(a, b, c):
    s = a+b+c
    if s>=0:
        z = str(s)[-1]
        return(int(z))
    else:
        z = str(s)[-1]
        return(str(s)[-1])
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 ==0 and s2 == 0:
        return(f1(a, b, c))
    else:
        if s1 == 0 and s2 == 1:
           print(f2(a, b, c))
        else:
            if s1 == 1 and s2 == 0:
                print(f3(a, b, c))
            else:
                if s1 ==1 and s2 == 1:
                    print(f4(a, b, c))
                else:
                    print("Error")
                
    
exec(input().strip()) # DON'T remove this line


# 1642135, 2022-09-24 10:34:50, xxP-[-P][PPPP] (33%)

def f1(a, b, c):
    x = []
    s =[]
    s.append(int(a))
    s.append(int(b))
    s.append(int(c))
    for e in s:
        if e > 0:
            x.append(e)
        else:
            continue
    if x[0] <= x[1] or len(x) == 1:
        return(int(x[0]))
    else:
        return(int(x[1]))    
def f2(a, b, c):
    x = []
    s =[]
    s.append(int(a))
    s.append(int(b))
    s.append(int(c))
    for e in s:
        if e < 0:
            x.append(e)
        else:
            continue
    if x[0] >= x[1] or len(x) == 1:
        return(int(x[0]))
    else:
        return(int(x[1]))
def f3(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    s = a+b+c
    if s >= 0:
        z = str(s)[0]
        return(int(z))
    else:
        z = str(s)[1]
        return(int(z))
def f4(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    s = a+b+c
    if s>=0:
        z = str(s)[-1]
        return(int(z))
    else:
        z = str(s)[-1]
        return(str(s)[-1])
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 ==0 and s2 == 0:
        return(f1(a, b, c))
    else:
        if s1 == 0 and s2 == 1:
           print(f2(a, b, c))
        else:
            if s1 == 1 and s2 == 0:
                print(f3(a, b, c))
            else:
                if s1 ==1 and s2 == 1:
                    print(f4(a, b, c))
                else:
                    print("Error")
                
    
exec(input().strip()) # DON'T remove this line


# 1642378, 2022-09-24 10:38:00, xxP-[PP][PPPP] (50%)

def f1(a, b, c):
    x = []
    s =[]
    s.append(int(a))
    s.append(int(b))
    s.append(int(c))
    for e in s:
        if e > 0:
            x.append(e)
        else:
            continue
    if x[0] <= x[1] or len(x) == 1:
        return(int(x[0]))
    else:
        return(int(x[1]))    
def f2(a, b, c):
    x = []
    s =[]
    s.append(int(a))
    s.append(int(b))
    s.append(int(c))
    for e in s:
        if e < 0:
            x.append(e)
        else:
            continue
    if x[0] >= x[1] or len(x) == 1:
        return(int(x[0]))
    else:
        return(int(x[1]))
def f3(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    s = a+b+c
    if s >= 0:
        z = str(s)[0]
        return(int(z))
    else:
        z = str(s)[1]
        return(int(z))
def f4(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    s = a+b+c
    if s>=0:
        z = str(s)[-1]
        return(int(z))
    else:
        z = str(s)[-1]
        return(str(s)[-1])
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 ==0 and s2 == 0:
        print(f1(a, b, c))
    else:
        if s1 == 0 and s2 == 1:
           print(f2(a, b, c))
        else:
            if s1 == 1 and s2 == 0:
                print(f3(a, b, c))
            else:
                if s1 ==1 and s2 == 1:
                    print(f4(a, b, c))
                else:
                    print("Error")
                
    
exec(input().strip()) # DON'T remove this line



6530022421
# 1639562, 2022-09-24 09:33:28, ----[P-][PPPP] (17%)

def f1(a,b,c):
    p = [a,b,c]
    p.sort()
    k = min(p)
    if k < 0:
        k = p[1]
        if k < 0:
            k = p[2]
    return k

def f2(a,b,c):
    return min(a,b,c)

def f3(a,b,c):
    i = a + b + c
    l = abs(i)
    k = str(l)
    return k[0]

def f4(a,b,c):
    m = a + b + c
    j = abs(m)
    r = str(j)
    return r[-1]

def main():
    s1, s2, a, b, c = input().split()
    s1 = int(s1)
    s2 = int(s2)
    a = int(a)
    b = int(b)
    c = int(c)
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip())
# 1640006, 2022-09-24 09:45:37, P--P[P-][PPPP] (50%)

def f1(a,b,c):
    p = []
    if a > 0:
        p.append(a)
    if b > 0:
        p.append(b)
    if c > 0:
        p.append(c)
    return min(p)

def f2(a,b,c):
    return min(a,b,c)

def f3(a,b,c):
    i = a + b + c
    l = abs(i)
    k = str(l)
    return k[0]

def f4(a,b,c):
    m = a + b + c
    j = abs(m)
    return j%10

def main():
    s1, s2, a, b, c = input().split()
    s1 = int(s1)
    s2 = int(s2)
    a = int(a)
    b = int(b)
    c = int(c)
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip())
# 1640055, 2022-09-24 09:47:02, P--P[P-][PPPP] (50%)

def f1(a,b,c):
    p = []
    if a > 0:
        p.append(a)
    if b > 0:
        p.append(b)
    if c > 0:
        p.append(c)
    return min(p)

def f2(a,b,c):
    return min(a,b,c)

def f3(a,b,c):
    i = a + b + c
    l = abs(i)
    k = str(l)
    return k[0]

def f4(a,b,c):
    return abs(a+b+c)%10

def main():
    s1, s2, a, b, c = input().split()
    s1 = int(s1)
    s2 = int(s2)
    a = int(a)
    b = int(b)
    c = int(c)
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip())
# 1640113, 2022-09-24 09:48:42, P--P[P-][PPPP] (50%)

def f1(a,b,c):
    p = []
    if a > 0:
        p.append(a)
    if b > 0:
        p.append(b)
    if c > 0:
        p.append(c)
    return min(p)

def f2(a,b,c):
    d = []
    if a < 0:
      d.append(a)
    if b < 0:
      d.append(b)
    if c < 0:
      d.append(c)
    return min(d)

def f3(a,b,c):
    i = a + b + c
    l = abs(i)
    k = str(l)
    return k[0]

def f4(a,b,c):
    return abs(a+b+c)%10

def main():
    s1, s2, a, b, c = input().split()
    s1 = int(s1)
    s2 = int(s2)
    a = int(a)
    b = int(b)
    c = int(c)
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip())
# 1642337, 2022-09-24 10:37:29, P--P[P-][PPPP] (50%)

def f1(a,b,c):
    p = []
    if a > 0:
        p.append(a)
    if b > 0:
        p.append(b)
    if c > 0:
        p.append(c)
    return min(p)

def f2(a,b,c):
    return min(a,b,c)

def f3(a,b,c):
    i = a + b + c
    l = abs(i)
    k = str(l)
    return k[0]

def f4(a,b,c):
    return abs(a+b+c)%10

def main():
    s1, s2, a, b, c = input().split()
    s1 = int(s1)
    s2 = int(s2)
    a = int(a)
    b = int(b)
    c = int(c)
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")

exec(input().strip())

6531202221
# 1639232, 2022-09-24 09:25:12, ----[--][----] (0%)

def f1(a, b, c):
    x = [] 
    y = []
    z = []
    for e in a:
        if e > 0:
            x += [e]
    for e in b:
        if e > 0:
            y += [e]
    for e in c:
        if e > 0:
            z += [e]
    a = sorted(x)
    b = sorted(y)
    c = sorted(z)
    return a[0],b[0],c[0]
def f1(a, b, c):
    x = [] 
    y = []
    z = []
    for e in a:
        if e < 0:
            x += [e]
    for e in b:
        if e < 0:
            y += [e]
    for e in c:
        if e < 0:
            z += [e]
    a = sorted(x)
    b = sorted(y)
    c = sorted(z)
    return a[-1],b[-1],c[-1]
# 1639244, 2022-09-24 09:25:35, xxxx[xx][xxxx] (0%)

def f1(a, b, c):
    x = [] 
    y = []
    z = []
    for e in a:
        if e > 0:
            x += [e]
    for e in b:
        if e > 0:
            y += [e]
    for e in c:
        if e > 0:
            z += [e]
    a = sorted(x)
    b = sorted(y)
    c = sorted(z)
    return a[0],b[0],c[0]
def f1(a, b, c):
    x = [] 
    y = []
    z = []
    for e in a:
        if e < 0:
            x += [e]
    for e in b:
        if e < 0:
            y += [e]
    for e in c:
        if e < 0:
            z += [e]
    a = sorted(x)
    b = sorted(y)
    c = sorted(z)
    return a[-1],b[-1],c[-1]
exec(input().strip()) # DON'T remove this line
# 1640623, 2022-09-24 10:02:44, PP--[PP][----] (50%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for e in x:
        if e > 0:
            y += [e]
    y = sorted(y)
    return y[0]
def f2(a, b, c):
    x = [a,b,c]
    y = []
    for e in x:
        if e < 0:
            y += [e]
    y = sorted(y)
    return y[-1]
def f3(a, b, c):
    x = [a,b,c]
    y = 0
    for e in x:
        y += e
    if y < 0:
        y *= -1
    y = str(y)
    return y[0]
def f4(a, b, c):
    x = 0
    x = [a,b,c]
    y = 0
    for e in x:
        y += e
    if y < 0:
        y *= -1
    y = str(y)
    return y[-1]
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f2(a, b, c))
    elif s1 != 0 and s1 != 1 and s2 != 0 and s2 == 1:
        print('Error')
exec(input().strip()) # DON'T remove this line

# 1640713, 2022-09-24 10:05:15, PP--[PP][-P-P] (50%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for e in x:
        if e > 0:
            y += [e]
    y = sorted(y)
    return y[0]
def f2(a, b, c):
    x = [a,b,c]
    y = []
    for e in x:
        if e < 0:
            y += [e]
    y = sorted(y)
    return y[-1]
def f3(a, b, c):
    x = [a,b,c]
    y = 0
    for e in x:
        y += e
    if y < 0:
        y *= -1
    y = str(y)
    return y[0]
def f4(a, b, c):
    x = 0
    x = [a,b,c]
    y = 0
    for e in x:
        y += e
    if y < 0:
        y *= -1
    y = str(y)
    return y[-1]
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    elif s1 != 0 and s1 != 1 and s2 != 0 and s2 == 1:
        print('Error')
exec(input().strip()) # DON'T remove this line

# 1640873, 2022-09-24 10:09:02, PP--[PP][-P-P] (50%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for e in x:
        if e > 0:
            y += [e]
    y = sorted(y)
    return y[0]
def f2(a, b, c):
    x = [a,b,c]
    y = []
    for e in x:
        if e < 0:
            y += [e]
    y = sorted(y)
    return y[-1]
def f3(a, b, c):
    x = [a,b,c]
    y = 0
    for e in x:
        y += e
    if y < 0:
        y *= -1
    y = str(y)
    return y[0]
def f4(a, b, c):
    x = 0
    x = [a,b,c]
    y = 0
    for e in x:
        y += e
    if y < 0:
        y *= -1
    y = str(y)
    return y[-1]
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    elif s1 != 0 and s1 != 1 and s2 != 0 and s2 == 1:
        print('Error')
exec(input().strip()) # DON'T remove this line


6430115021
# 1640892, 2022-09-24 10:09:37, --PP[-P][P-P-] (33%)

def f1(a, b, c):
    F1 = []
    if a > 0 :
        F1.append(a)
    if b > 0 :
        F1.append(b)
    if c > 0 :
        F1.append(c)
    F1.sort
    return F1[0]

def f2(a, b, c):
    F2 = []
    if a < 0 :
        F2.append(a)
    if b < 0 :
        F2.append(b)
    if c < 0 :
        F2.append(c)
    F2.sort
    return F2[-1]

def f3(a, b, c):
    x = a+b+c
    X = x*x
    x = X**0.5
    while x >= 10 :
        x = x/10
    return int(x)
    
def f4(a, b, c):
    y = a+b+c
    Y = y*y
    y = Y**0.5
    return int(y%10)

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == s2 == 0 :
        return print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        return print(f2(a, b, c))
    elif s1 == s2 == 1 :
        return print(f3(a, b, c))
    else :
        return print('Error')


exec(input().strip()) # DON'T remove this line
# 1641082, 2022-09-24 10:14:59, --PP[-P][PPPP] (50%)

def f1(a, b, c):
    F1 = []
    if a > 0 :
        F1.append(a)
    if b > 0 :
        F1.append(b)
    if c > 0 :
        F1.append(c)
    F1.sort
    return F1[0]

def f2(a, b, c):
    F2 = []
    if a < 0 :
        F2.append(a)
    if b < 0 :
        F2.append(b)
    if c < 0 :
        F2.append(c)
    F2.sort
    return F2[-1]

def f3(a, b, c):
    x = a+b+c
    X = x*x
    x = X**0.5
    while x >= 10 :
        x = x/10
    return int(x)
    
def f4(a, b, c):
    y = a+b+c
    Y = y*y
    y = Y**0.5
    return int(y%10)

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == s2 == 0 :
        return print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        return print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        return print(f3(a, b, c))
    elif s1 == s2 == 1 :
        return print(f4(a, b, c))
    else :
        return print('Error')
exec(input().strip())
# 1641093, 2022-09-24 10:15:12, --PP[-P][PPPP] (50%)

def f1(a, b, c):
    F1 = []
    if a > 0 :
        F1.append(a)
    if b > 0 :
        F1.append(b)
    if c > 0 :
        F1.append(c)
    F1.sort
    return F1[0]

def f2(a, b, c):
    F2 = []
    if a < 0 :
        F2.append(a)
    if b < 0 :
        F2.append(b)
    if c < 0 :
        F2.append(c)
    F2.sort
    return F2[-1]

def f3(a, b, c):
    x = a+b+c
    X = x*x
    x = X**0.5
    while x >= 10 :
        x = x/10
    return int(x)
    
def f4(a, b, c):
    y = a+b+c
    Y = y*y
    y = Y**0.5
    return int(y%10)

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == s2 == 0 :
        return print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        return print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        return print(f3(a, b, c))
    elif s1 == s2 == 1 :
        return print(f4(a, b, c))
    else :
        return print('Error')

exec(input().strip())
# 1641330, 2022-09-24 10:20:02, --PP[-P][PPPP] (50%)

def f1(a, b, c):
    F1 = []
    if a > 0 :
        F1.append(a)
    if b > 0 :
        F1.append(b)
    if c > 0 :
        F1.append(c)
    F1.sort
    return F1[0]

def f2(a, b, c):
    F2 = []
    if a < 0 :
        F2.append(a)
    if b < 0 :
        F2.append(b)
    if c < 0 :
        F2.append(c)
    F2.sort
    return F2[-1]

def f3(a, b, c):
    x = a+b+c
    X = x*x
    x = X**0.5
    while x >= 10 :
        x = x/10
    return int(x)
    
def f4(a, b, c):
    y = a+b+c
    Y = y*y
    y = Y**0.5
    return int(y%10)

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == s2 == 0 :
        return print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        return print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        return print(f3(a, b, c))
    elif s1 == s2 == 1 :
        return print(f4(a, b, c))
    else :
        return print('Error')

exec(input().strip())

6531513421
# 1640553, 2022-09-24 10:00:48, -Pxx[xx][xxxx] (17%)

def f1(a,b,c) :
    x = [a,b,c]
    x.sort()
    if x[0]<0 :
        if x[1]<0 :
            if x[2]<0 :
                pass
            else :
                return x[2]
        else :
            return x[1]
    else :
        pass
        
def f2(a,b,c) :
    x = [a,b,c]
    x.sort()
    if x[2]>=0 :
        if x[1]>=0 :
            if x[0]>=0 :
                pass
            else :
                return x[0]
        else :
            return x[1]
    else :
        pass
      
exec(input().strip())
# 1641663, 2022-09-24 10:26:29, -P--[xx][xxxx] (17%)

def f1(a,b,c) :
    x = [a,b,c]
    x.sort()
    if x[0]<0 :
        if x[1]<0 :
            if x[2]<0 :
                pass
            else :
                return x[2]
        else :
            return x[1]
    else :
        pass
        
def f2(a,b,c) :
    x = [a,b,c]
    x.sort()
    if x[2]>=0 :
        if x[1]>=0 :
            if x[0]>=0 :
                pass
            else :
                return x[0]
        else :
            return x[1]
    else :
        pass
        
def f3(a,b,c) :
    x = [a,b,c]
    x.sort()
    if x[0]<0 :
        if x[1]<0 :
            if x[2]<0 :
                pass
            else :
                a = int(x[0])
                b = int(x[1])
                c = int(x[2]) 
                sum_abc = a+b+c
        else :
            a = int(x[0])
            b = int(x[1])
            c = int(x[2]) 
            sum_abc = a+b+c
    else :
        pass
    p = str(sum_abc)
    if sum_abc < 0 :
        return p[1]
    else :
        return p[0]
    
def f4(a,b,c) :
    x = [a,b,c]
    x.sort()
    if x[0]<0 :
        if x[1]<0 :
            if x[2]<0 :
                pass
            else :
                a = int(x[0])
                b = int(x[1])
                c = int(x[2]) 
                sum_abc = a+b+c
        else :
            a = int(x[0])
            b = int(x[1])
            c = int(x[2]) 
            sum_abc = a+b+c
    else :
        pass
    p = str(sum_abc)
    n = len(p)
    return p[n-1]
    
      
exec(input().strip())
# 1641948, 2022-09-24 10:31:34, -P--[PP][PPPP] (50%)

def f1(a,b,c) :
    x = [a,b,c]
    x.sort()
    if x[0]<0 :
        if x[1]<0 :
            if x[2]<0 :
                pass
            else :
                return x[2]
        else :
            return x[1]
    else :
        pass
        
def f2(a,b,c) :
    x = [a,b,c]
    x.sort()
    if x[2]>=0 :
        if x[1]>=0 :
            if x[0]>=0 :
                pass
            else :
                return x[0]
        else :
            return x[1]
    else :
        pass
        
def f3(a,b,c) :
    x = [a,b,c]
    x.sort()
    if x[0]<0 :
        if x[1]<0 :
            if x[2]<0 :
                pass
            else :
                a = int(x[0])
                b = int(x[1])
                c = int(x[2]) 
                sum_abc = a+b+c
        else :
            a = int(x[0])
            b = int(x[1])
            c = int(x[2]) 
            sum_abc = a+b+c
    else :
        pass
    p = str(sum_abc)
    if sum_abc < 0 :
        return p[1]
    else :
        return p[0]
    
def f4(a,b,c) :
    x = [a,b,c]
    x.sort()
    if x[0]<0 :
        if x[1]<0 :
            if x[2]<0 :
                pass
            else :
                a = int(x[0])
                b = int(x[1])
                c = int(x[2]) 
                sum_abc = a+b+c
        else :
            a = int(x[0])
            b = int(x[1])
            c = int(x[2]) 
            sum_abc = a+b+c
    else :
        pass
    p = str(sum_abc)
    n = len(p)
    return p[n-1]
    
def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    x = [a,b,c]
    x.sort()
    if x[0] <0 :
        if x[1]<0 :
            if x[2]<0 :
                pass
    else :
        pass
    if s1 == 0 :
        if s2 == 0 :
            print(f1(a,b,c))
        elif s2 == 1 :
            print(f2(a,b,c))
        else :
            print("Error")
    elif s1 == 1 :
        if s2 == 0 :
            print(f3(a,b,c))
        elif s2 == 1 :
            print(f4(a,b,c))
        else :
            print('Error')
    else :
        print('Error')
    
exec(input().strip())
# 1642434, 2022-09-24 10:38:40, -P--[PP][PPPP] (50%)

def f1(a,b,c) :
    x = [a,b,c]
    x.sort()
    if x[0]<0 :
        if x[1]<0 :
            if x[2]<0 :
                pass
            else :
                return x[2]
        else :
            return x[1]
    else :
        pass
        
def f2(a,b,c) :
    x = [a,b,c]
    x.sort()
    if x[2]>=0 :
        if x[1]>=0 :
            if x[0]>=0 :
                pass
            else :
                return x[0]
        else :
            return x[1]
    else :
        pass
        
def f3(a,b,c) :
    x = [a,b,c]
    x.sort()
    if x[0]<0 :
        if x[1]<0 :
            if x[2]<0 :
                pass
            else :
                a = int(x[0])
                b = int(x[1])
                c = int(x[2]) 
                sum_abc = a+b+c
        else :
            a = int(x[0])
            b = int(x[1])
            c = int(x[2]) 
            sum_abc = a+b+c
    else :
        pass
    p = str(sum_abc)
    if sum_abc < 0 :
        return p[1]
    else :
        return p[0]
    
def f4(a,b,c) :
    x = [a,b,c]
    x.sort()
    if x[0]<0 :
        if x[1]<0 :
            if x[2]<0 :
                pass
            else :
                a = int(x[0])
                b = int(x[1])
                c = int(x[2]) 
                sum_abc = a+b+c
        else :
            a = int(x[0])
            b = int(x[1])
            c = int(x[2]) 
            sum_abc = a+b+c
    else :
        pass
    p = str(sum_abc)
    n = len(p)
    return p[n-1]
    
def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    x = [a,b,c]
    x.sort()
    if x[0] <0 :
        if x[1]<0 :
            if x[2]<0 :
                pass
    else :
        pass
    if s1 == 0 :
        if s2 == 0 :
            print(f1(a,b,c))
        elif s2 == 1 :
            print(f2(a,b,c))
        else :
            print("Error")
    elif s1 == 1 :
        if s2 == 0 :
            print(f3(a,b,c))
        elif s2 == 1 :
            print(f4(a,b,c))
        else :
            print('Error')
    else :
        print('Error')
    
exec(input().strip())

6530084321
# 1639472, 2022-09-24 09:31:16, PP-P[--][P-P-] (50%)

def f1(a, b, c):
    x = []
    for e in (a,b,c) :
        if e > 0 :
            x.append(e)
    return(min(x))
            
def f2(a, b, c):
    x = []
    for e in (a,b,c) :
        if e < 0 :
            x.append(e)
    return(max(x))

def f3(a, b, c):
    s = a+b+c
    s = abs(s)
    if s >= 1000 :
        s //= 1000
    if 100 <= s < 1000 :
        s //= 100
    if 10 <= s < 100 :
        s //= 10
    if 0 <= s < 10 :
        s //= 1
    return(s)

def f4(a, b, c):
    s = a+b+c
    s = abs(s)
    s %= 10
    return(s)
        
def main():
    x = input().split()
    for i in range(len(x)) :
        x[i] = int(x[i])
    if (x[0] == 0) and(x[1] == 0) :
        print(f1(x[2],x[3],x[4]))
    if (x[0] == 0) and(x[1] == 1) :
        print(f2(x[2],x[3],x[4]))
    if (x[0] == 1) and(x[1] == 0) :
        print(f3(x[2],x[3],x[4]))
    if (x[0] == 1) and(x[1] == 1) :
        print(f4(x[2],x[3],x[4]))
    else :
        print("Error")
    
exec(input().strip()) # DON'T remove this line

# 1639853, 2022-09-24 09:41:04, PP-P[--][P-P-] (50%)

def f1(a, b, c):
    x = []
    for e in (a,b,c) :
        if e > 0 :
            x.append(e)
    return(min(x))
            
def f2(a, b, c):
    x = []
    for e in (a,b,c) :
        if e < 0 :
            x.append(e)
    return(max(x))

def f3(a, b, c):
    s = a+b+c
    s = abs(s)
    if s >= 1000 :
        s //= 1000
    if 100 <= s < 1000 :
        s //= 100
    if 10 <= s < 100 :
        s //= 10
    if 0 <= s < 10 :
        s //= 1
    return(s)

def f4(a, b, c):
    s = a+b+c
    s = abs(s)
    s %= 10
    return(s)
        
def main():
    x = input().split()
    for i in range(len(x)) :
        if not (("A" <= x[i] <= "Z") or ("a" <= x[i] <= "z")) :
            x[i] = int(x[i])
    
    if (x[0] == 0) and(x[1] == 0) :
        print(f1(x[2],x[3],x[4]))
    if (x[0] == 0) and(x[1] == 1) :
        print(f2(x[2],x[3],x[4]))
    if (x[0] == 1) and(x[1] == 0) :
        print(f3(x[2],x[3],x[4]))
    if (x[0] == 1) and(x[1] == 1) :
        print(f4(x[2],x[3],x[4]))
    else :
        print("Error")
    
exec(input().strip()) # DON'T remove this line

# 1640620, 2022-09-24 10:02:41, PP--[--][P-P-] (33%)

def f1(a, b, c):
    x = []
    for e in (a,b,c) :
        if e > 0 :
            x.append(e)
    return(min(x))

def f2(a, b, c):
    x = []
    for e in (a,b,c) :
        if e < 0 :
            x.append(e)
    return(max(x))
    
def f3(a, b, c):
    s = a+b+c
    if s//1000 == 0 :
        if s//100 == 0 :
            if s//10 == 0 :
                s %= 10
            else :
                s //= 10
        else :
            s //= 100
    else :
        s //= 1000
    return(s)
    
def f4(a, b, c):
    s = a+b+c
    s %= 10
    
def main():
    x = input().split()
    for i in range(len(x)) :
        if not (("A" <= x[i] <= "Z") or ("a" <= x[i] <= "z")) :
            x[i] = int(x[i])
    
    if (x[0] == 0) and(x[1] == 0) :
        print(f1(x[2],x[3],x[4]))
    if (x[0] == 0) and(x[1] == 1) :
        print(f2(x[2],x[3],x[4]))
    if (x[0] == 1) and(x[1] == 0) :
        print(f3(x[2],x[3],x[4]))
    if (x[0] == 1) and(x[1] == 1) :
        print(f4(x[2],x[3],x[4]))
    else :
        print("Error")
exec(input().strip()) # DON'T remove this line

# 1640644, 2022-09-24 10:03:23, PP-P[--][P-P-] (50%)

def f1(a, b, c):
    x = []
    for e in (a,b,c) :
        if e > 0 :
            x.append(e)
    return(min(x))
            
def f2(a, b, c):
    x = []
    for e in (a,b,c) :
        if e < 0 :
            x.append(e)
    return(max(x))

def f3(a, b, c):
    s = a+b+c
    s = abs(s)
    if s >= 1000 :
        s //= 1000
    if 100 <= s < 1000 :
        s //= 100
    if 10 <= s < 100 :
        s //= 10
    if 0 <= s < 10 :
        s //= 1
    return(s)

def f4(a, b, c):
    s = a+b+c
    s = abs(s)
    s %= 10
    return(s)
        
def main():
    x = input().split()
    for i in range(len(x)) :
        if not (("A" <= x[i] <= "Z") or ("a" <= x[i] <= "z")) :
            x[i] = int(x[i])
    
    if (x[0] == 0) and(x[1] == 0) :
        print(f1(x[2],x[3],x[4]))
    if (x[0] == 0) and(x[1] == 1) :
        print(f2(x[2],x[3],x[4]))
    if (x[0] == 1) and(x[1] == 0) :
        print(f3(x[2],x[3],x[4]))
    if (x[0] == 1) and(x[1] == 1) :
        print(f4(x[2],x[3],x[4]))
    else :
        print("Error")
    
exec(input().strip()) # DON'T remove this line

6530096921
# 1640181, 2022-09-24 09:50:27, PP--[xx][-x-x] (33%)

def f1(a, b, c):
    x=[]
    for e in (a,b,c):
        if e>0:
            x+=[e]
    f_1=min(x)
    return f_1

def f2(a, b, c):
    x=[]
    for e in (a,b,c):
        if e<0:
            x+=[e]
    f_2=max(x)
    return f_2

def f3(a, b, c):
    x=str(abs(sum([a,b,c])))
    f_3=x[0]
    return f_3

def f4(a, b, c):
    x=str(abs(sum([a,b,c])))
    f_4=x[-1]
    return f_4
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0:
        if s2==0:
            print(f_1(a,b,c))
        elif s2==1:
            print(f_2(a,b,c))
        else:
            print("error")
    elif s1==1:
            if s2==0:
                print(f_3(a,b,c))
            elif s2==1:
                print(f_4(a,b,c))
            else:
                print("error")
    else:
        print("error")
        
    
exec(input().strip()) # DON'T remove this line

# 1641837, 2022-09-24 10:29:47, ----[x-][----] (0%)

def f1(a, b, c):
    x=[]
    for e in (a,b,c):
        if e>0:
            x+=[e]
    f_1=min(x)
    return f1

def f2(a, b, c):
    x=[]
    for e in (a,b,c):
        if e<0:
            x+=[e]
    f_2=max(x)
    return f2

def f3(a, b, c):
    x=str(abs(sum([a,b,c])))
    f_3=x[0]
    return f3

def f4(a, b, c):
    x=str(abs(sum([a,b,c])))
    f_4=x[-1]
    return f4
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0:
        if s2==0:
            print(f11(a,b,c))
        elif s2==1:
            print(f2(a,b,c))
        else:
            print("error")
    elif s1==1:
            if s2==0:
                print(f3(a,b,c))
            elif s2==1:
                print(f4(a,b,c))
            else:
                print("error")
    else:
        print("error")
        
    
exec(input().strip()) # DON'T remove this line
# 1641895, 2022-09-24 10:30:37, ----[--][----] (0%)

def f1(a, b, c):
    x=[]
    for e in (a,b,c):
        if e>0:
            x+=[e]
    f_1=min(x)
    return f1

def f2(a, b, c):
    x=[]
    for e in (a,b,c):
        if e<0:
            x+=[e]
    f_2=max(x)
    return f2

def f3(a, b, c):
    x=str(abs(sum([a,b,c])))
    f_3=x[0]
    return f3

def f4(a, b, c):
    x=str(abs(sum([a,b,c])))
    f_4=x[-1]
    return f4
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0:
        if s2==0:
            print(f1(a,b,c))
        elif s2==1:
            print(f2(a,b,c))
        else:
            print("error")
    elif s1==1:
            if s2==0:
                print(f3(a,b,c))
            elif s2==1:
                print(f4(a,b,c))
            else:
                print("error")
    else:
        print("error")
        
    
exec(input().strip()) # DON'T remove this line
# 1642092, 2022-09-24 10:34:16, PP--[PP][-P-P] (50%)

def f1(a, b, c):
    x=[]
    for e in (a,b,c):
        if e>0:
            x+=[e]
    return min(x)

def f2(a, b, c):
    x=[]
    for e in (a,b,c):
        if e<0:
            x+=[e]
    return max(x)

def f3(a, b, c):
    x=str(abs(sum([a,b,c])))
    return x[0]

def f4(a, b, c):
    x=str(abs(sum([a,b,c])))
    return x[-1]
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0:
        if s2==0:
            print(f1(a,b,c))
        elif s2==1:
            print(f2(a,b,c))
        else:
            print("error")
    elif s1==1:
            if s2==0:
                print(f3(a,b,c))
            elif s2==1:
                print(f4(a,b,c))
            else:
                print("error")
    else:
        print("error")
        
    
        
    
exec(input().strip()) # DON'T remove this line

6530208921
# 1641313, 2022-09-24 10:19:44, PPx-[--][P-P-] (33%)

def f1(a,b,c):
    n = []
    f = (a,b,c)
    for e in f:
        if e > 0:
            n.append(e)
    n.sort()
    return n[0]
def f2(a,b,c):
    n = []
    f = (a,b,c)
    for e in f:
        if e < 0:
            n.append(e)
    n.sort()
    return n[-1]
def f3(a,b,c):
    n = a + b + c
    if n < 0:
        n = str(n)
    return n[1]
    if n > 0:
        n = str(n)
    return n[0]
def f4(a,b,c):
    n = a + b + c
    n = str(n)
    return n[-1]
def main():
    n = input().split()
    s1 = n[0]
    s2 = n[1]
    a = n[2]
    b = n[3]
    c = n[4]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())
        


# 1641963, 2022-09-24 10:31:56, PPx-[PP][PxPP] (50%)

def f1(a,b,c):
    n = []
    f = (a,b,c)
    for e in f:
        if e > 0:
            n.append(e)
    n.sort()
    return n[0]
def f2(a,b,c):
    n = []
    f = (a,b,c)
    for e in f:
        if e < 0:
            n.append(e)
    n.sort()
    return n[-1]
def f3(a,b,c):
    n = a + b + c
    if n < 0:
        n = str(n)
    return n[1]
    if n > 0:
        n = str(n)
    return n[0]
def f4(a,b,c):
    n = a + b + c
    n = str(n)
    return n[-1]
def main():
    T = input().split()
    n =[]
    for e in T:
        n.append(int(e))
    s1 = n[0]
    s2 = n[1]
    a = n[2]
    b = n[3]
    c = n[4]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())
        


# 1642099, 2022-09-24 10:34:20, PPx-[xx][xxxx] (33%)

def f1(a,b,c):
    n = []
    f = (a,b,c)
    for e in f:
        if e > 0:
            n.append(e)
    n.sort()
    return n[0]
def f2(a,b,c):
    n = []
    f = (a,b,c)
    for e in f:
        if e < 0:
            n.append(e)
    n.sort()
    return n[-1]
def f3(a,b,c):
    n = a + b + c
    if n < 0:
        n = str(n)
    return n[1]
    if n > 0:
        n = str(n)
    return n[0]
def f4(a,b,c):
    n = a + b + c
    n = str(n)
    return n[-1]
def main():
    T = input().split()
    n =[s1,s2]
    for i in range(2,len(T)):
        n.append(int(T[i]))
    a = n[2]
    b = n[3]
    c = n[4]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())
        


# 1642196, 2022-09-24 10:35:43, PPx-[PP][PxPP] (50%)

def f1(a,b,c):
    n = []
    f = (a,b,c)
    for e in f:
        if e > 0:
            n.append(e)
    n.sort()
    return n[0]
def f2(a,b,c):
    n = []
    f = (a,b,c)
    for e in f:
        if e < 0:
            n.append(e)
    n.sort()
    return n[-1]
def f3(a,b,c):
    n = a + b + c
    if n < 0:
        n = str(n)
    return n[1]
    if n > 0:
        n = str(n)
    return n[0]
def f4(a,b,c):
    n = a + b + c
    n = str(n)
    return n[-1]
def main():
    T = input().split()
    n =[]
    for e in T:
        n.append(int(e))
    s1 = n[0]
    s2 = n[1]
    a = n[2]
    b = n[3]
    c = n[4]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip())
        



6531501921
# 1639872, 2022-09-24 09:41:37, P---[--][P-P-] (17%)

def f1(a, b, c):
    e = [a, b, c]
    while min(e) <= 0 :
        e.remove(min(e))
    return min(e)  
    
def f2(a, b, c):
    e = [a, b, c]
    while max(e) > 0 :
        e.remove(max(e))
    return max(e)

def f3(a, b, c):
    e = a + b + c
    p = abs(e)
    k = str(p)
    return (k[0])

def f4(a, b, c):
    e = a + b + c
    p = abs(e)
    k = str(p)
    return (k[-1])

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else  :
        print("Error")

exec(input().strip()) # DON'T remove this line
# 1639946, 2022-09-24 09:43:49, P-PP[--][P-P-] (50%)

def f1(a, b, c):
    e = [a, b, c]
    while min(e) <= 0 :
        e.remove(min(e))
    return min(e)  
    
def f2(a, b, c):
    e = [a, b, c]
    while max(e) > 0 :
        e.remove(max(e))
    return max(e)

def f3(a, b, c):
    e = a + b + c
    p = abs(e)
    k = str(p)
    o = int(k[0])
    return (o)

def f4(a, b, c):
    e = a + b + c
    p = abs(e)
    k = str(p)
    o = int(k[-1])
    return (o)

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else  :
        print("Error")

exec(input().strip()) # DON'T remove this line
# 1640000, 2022-09-24 09:45:23, P-PP[--][P-P-] (50%)

def f1(a, b, c):
    e = [a, b, c]
    while min(e) <= 0 :
        e.remove(min(e))
    f = int(min(e))
    return f 
    
def f2(a, b, c):
    e = [a, b, c]
    while max(e) > 0 :
        e.remove(max(e))
    f = int(max(e))
    return f

def f3(a, b, c):
    e = a + b + c
    p = abs(e)
    k = str(p)
    o = int(k[0])
    return (o)

def f4(a, b, c):
    e = a + b + c
    p = abs(e)
    k = str(p)
    o = int(k[-1])
    return (o)

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else  :
        print("Error")

exec(input().strip()) # DON'T remove this line
# 1640137, 2022-09-24 09:49:19, P-PP[--][P-P-] (50%)

def f1(a, b, c):
    e = [a, b, c]
    while min(e) <= 0 :
        e.remove(min(e))
    f = int(min(e))
    return f 
    
def f2(a, b, c):
    e = [a, b, c]
    while max(e) > 0 :
        e.remove(max(e))
    f = int(max(e))
    return f

def f3(a, b, c):
    e = a + b + c
    p = abs(e)
    k = str(p)
    o = int(k[0])
    return o

def f4(a, b, c):
    e = a + b + c
    p = abs(e)
    k = str(p)
    o = int(k[-1])
    return o

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else  :
        print("Error")

exec(input().strip()) # DON'T remove this line

6432036521
# 1639780, 2022-09-24 09:39:10, xxxx[--][----] (0%)

def f1(a, b, c):
    -1000 <= a,b,c <= 1000
    int(a,b,c)
    x = []
    if a > 0 :
        x.append(a)
    elif b > 0 :
        x.append(b)
    elif c > 0 :
        x.append(c)
    x.sort()
    return x[0]
        
def f2(a, b, c):
    -1000 <= a,b,c <= 1000
    int(a,b,c)
    x = []
    if a < 0 :
        x.append(a)
    elif b < 0 :
        x.append(b)
    elif c < 0 :
        x.append(c)
    x.sort()
    return x[-1]

def f3(a, b, c):
    -1000 <= a,b,c <= 1000
    int(a,b,c)
    x = a+b+c
    return x[0]
    
def f4(a, b, c):
    -1000 <= a,b,c <= 1000
    int(a,b,c)
    x = a+b+c
    return x[-1]
def main():
    pass
exec(input().strip()) # DON'T remove this line
# 1640304, 2022-09-24 09:53:41, --xx[--][PxPx] (0%)

def f1(a, b, c):
    -1000 <= a,b,c <= 1000
    a > 0 or b > 0 or c>0
    a < 0 or b < 0 or c<0
    x = []
    if a > 0 :
        x.append(a)
    elif b > 0 :
        x.append(b)
    elif c > 0 :
        x.append(c)
    x.sort()
    return x[0]
        
def f2(a, b, c):
    -1000 <= a,b,c <= 1000
    a > 0 or b > 0 or c>0
    a < 0 or b < 0 or c<0
    x = []
    if a < 0 :
        x.append(a)
    elif b < 0 :
        x.append(b)
    elif c < 0 :
        x.append(c)
    x.sort()
    return x[-1]

def f3(a, b, c):
    -1000 <= a,b,c <= 1000
    a > 0 or b > 0 or c>0
    a < 0 or b < 0 or c<0
    x = a+b+c
    return x[0]
    
def f4(a, b, c):
    -1000 <= a,b,c <= 1000
    a > 0 or b > 0 or c>0
    a < 0 or b < 0 or c<0
    x = a+b+c
    return x[-1]
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 ==0 :
        print (f1(a, b, c))
    elif s1 == 0 and s2 ==1 :
        print (f2(a, b, c))
    elif s1 == 1 and s2 ==0 :
        print (f3(a, b, c))
    elif s1 == 1 and s2 ==1 :
        print (f2(a, b, c))
    else :
        print ("Error")
exec(input().strip()) # DON'T remove this line
# 1640722, 2022-09-24 10:05:30, PP-x[PP][P-P-] (50%)

def f1(a, b, c):
    -1000 <= a,b,c <= 1000
    a > 0 or b > 0 or c>0
    a < 0 or b < 0 or c<0
    x = []
    if a > 0 :
        x.append(a)
    if b > 0 :
        x.append(b)
    if c > 0 :
        x.append(c)
    x.sort()
    return x[0]
        
def f2(a, b, c):
    -1000 <= a,b,c <= 1000
    a > 0 or b > 0 or c>0
    a < 0 or b < 0 or c<0
    x = []
    if a < 0 :
        x.append(a)
    if b < 0 :
        x.append(b)
    if c < 0 :
        x.append(c)
    x.sort()
    return x[-1]

def f3(a, b, c):
    -1000 <= a,b,c <= 1000
    a > 0 or b > 0 or c>0
    a < 0 or b < 0 or c<0
    y = []
    x = a+b+c
    y.append(x)
    return y[0]
    
def f4(a, b, c):
    -1000 <= a,b,c <= 1000
    a > 0 or b > 0 or c>0
    a < 0 or b < 0 or c<0
    x = a+b+c
    return x[-1]
def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 ==0 :
        print (f1(a, b, c))
    elif s1 == 0 and s2 ==1 :
        print (f2(a, b, c))
    elif s1 == 1 and s2 ==0 :
        print (f3(a, b, c))
    elif s1 == 1 and s2 ==1 :
        print (f2(a, b, c))
    else :
        print ("Error")
        
exec(input().strip()) # DON'T remove this line

6530058021
# 1639457, 2022-09-24 09:30:50, PP--[--][PPPP] (50%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for i in range(len(x)):
        if x[i]>0:
            y.append(x[i])
    return min(y)

def f2(a, b, c):
    x = [a,b,c]
    y = []
    for i in range(len(x)):
        if x[i]<0:
            y.append(x[i])
    return max(y)
def f3(a, b, c):
    x = [a,b,c]
    z = sum(x)
    y = abs(z)
    y = str(y)
    return y[0]
def f4(a, b, c):
    x = [a,b,c]
    z = sum(x)
    y = abs(z)
    y = str(y)
    return y[-1]
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 ==0 and s2 == 1:
        print(f1(a, b, c))
    elif s1 ==0 and s2 == 0:
        print(f2(a, b, c))
    elif s1 ==1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 ==1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')

exec(input().strip()) # DON'T remove this line
    

# 1641072, 2022-09-24 10:14:23, PP--[--][PPPP] (50%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for i in range(len(x)):
        if x[i]>0:
            y.append(x[i])
    return min(y)

def f2(a, b, c):
    x = [a,b,c]
    y = []
    for i in range(len(x)):
        if x[i]<0:
            y.append(x[i])
    return max(y)
def f3(a, b, c):
    x = [a,b,c]
    z = sum(x)
    y = abs(z)
    y = str(y)
    return y[0]
def f4(a, b, c):
    x = [a,b,c]
    z = sum(x)
    y = abs(z)
    y = str(y)
    return y[-1]
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 ==0 and s2 == 1:
        print(f1(a, b, c))
    elif s1 ==0 and s2 == 0:
        print(f2(a, b, c))
    elif s1 ==1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 ==1 and s2 == 1:
        print(f4(a, b, c))
    elif (s1 != 0 or s1 != 1) and (s2 != 0 or s2 != 1):
        print('Error')

exec(input().strip()) # DON'T remove this line
    

# 1641091, 2022-09-24 10:15:09, PP--[--][PPPP] (50%)

def f1(a, b, c):
    x = [a,b,c]
    y = []
    for i in range(len(x)):
        if x[i]>0:
            y.append(x[i])
    return min(y)

def f2(a, b, c):
    x = [a,b,c]
    y = []
    for i in range(len(x)):
        if x[i]<0:
            y.append(x[i])
    return max(y)
def f3(a, b, c):
    x = [a,b,c]
    z = sum(x)
    y = abs(z)
    y = str(y)
    return y[0]
def f4(a, b, c):
    x = [a,b,c]
    z = sum(x)
    y = abs(z)
    y = str(y)
    return y[-1]
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 ==0 and s2 == 1:
        print(f1(a, b, c))
    elif s1 ==0 and s2 == 0:
        print(f2(a, b, c))
    elif s1 ==1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 ==1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line
    


6530070521
# 1639870, 2022-09-24 09:41:35, PP--[PP][----] (50%)

def f1(a,b,c):
    if -1000 <= a and a<= 1000 and -1000 <= b and b<= 1000 and -1000 <= c and c<= 1000:
        if a> 0 or b> 0 or c>0:
            if a< 0 or b< 0 or c< 0:
                x = []
                for e in range(-1000,1000):
                    if e == a or e == b or e == c:
                       if e%1 == 0 and e >0:
                           x.append(e)
                return min(x)

def f2(a,b,c):
    if -1000 <= a and a<= 1000 and -1000 <= b and b<= 1000 and -1000 <= c and c<= 1000:
        if a> 0 or b> 0 or c>0:
            if a< 0 or b< 0 or c< 0:
                x = []
                for i in range (-1000,1000):
                    if i == a or i == b or i == c:
                        if i%1 ==  0 and i< 0:
                            x.append(i)
                return max(x)
    

def f3(a,b,c):
    if -1000 <= a and a<= 1000 and -1000 <= b and b<= 1000 and -1000 <= c and c<= 1000:
        if a> 0 or b> 0 or c>0:
            if a< 0 or b< 0 or c< 0:
                x = a+b+c
                x = abs(x)
                x = str(x)
                return x[0]
    
def f4(a,b,c):
    if -1000 <= a and a<= 1000 and -1000 <= b and b<= 1000 and -1000 <= c and c<= 1000:
        if a> 0 or b> 0 or c>0:
            if a< 0 or b< 0 or c< 0:
                x = a+b+c
                x = abs(x)
                x = str(x)
                return x[-1]

def main():
    number = str(input()).split()
    s1 = int(number[0])
    s2 = int(number[1])
    a = int(number[2])
    b = int(number[3])
    c = int(number[4])
    if -1000 <= a and a<= 1000 and -1000 <= b and b<= 1000 and -1000 <= c and c<= 1000:
        if a> 0 or b> 0 or c>0:
            if a< 0 or b< 0 or c< 0:
                if s1 == 0 and s2 == 0:
                    print (f1(a,b,c))
                elif s1 == 0 and s2 ==1:
                    print (f2(a,b,c))
                elif s1 == 1 and s2 ==0:
                    print (f3(a,b,c))
                elif s1 == 1 and s2 ==1:
                    print (f4(a,b,c))
                else:
                    print('Error')


exec(input().strip()) #DON'T remove this line

# 1641580, 2022-09-24 10:25:03, PP--[PP][----] (50%)

def f1(a,b,c):
    if -1000 <= a <= 1000 and -1000 <= b <= 1000 and -1000 <= c <= 1000:
        if a> 0 or b> 0 or c>0:
            if a< 0 or b< 0 or c< 0:
                x = []
                for e in range(-1000,1000):
                    if e == a or e == b or e == c:
                       if e%1 == 0 and e >0:
                           x.append(e)
                return min(x)

def f2(a,b,c):
    if -1000 <= a and a<= 1000 and -1000 <= b and b<= 1000 and -1000 <= c and c<= 1000:
        if a> 0 or b> 0 or c>0:
            if a< 0 or b< 0 or c< 0:
                x = []
                for i in range (-1000,1000):
                    if i == a or i == b or i == c:
                        if i%1 ==  0 and i< 0:
                            x.append(i)
                return max(x)
    

def f3(a,b,c):
    if -1000 <= a and a<= 1000 and -1000 <= b and b<= 1000 and -1000 <= c and c<= 1000:
        if a> 0 or b> 0 or c>0:
            if a< 0 or b< 0 or c< 0:
                x = a+b+c
                x = abs(x)
                x = str(x)
                return x[0]
    
def f4(a,b,c):
    if -1000 <= a and a<= 1000 and -1000 <= b and b<= 1000 and -1000 <= c and c<= 1000:
        if a> 0 or b> 0 or c>0:
            if a< 0 or b< 0 or c< 0:
                x = a+b+c
                x = str(x)
                return x[-1]

def main():
    number = str(input()).split()
    s1 = int(number[0])
    s2 = int(number[1])
    a = int(number[2])
    b = int(number[3])
    c = int(number[4])
    if -1000 <= a and a<= 1000 and -1000 <= b and b<= 1000 and -1000 <= c and c<= 1000:
        if a> 0 or b> 0 or c>0:
            if a< 0 or b< 0 or c< 0:
                if s1 == 0 and s2 == 0:
                    print (f1(a,b,c))
                elif s1 == 0 and s2 ==1:
                    print (f2(a,b,c))
                elif s1 == 1 and s2 ==0:
                    print (f3(a,b,c))
                elif s1 == 1 and s2 ==1:
                    print (f4(a,b,c))
                else:
                    print('Error')


exec(input().strip()) #DON'T remove this line


6530114521
# 1640316, 2022-09-24 09:54:17, PPx-[PP][-P-x] (50%)

def f1(a, b, c):
    x = []
    if a > 0 and b > 0 and c <= 0 :
        x.append(a)
        x.append(b)
        return min(x)
    elif a > 0 and c > 0 and b <= 0 :
        x.append(a)
        x.append(c)
        return min(x)
    elif b > 0 and c > 0 and a <= 0 :
        x.append(b)
        x.append(c)
        return min(x)
    elif a > 0 and b <= 0 and c <= 0 :
        return a
    elif b > 0 and a <= 0 and c <= 0 :
        return b
    elif c > 0 and a <= 0 and b <= 0 :
        return c

def f2(a, b, c):
    y = []
    if a >= 0 and b >= 0 and c < 0 :
        return c
    elif a >= 0 and c >= 0 and b < 0 :
        return b
    elif b >= 0 and c >= 0 and a < 0 :
        return a
    elif a >= 0 and b < 0 and c < 0 :
        y.append(b)
        y.append(c)
        return max(y)
    elif b >= 0 and a < 0 and c < 0 :
        y.append(a)
        y.append(c)
        return max(y)
    elif c >= 0 and a < 0 and b < 0 :
        y.append(a)
        y.append(b)
        return max(y)
    
def f3(a, b, c):
    summ = a + b +c
    str0 = str(summ)
    str1 = str0[0]
    str2 = int(str1)
    return str2

def f4(a, b, c):
    summ = a + b + c
    summ1 = summ % 10
    return summ1

def main():
    z = [int(e) for e in input().split()]
    s1 = z[0]
    s2 = z[1]
    a = z[2]
    b = z[3]
    c = z[4]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))

exec(input().strip()) # DON'T remove this line
# 1640622, 2022-09-24 10:02:43, PPx-[PP][----] (50%)

def f1(a, b, c):
    x = []
    if a > 0 and b > 0 and c <= 0 :
        x.append(a)
        x.append(b)
        return min(x)
    elif a > 0 and c > 0 and b <= 0 :
        x.append(a)
        x.append(c)
        return min(x)
    elif b > 0 and c > 0 and a <= 0 :
        x.append(b)
        x.append(c)
        return min(x)
    elif a > 0 and b <= 0 and c <= 0 :
        return a
    elif b > 0 and a <= 0 and c <= 0 :
        return b
    elif c > 0 and a <= 0 and b <= 0 :
        return c

def f2(a, b, c):
    y = []
    if a >= 0 and b >= 0 and c < 0 :
        return c
    elif a >= 0 and c >= 0 and b < 0 :
        return b
    elif b >= 0 and c >= 0 and a < 0 :
        return a
    elif a >= 0 and b < 0 and c < 0 :
        y.append(b)
        y.append(c)
        return max(y)
    elif b >= 0 and a < 0 and c < 0 :
        y.append(a)
        y.append(c)
        return max(y)
    elif c >= 0 and a < 0 and b < 0 :
        y.append(a)
        y.append(b)
        return max(y)
    
def f3(a, b, c):
    summ = a + b +c
    str0 = str(summ)
    str1 = str0[0]
    str2 = int(str1)
    return str2

def f4(a, b, c):
    summ = a + b + c
    summ1 = summ % 10
    return summ1

def main():
    z = [int(e) for e in input().split()]
    s1 = z[0]
    s2 = z[1]
    a = z[2]
    b = z[3]
    c = z[4]
    if -1000 <= a <= 1000 and -1000 <= b <= 1000 and -1000 <= c <= 1000 :
        if s1 == 0 and s2 == 0 :
            print(f1(a, b, c))
        elif s1 == 0 and s2 == 1 :
            print(f2(a, b, c))
        elif s1 == 1 and s2 == 0 :
            print(f3(a, b, c))
        elif s1 == 1 and s2 == 1 :
            print(f4(a, b, c))

exec(input().strip()) # DON'T remove this line

6530053921
# 1639941, 2022-09-24 09:43:42, PP--[PP][----] (50%)

def f1(a, b, c):
    A = [a,b,c]
    B = [e for e in A if -1000 <= e <= 1000]
    if len(A) == len(B) :
        if min(A) < 0 and max(A) > 0 :
            C = [k for k in B if k > 0]
            x = int(min(C))
            return x
            
def f2(a, b, c):
    A = [a,b,c]
    B = [e for e in A if -1000 <= e <= 1000]
    if len(A) == len(B) :
        if min(A) < 0 and max(A) > 0 :
            C = [k for k in B if k < 0]
            x = int(max(C))
            return x

def f3(a, b, c):
    A = [a,b,c]
    B = [e for e in A if -1000 <= e <= 1000]
    if len(A) == len(B) :
        if min(A) < 0 and max(A) > 0 :
            C = a + b + c
            C = str(C)
            if C[0] == '-' :
                x = int(C[1])
            else :
                x = int(C[0])
            return x

def f4(a, b, c):
    A = [a,b,c]
    B = [e for e in A if -1000 <= e <= 1000]
    if len(A) == len(B) :
        if min(A) < 0 and max(A) > 0 :
            C = a + b + c
            C = str(C)
            x = int(C[-1])
            return x

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    A = [a,b,c]
    B = [e for e in A if -1000 <= e <= 1000]
    if len(A) == len(B) :
        if min(A) < 0 and max(A) > 0 :
            if s1 == 0 and s2 == 0 :
                print(f1(a,b,c))
            elif s1 == 0 and s2 == 1 :
                print(f2(a,b,c))
            elif s1 == 1 and s2 == 0 :
                print(f3(a,b,c))
            elif s1 == 1 and s2 == 1 :
                print(f4(a,b,c))
            else :
                print('Error')
    
exec(input().strip())

6530141421
# 1639444, 2022-09-24 09:30:31, PPx-[PP][PxPP] (50%)

def f1(a, b, c):
    y = [a,b,c]
    x = min(y)
    while x <= 0:
        y.remove(x)
        x = min(y)
    return(x)

def f2(a, b, c):
    y = [a,b,c]
    x = max(y)
    while x >= 0:
        y.remove(x)
        x = max(y)
    return(x)
    
def f3(a, b, c):
    x = int(a)+int(b)+int(c)
    a = str(x)
    if x<0:
        y = a[1]
    else:
        y = x[0]
    return(y)
    

def f4(a, b, c):
    x = str(int(a)+int(b)+int(c))
    y = x[-1]
    return(y)
    

def main():
    x = [int(e) for e in input().split()]
    s1,s2,a,b,c = x[0],x[1],x[2],x[3],x[4]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip())  # DON'T remove this line



6530157521
# 1640162, 2022-09-24 09:50:02, P---[PP][PPPP] (50%)

def f1(a, b, c):
    x = []
    x.append(a)
    x.append(b)
    x.append(c)
    x.sort()
    for i in range(len(x)) :
        if x[i] > 0 :
            return x[i]
            break
def f2(a, b, c):
    x = []
    x.append(a)
    x.append(b)
    x.append(c)
    x.sort()
    for i in range(len(x)) :
        if x[-i] > 0 :
            return x[i]
            break
    
    
def f3(a, b, c):
    x = abs(a+b+c)
    s = str(x)
    a = s[0]
    return a
    
    
def f4(a, b, c):
    x = abs(a+b+c)
    s = str(x)
    a = s[-1]
    return a
    
def main():
    x = input().split()
    if int(x[0]) == 0 and int(x[1]) == 0 :
        print (f1(int(x[2]),int(x[3]),int(x[4])))
    elif int(x[0]) == 0 and int(x[1]) == 1 :
        print (f2(int(x[2]),int(x[3]),int(x[4])))
    elif int(x[0]) == 1 and int(x[1]) == 0 :
        print (f3(int(x[2]),int(x[3]),int(x[4])))
    elif int(x[0]) == 1 and int(x[1]) == 1 :
        print (f4(int(x[2]),int(x[3]),int(x[4])))
    else :
        print("Error")
    
    
exec(input().strip()) # DON'T remove this line

Max Score = 33


6531807021
# 1640107, 2022-09-24 09:48:19, ----[xx][xxxx] (0%)

def f1(a, b, c):

# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0

 data = [a,b,c]
 for i in data:
    if i<0:
        data.remove(i)
 print(min(data))


def f2(a, b, c):
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0

 data = [a,b,c]
 for i in data:
    if i>0:
        data.remove(i)
 print(max(data))
    
    
def f3(a, b, c):
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
 data = [a,b,c]
 sum = 0
 for i in data:
     sum += i
 sum1 = abs(sum)
 sum1 = str(sum1)
 print(sum1[0])

def f4(a, b, c):
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
 data = [a,b,c]
 sum = 0
 for i in data:
     sum += i
 sum1 = abs(sum)
 sum1 = str(sum1)
 print(sum1[-1])
 
def main():
# รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
# ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
# ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error
    s1,s2,a,b,c = input.split()
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
        

exec(input().strip()) # DON'T remove this line
# 1640141, 2022-09-24 09:49:21, ----[xx][P-P-] (0%)

def f1(a, b, c):

# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0

 data = [a,b,c]
 for i in data:
    if i<0:
        data.remove(i)
 print(min(data))
 
def f2(a, b, c):
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0

 data = [a,b,c]
 for i in data:
    if i>0:
        data.remove(i)
 print(max(data))
 
def f3(a, b, c):
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
 data = [a,b,c]
 sum = 0
 for i in data:
     sum += int(i)
 sum1 = abs(sum)
 sum1 = str(sum1)
 print(sum1[0])
 
def f4(a, b, c):
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
 data = [a,b,c]
 sum = 0
 for i in data:
     sum += int(i)
 sum1 = abs(sum)
 sum1 = str(sum1)
 print(sum1[-1])

def main():
# รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
# ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
# ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error
    s1,s2,a,b,c = input().split()
    if s1 == "0" and s2 == "0":
        print(f1(a,b,c))
    if s1 == "0" and s2 == "1":
        print(f2(a, b, c))
    if s1 == "1" and s2 == "0":
        print(f3(a, b, c))
    if s1 == "1" and s2 == "1":
        print(f4(a, b, c))
    else:
        print("Error")
    
exec(input().strip())
# 1640763, 2022-09-24 10:06:23, ----[xx][P-P-] (0%)

def f1(a, b, c):

# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0

 data = [a,b,c]
 for i in data:
    if i<0:
        data.remove(i)
 return min(data)
 
def f2(a, b, c):
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0

 data = [a,b,c]
 for i in data:
    if i>0:
        data.remove(i)
 return max(data)
 
def f3(a, b, c):
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
 data = [a,b,c]
 sum = 0
 for i in data:
     sum += int(i)
 sum1 = abs(sum)
 sum1 = str(sum1)
 return sum1[0]
 
def f4(a, b, c):
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
 data = [a,b,c]
 sum = 0
 for i in data:
     sum += int(i)
 sum1 = abs(sum)
 sum1 = str(sum1)
 return sum1[-1]

def main():
# รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
# ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
# ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error
    s1,s2,a,b,c = input().split()
    if s1 == "0" and s2 == "0":
        print(f1(a,b,c))
    if s1 == "0" and s2 == "1":
        print(f2(a, b, c))
    if s1 == "1" and s2 == "0":
        print(f3(a, b, c))
    if s1 == "1" and s2 == "1":
        print(f4(a, b, c))
    else:
        print("Error")
    
exec(input().strip())
# 1640851, 2022-09-24 10:08:39, ----[xx][P-P-] (0%)

def f1(a, b, c):

# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0

 data = [a,b,c]
 for i in data:
    if i<0:
        data.remove(i)
 return min(data)
 
def f2(a, b, c):
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0

 data = [a,b,c]
 for i in data:
    if i>0:
        data.remove(i)
 return max(data)
 
def f3(a, b, c):
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
 data = [a,b,c]
 sum = 0
 for i in data:
     sum += int(i)
 sum1 = abs(sum)
 sum1 = str(sum1)
 return sum1[0]
 
def f4(a, b, c):
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
 data = [a,b,c]
 sum = 0
 for i in data:
     sum += int(i)
 sum1 = abs(sum)
 sum1 = str(sum1)
 return sum1[-1]

def main():
# รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
# ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
# ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error
    s1,s2,a,b,c = input().split()
    if s1 == "0" and s2 == "0":
        print(f1(a,b,c))
    if s1 == "0" and s2 == "1":
        print(f2(a, b, c))
    if s1 == "1" and s2 == "0":
        print(f3(a, b, c))
    if s1 == "1" and s2 == "1":
        print(f4(a, b, c))
    else:
        print("Error")
    
exec(input().strip())
# 1640925, 2022-09-24 10:10:29, ----[xx][P-P-] (0%)

def f1(a, b, c):

# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0

 data = [a,b,c]
 for i in data:
    if i<0:
        data.remove(i)
 return min(data)
 
def f2(a, b, c):
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0

 data = [a,b,c]
 for i in data:
    if i>0:
        data.remove(i)
 return max(data)
 
def f3(a, b, c):
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
 data = [a,b,c]
 sum = 0
 for i in data:
     sum += int(i)
 sum1 = abs(sum)
 sum1 = str(sum1)
 return sum1[0]
 
def f4(a, b, c):
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
 data = [a,b,c]
 sum = 0
 for i in data:
     sum += int(i)
 sum1 = abs(sum)
 sum1 = str(sum1)
 return sum1[-1]

def main():
# รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
# ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
# ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error
    s1,s2,a,b,c = input().split()
    if s1 == "0" and s2 == "0":
        print(f1(a,b,c))
    if s1 == "0" and s2 == "1":
        print(f2(a, b, c))
    if s1 == "1" and s2 == "0":
        print(f3(a, b, c))
    if s1 == "1" and s2 == "1":
        print(f4(a, b, c))
    else:
        print("Error")
    
exec(input().strip())
# 1641030, 2022-09-24 10:13:11, ----[xx][P-P-] (0%)

def f1(a, b, c):

# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0

    data = [a,b,c]
    for i in data:
        if i<0:
            data.remove(i)
    return min(data)
 
def f2(a, b, c):
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0

    data = [a,b,c]
    for i in data:
        if i>0:
            data.remove(i)
    return max(data)
 
def f3(a, b, c):
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
    data = [a,b,c]
    sum = 0
    for i in data:
        sum += int(i)
    sum1 = abs(sum)
    sum1 = str(sum1)
    return sum1[0]
 
def f4(a, b, c):
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    data = [a,b,c]
    sum = 0
    for i in data:
        sum += int(i)
    sum1 = abs(sum)
    sum1 = str(sum1)
    return sum1[-1]

def main():
# รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
# ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
# ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error
    s1,s2,a,b,c = input().split()
    if s1 == "0" and s2 == "0":
        print(f1(a,b,c))
    if s1 == "0" and s2 == "1":
        print(f2(a, b, c))
    if s1 == "1" and s2 == "0":
        print(f3(a, b, c))
    if s1 == "1" and s2 == "1":
        print(f4(a, b, c))
    else:
        print("Error")
    
exec(input().strip())
# 1641055, 2022-09-24 10:13:57, --xx[xx][PxPx] (0%)

def f1(a, b, c):

# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0

    data = [a,b,c]
    for i in data:
        if i<0:
            data.remove(i)
    return min(data)
 
def f2(a, b, c):
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0

    data = [a,b,c]
    for i in data:
        if i>0:
            data.remove(i)
    return max(data)
 
def f3(a, b, c):
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
    data = [a,b,c]
    sum0 = 0
    for i in data:
        sum0 += int(i)
    sum1 = abs(sum)
    sum1 = str(sum1)
    return sum1[0]
 
def f4(a, b, c):
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    data = [a,b,c]
    sum0 = 0
    for i in data:
        sum0 += int(i)
    sum1 = abs(sum)
    sum1 = str(sum1)
    return sum1[-1]

def main():
# รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
# ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
# ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error
    s1,s2,a,b,c = input().split()
    if s1 == "0" and s2 == "0":
        print(f1(a,b,c))
    if s1 == "0" and s2 == "1":
        print(f2(a, b, c))
    if s1 == "1" and s2 == "0":
        print(f3(a, b, c))
    if s1 == "1" and s2 == "1":
        print(f4(a, b, c))
    else:
        print("Error")
    
exec(input().strip())
# 1641063, 2022-09-24 10:14:11, ---x[xx][P-P-] (0%)

def f1(a, b, c):

# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0

    data = [a,b,c]
    for i in data:
        if i<0:
            data.remove(i)
    return min(data)
 
def f2(a, b, c):
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0

    data = [a,b,c]
    for i in data:
        if i>0:
            data.remove(i)
    return max(data)
 
def f3(a, b, c):
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
    data = [a,b,c]
    sum0 = 0
    for i in data:
        sum0 += int(i)
    sum1 = abs(sum0)
    sum1 = str(sum1)
    return sum1[0]
 
def f4(a, b, c):
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    data = [a,b,c]
    sum0 = 0
    for i in data:
        sum0 += int(i)
    sum1 = abs(sum)
    sum1 = str(sum1)
    return sum1[-1]

def main():
# รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
# ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
# ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error
    s1,s2,a,b,c = input().split()
    if s1 == "0" and s2 == "0":
        print(f1(a,b,c))
    if s1 == "0" and s2 == "1":
        print(f2(a, b, c))
    if s1 == "1" and s2 == "0":
        print(f3(a, b, c))
    if s1 == "1" and s2 == "1":
        print(f4(a, b, c))
    else:
        print("Error")
    
exec(input().strip())
# 1641070, 2022-09-24 10:14:23, ----[xx][P-P-] (0%)

def f1(a, b, c):

# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0

    data = [a,b,c]
    for i in data:
        if i<0:
            data.remove(i)
    return min(data)
 
def f2(a, b, c):
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0

    data = [a,b,c]
    for i in data:
        if i>0:
            data.remove(i)
    return max(data)
 
def f3(a, b, c):
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
    data = [a,b,c]
    sum0 = 0
    for i in data:
        sum0 += int(i)
    sum1 = abs(sum0)
    sum1 = str(sum1)
    return sum1[0]
 
def f4(a, b, c):
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    data = [a,b,c]
    sum0 = 0
    for i in data:
        sum0 += int(i)
    sum1 = abs(sum0)
    sum1 = str(sum1)
    return sum1[-1]

def main():
# รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
# ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
# ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error
    s1,s2,a,b,c = input().split()
    if s1 == "0" and s2 == "0":
        print(f1(a,b,c))
    if s1 == "0" and s2 == "1":
        print(f2(a, b, c))
    if s1 == "1" and s2 == "0":
        print(f3(a, b, c))
    if s1 == "1" and s2 == "1":
        print(f4(a, b, c))
    else:
        print("Error")
    
exec(input().strip())
# 1641084, 2022-09-24 10:15:01, ----[xx][P-P-] (0%)

def f1(a, b, c):

# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0

    data = [a,b,c]
    for i in data:
        if i<0:
            data.remove(i)
    return min(data)
 
def f2(a, b, c):
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0

    data = [a,b,c]
    for i in data:
        if i>0:
            data.remove(i)
    return max(data)
 
def f3(a, b, c):
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
    data = [a,b,c]
    sum0 = 0
    for i in data:
        sum0 += int(i)
    sum1 = abs(sum0)
    sum1 = str(sum1)
    return sum1[0]
 
def f4(a, b, c):
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    data = [a,b,c]
    sum0 = 0
    for i in data:
        sum0 += int(i)
    sum1 = abs(sum0)
    sum1 = str(sum1)
    return sum1[-1]

def main():
# รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
# ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
# ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error
    s1,s2,a,b,c = input().split()
    if s1 == "0" and s2 == "0":
        print(f1(a,b,c))
    if s1 == "0" and s2 == "1":
        print(f2(a, b, c))
    if s1 == "1" and s2 == "0":
        print(f3(a, b, c))
    if s1 == "1" and s2 == "1":
        print(f4(a, b, c))
    else:
        print("Error")
    
exec(input().strip())
# 1641230, 2022-09-24 10:18:13, compilation error (0%)

def f1(a, b, c):



    data = [a,b,c]
    for i in data:
        if i<0:
            data.remove(i)
    return min(data)
 
def f2(a, b, c):
่

    data = [a,b,c]
    for i in data:
        if i>0:
            data.remove(i)
    return max(data)
 
def f3(a, b, c):
 
    data = [a,b,c]
    sum0 = 0
    for i in data:
        sum0 += int(i)
    sum1 = abs(sum0)
    sum1 = str(sum1)
    return sum1[0]
 
def f4(a, b, c):

    data = [a,b,c]
    sum0 = 0
    for i in data:
        sum0 += int(i)
    sum1 = abs(sum0)
    sum1 = str(sum1)
    return sum1[-1]

def main():

    s1,s2,a,b,c = input().split()
    if s1 == "0" and s2 == "0":
        print(f1(a,b,c))
    if s1 == "0" and s2 == "1":
        print(f2(a, b, c))
    if s1 == "1" and s2 == "0":
        print(f3(a, b, c))
    if s1 == "1" and s2 == "1":
        print(f4(a, b, c))
    else:
        print("Error")
    
exec(input().strip())
# 1641244, 2022-09-24 10:18:26, compilation error (0%)

def f1(a, b, c):



    data = [a,b,c]
    for i in data:
        if i<0:
            data.remove(i)
    return min(data)
 
def f2(a, b, c):
่

    data = [a,b,c]
    for i in data:
        if i>0:
            data.remove(i)
    return max(data)
 
def f3(a, b, c):
 
    data = [a,b,c]
    sum0 = 0
    for i in data:
        sum0 += int(i)
    sum1 = abs(sum0)
    sum1 = str(sum1)
    return sum1[0]
 
def f4(a, b, c):

    data = [a,b,c]
    sum0 = 0
    for i in data:
        sum0 += int(i)
    sum1 = abs(sum0)
    sum1 = str(sum1)
    return sum1[-1]

def main():

    s1,s2,a,b,c = input().split()
    if s1 == "0" and s2 == "0":
        print(f1(a,b,c))
    if s1 == "0" and s2 == "1":
        print(f2(a, b, c))
    if s1 == "1" and s2 == "0":
        print(f3(a, b, c))
    if s1 == "1" and s2 == "1":
        print(f4(a, b, c))
    else:
        print("Error")
    
exec(input().strip())
# 1641268, 2022-09-24 10:18:57, ----[xx][P-P-] (0%)

def f1(a, b, c):

    data = [a,b,c]
    for i in data:
        if i<0:
            data.remove(i)
    return min(data)
 
def f2(a, b, c):

    data = [a,b,c]
    for i in data:
        if i>0:
            data.remove(i)
    return max(data)
 
def f3(a, b, c):
 
    data = [a,b,c]
    sum0 = 0
    for i in data:
        sum0 += int(i)
    sum1 = abs(sum0)
    sum1 = str(sum1)
    return sum1[0]
 
def f4(a, b, c):

    data = [a,b,c]
    sum0 = 0
    for i in data:
        sum0 += int(i)
    sum1 = abs(sum0)
    sum1 = str(sum1)
    return sum1[-1]

def main():

    s1,s2,a,b,c = input().split()
    if s1 == "0" and s2 == "0":
        print(f1(a,b,c))
    if s1 == "0" and s2 == "1":
        print(f2(a, b, c))
    if s1 == "1" and s2 == "0":
        print(f3(a, b, c))
    if s1 == "1" and s2 == "1":
        print(f4(a, b, c))
    else:
        print("Error")
    
exec(input().strip())
# 1641537, 2022-09-24 10:24:25, ----[xx][P-P-] (0%)

def f1(a, b, c):

    data = [a,b,c]
    for i in data:
        if i<0:
            data.remove(i)
    return min(data)
 
def f2(a, b, c):

    data = [a,b,c]
    for i in data:
        if i>0:
            data.remove(i)
    return max(data)
 
def f3(a, b, c):
 
    data = [a,b,c]
    sum0 = 0
    for i in data:
        sum0 += int(i)
    sum1 = abs(sum0)
    sum1 = str(sum1)
    return sum1[0]
 
def f4(a, b, c):

    data = [a,b,c]
    sum0 = 0
    for i in data:
        sum0 += int(i)
    sum1 = abs(sum0)
    sum1 = str(sum1)
    return sum1[-1]

def main():

    s1,s2,a,b,c = input().split()
    if s1 == "0" and s2 == "0":
        print(f1(a,b,c))
    if s1 == "0" and s2 == "1":
        print(f2(a, b, c))
    if s1 == "1" and s2 == "0":
        print(f3(a, b, c))
    if s1 == "1" and s2 == "1":
        print(f4(a, b, c))
    else:
        print("Error")
    
exec(input().strip())
# 1641714, 2022-09-24 10:27:35, ----[xx][P-P-] (0%)

def f1(a, b, c):

  data = [a,b,c]
  for i in data:
    if i<0:
      data.remove(i)
  return min(data)
 
def f2(a, b, c):

  data = [a,b,c]
  for i in data:
    if i>0:
      data.remove(i)
  return max(data)
 
def f3(a, b, c):
 
  data = [a,b,c]
  sum0 = 0
  for i in data:
    sum0 += int(i)
  sum1 = abs(sum0)
  sum1 = str(sum1)
  return sum1[0]
 
def f4(a, b, c):

  data = [a,b,c]
  sum0 = 0
  for i in data:
    sum0 += int(i)
  sum1 = abs(sum0)
  sum1 = str(sum1)
  return sum1[-1]

def main():

  s1,s2,a,b,c = input().split()
  if s1 == "0" and s2 == "0":
    print(f1(a,b,c))
  if s1 == "0" and s2 == "1":
    print(f2(a, b, c))
  if s1 == "1" and s2 == "0":
    print(f3(a, b, c))
  if s1 == "1" and s2 == "1":
    print(f4(a, b, c))
  else:
    print("Error")
    
exec(input().strip())
# 1642168, 2022-09-24 10:35:21, ----[xx][P-P-] (0%)

def f1(a, b, c):

  data = [a,b,c]
  for i in data:
    if i<0:
      data.remove(i)
  return min(data)
 
def f2(a, b, c):

  data = [a,b,c]
  for i in data:
    if i>0:
      data.remove(i)
  return max(data)
 
def f3(a, b, c):
 
  data = [a,b,c]
  sum0 = 0
  for i in data:
    sum0 += int(i)
  sum1 = abs(sum0)
  sum1 = str(sum1)
  return sum1[0]
 
def f4(a, b, c):

  data = [a,b,c]
  sum0 = 0
  for i in data:
    sum0 += int(i)
  sum1 = abs(sum0)
  sum1 = str(sum1)
  return sum1[-1]

def main():

  s1,s2,a,b,c = input().split()
  if s1 == "0" and s2 == "0":
    print(f1(a,b,c))
  if s1 == "0" and s2 == "1":
    print(f2(a, b, c))
  if s1 == "1" and s2 == "0":
    print(f3(a, b, c))
  if s1 == "1" and s2 == "1":
    print(f4(a, b, c))
  else:
    print("Error")
    
exec(input().strip())

# 1642260, 2022-09-24 10:36:35, --PP[xx][P-P-] (33%)

def f1(a, b, c):

  data = [a,b,c]
  for i in data:
    if i<0:
      data.remove(i)
  return int(min(data))
 
def f2(a, b, c):

  data = [a,b,c]
  for i in data:
    if i>0:
      data.remove(i)
  return int(max(data))
 
def f3(a, b, c):
 
  data = [a,b,c]
  sum0 = 0
  for i in data:
    sum0 += int(i)
  sum1 = abs(sum0)
  sum1 = str(sum1)
  return int(sum1[0])
 
def f4(a, b, c):

  data = [a,b,c]
  sum0 = 0
  for i in data:
    sum0 += int(i)
  sum1 = abs(sum0)
  sum1 = str(sum1)
  return int(sum1[-1])

def main():

  s1,s2,a,b,c = input().split()
  if s1 == "0" and s2 == "0":
    print(f1(a,b,c))
  if s1 == "0" and s2 == "1":
    print(f2(a, b, c))
  if s1 == "1" and s2 == "0":
    print(f3(a, b, c))
  if s1 == "1" and s2 == "1":
    print(f4(a, b, c))
  else:
    print("Error")
    
exec(input().strip())
# 1642311, 2022-09-24 10:37:16, --PP[--][P-P-] (33%)

def f1(a, b, c):

  data = [a,b,c]
  for i in data:
    if int(i)<0:
      data.remove(i)
  return int(min(data))
 
def f2(a, b, c):

  data = [a,b,c]
  for i in data:
    if int(i)>0:
      data.remove(i)
  return int(max(data))
 
def f3(a, b, c):
 
  data = [a,b,c]
  sum0 = 0
  for i in data:
    sum0 += int(i)
  sum1 = abs(sum0)
  sum1 = str(sum1)
  return int(sum1[0])
 
def f4(a, b, c):

  data = [a,b,c]
  sum0 = 0
  for i in data:
    sum0 += int(i)
  sum1 = abs(sum0)
  sum1 = str(sum1)
  return int(sum1[-1])

def main():

  s1,s2,a,b,c = input().split()
  if s1 == "0" and s2 == "0":
    print(f1(a,b,c))
  if s1 == "0" and s2 == "1":
    print(f2(a, b, c))
  if s1 == "1" and s2 == "0":
    print(f3(a, b, c))
  if s1 == "1" and s2 == "1":
    print(f4(a, b, c))
  else:
    print("Error")
    
exec(input().strip())

6530150021
# 1640262, 2022-09-24 09:52:22, compilation error (0%)

def f1(a, b, c):

    x=max(a,b,c)
    return x
def f2(a, b, c):
    y=max(a,b,c)
    return y
def f3(a, b, c):

    k=a+b+c
    u=abs(k)
    l=u[0]
    return l
def f4(a, b, c):
    t=a+b+c
    p=abs(t)
    r=p[-1]
    return r

def main():

    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1==0 and s2==0:
        print f1(a, b, c)
    elif s1==0 and s2==1:
        print f2(a, b, c)
    elif s1==1 and s2==0:
        print f3(a, b, c)
    elif s1==1 and s2==1:
        print f4(a, b, c)
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1640265, 2022-09-24 09:52:28, compilation error (0%)

def f1(a, b, c):

    x=max(a,b,c)
    return x
def f2(a, b, c):
    y=max(a,b,c)
    return y
def f3(a, b, c):

    k=a+b+c
    u=abs(k)
    l=u[0]
    return l
def f4(a, b, c):
    t=a+b+c
    p=abs(t)
    r=p[-1]
    return r

def main():

    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1==0 and s2==0:
        print f1(a, b, c)
    elif s1==0 and s2==1:
        print f2(a, b, c)
    elif s1==1 and s2==0:
        print f3(a, b, c)
    elif s1==1 and s2==1:
        print f4(a, b, c)
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1640385, 2022-09-24 09:56:20, --xx[--][-x-x] (0%)

def f1(a, b, c):
    x=max(a,b,c)
    return x
    
def f2(a, b, c):
    y=max(a,b,c)
    return y
    
def f3(a, b, c):
    k=a+b+c
    u=abs(k)
    l=u[0]
    return l
    
def f4(a, b, c):
    t=a+b+c
    p=abs(t)
    r=p[-1]
    return r

def main():

    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1==0 and s2==0:
        u= f1(a, b, c)
    elif s1==0 and s2==1:
        u= f2(a, b, c)
    elif s1==1 and s2==0:
        u= f3(a, b, c)
    elif s1==1 and s2==1:
        u= f4(a, b, c)
    else:
        u='Error'
        return u
exec(input().strip()) # DON'T remove this line
# 1640435, 2022-09-24 09:57:50, --xx[--][-x-x] (0%)

def f1(a, b, c):
    x=max(a,b,c)
    return x
    
def f2(a, b, c):
    y=max(a,b,c)
    return y
    
def f3(a, b, c):
    k=a+b+c
    u=abs(k)
    l=u[0]
    return l
    
def f4(a, b, c):
    t=a+b+c
    p=abs(t)
    r=p[-1]
    return r

def main():

    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1==0 and s2==0:
        u= f1(a, b, c)
    elif s1==0 and s2==1:
        u= f2(a, b, c)
    elif s1==1 and s2==0:
        u= f3(a, b, c)
    elif s1==1 and s2==1:
        u= f4(a, b, c)
    else:
        u='Error'
        return u
exec(input().strip()) # DON'T remove this line
# 1640656, 2022-09-24 10:03:47, --xx[--][-x-x] (0%)

def f1(a, b, c):

    x=max(int(a),int(b),int(c))
    return x
def f2(a, b, c):
    y=max(int(a),int(b),int(c))
    return y
def f3(a, b, c):

    k=int(a)+int(b)+int(c)
    u=abs(k)
    l=u[0]
    return l
def f4(a, b, c):
    t=int(a)+int(b)+int(c)
    p=abs(t)
    r=p[-1]
    return r

def main():

    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1==0 and s2==0:
        u= f1(a, b, c)
    elif s1==0 and s2==1:
        u= f2(a, b, c)
    elif s1==1 and s2==0:
        u= f3(a, b, c)
    elif s1==1 and s2==1:
        u= f4(a, b, c)
    else:
        u='Error'
        return u
exec(input().strip()) # DON'T remove this line
# 1641027, 2022-09-24 10:13:10, compilation error (0%)

def f1(a, b, c):

    if int(a)<0:
        a=0
    elif int(b)<0:
        b=0
    elif int(c)<0:
        c=0
    else x=min(a,b,c)
    return x
def f2(a, b, c):
    if int(a)>0:
        a=0
    elif int(b)>0:
        b=0
    elif int(c)>0:
        c=0
    y=max(a,b,c)
    return y
def f3(a, b, c):

    k=int(a)+int(b)+int(c)
    u=abs(k)
    l=u[0]
    return l
def f4(a, b, c):
    t=int(a)+int(b)+int(c)
    p=abs(t)
    r=p[-1]
    return r

def main():

    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1==0 and s2==0:
        u= f1(a, b, c)
    elif s1==0 and s2==1:
        u= f2(a, b, c)
    elif s1==1 and s2==0:
        u= f3(a, b, c)
    elif s1==1 and s2==1:
        u= f4(a, b, c)
    else:
        u='Error'
        return u
exec(input().strip()) # DON'T remove this line
# 1641081, 2022-09-24 10:14:55, compilation error (0%)

def f1(a, b, c):

    x=0
    if int(a)<0:
        a=0
    elif int(b)<0:
        b=0
    elif int(c)<0:
        c=0
    else x=min(a,b,c)
    return x
def f2(a, b, c):
    y=0
    if int(a)>0:
        a=0
    elif int(b)>0:
        b=0
    elif int(c)>0:
        c=0
    y=max(a,b,c)
    return y
def f3(a, b, c):

    k=int(a)+int(b)+int(c)
    u=abs(k)
    l=u[0]
    return l
def f4(a, b, c):
    t=int(a)+int(b)+int(c)
    p=abs(t)
    r=p[-1]
    return r

def main():

    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1==0 and s2==0:
        u= f1(a, b, c)
    elif s1==0 and s2==1:
        u= f2(a, b, c)
    elif s1==1 and s2==0:
        u= f3(a, b, c)
    elif s1==1 and s2==1:
        u= f4(a, b, c)
    else:
        u='Error'
        return u
exec(input().strip()) # DON'T remove this line
# 1641131, 2022-09-24 10:16:07, compilation error (0%)

def f1(a, b, c):

    x=0
    if int(a)<0:
        a=0
    elif int(b)<0:
        b=0
    elif int(c)<0:
        c=0
    else :
        x=min(a,b,c)
    return x
def f2(a, b, c):
    y=0
    if int(a)>0:
        a=0
    elif int(b)>0:
        b=0
    elif int(c)>0:
        c=0
    else:
        y=max(a,b,c)
    return y
def f3(a, b, c):

    k=int(a)+int(b)+int(c)
    u=abs(k)
    l=u[0]
    return l
def f4(a, b, c):
    t=int(a)+int(b)+int(c)
    p=abs(t)
    r=p[-1]
    return r

def main():

    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1==0 and s2==0:
        u= f1(a, b, c)
    elif s1==0 and s2==1:
        u= f2(a, b, c)
    elif s1==1 and s2==0:
        u= f3(a, b, c)
    elif s1==1 and s2==1:
        u= f4(a, b, c)
    else:
        u='Error'
        return u
exec(input().strip()) # DON'T remove this line
        return u
exec(input().strip()) # DON'T remove this line
# 1641399, 2022-09-24 10:21:24, --xx[--][-x-x] (0%)

def f1(a, b, c):

    x=0
    if int(a)<0:
        a=0
    elif int(b)<0:
        b=0
    elif int(c)<0:
        c=0
    B=(a,b,c)
    x+=min(B)
    return x
def f2(a, b, c):
    y=0
    if int(a)>0:
        a=0
    elif int(b)>0:
        b=0
    elif int(c)>0:
        c=0
    else:
        y+=max(a,b,c)
    return y
def f3(a, b, c):

    k=int(a)+int(b)+int(c)
    u=abs(k)
    l=u[0]
    return l
def f4(a, b, c):
    t=int(a)+int(b)+int(c)
    p=abs(t)
    r=p[-1]
    return r

def main():

    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1==0 and s2==0:
        u= f1(a, b, c)
    elif s1==0 and s2==1:
        u= f2(a, b, c)
    elif s1==1 and s2==0:
        u= f3(a, b, c)
    elif s1==1 and s2==1:
        u= f4(a, b, c)
    else:
        u='Error'
        return u
exec(input().strip()) # DON'T remove this line
# 1641492, 2022-09-24 10:23:36, --xx[--][-x-x] (0%)

def f1(a, b, c):

    x=0
    if int(a)<0:
        a=0
    elif int(b)<0:
        b=0
    elif int(c)<0:
        c=0
    B=(a,b,c)
    x+=min(B)
    return int(x)
def f2(a, b, c):
    y=0
    if int(a)>0:
        a=0
    elif int(b)>0:
        b=0
    elif int(c)>0:
        c=0
    else:
        y+=max(a,b,c)
    return y
def f3(a, b, c):

    k=int(a)+int(b)+int(c)
    u=abs(k)
    l=u[0]
    return l
def f4(a, b, c):
    t=int(a)+int(b)+int(c)
    p=abs(t)
    r=p[-1]
    return r

def main():

    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1==0 and s2==0:
        u= f1(a, b, c)
    elif s1==0 and s2==1:
        u= f2(a, b, c)
    elif s1==1 and s2==0:
        u= f3(a, b, c)
    elif s1==1 and s2==1:
        u= f4(a, b, c)
    else:
        u='Error'
        return u
exec(input().strip()) # DON'T remove this line
    
    
    

# 1641713, 2022-09-24 10:27:35, --xx[--][-x-x] (0%)

def f1(a, b, c):

    x=0
    if int(a)<0:
        a=0
    elif int(b)<0:
        b=0
    elif int(c)<0:
        c=0
    B=(a,b,c)
    x+=min(B)
    return int(x)
def f2(a, b, c):
    y=0
    if int(a)>0:
        a=0
    elif int(b)>0:
        b=0
    elif int(c)>0:
        c=0
    else:
        y+=max(a,b,c)
    return y
def f3(a, b, c):

    k=int(a)+int(b)+int(c)
    u=abs(k)
    l=u[0]
    return l
def f4(a, b, c):
    t=int(a)+int(b)+int(c)
    p=abs(t)
    r=p[-1]
    return r

def main():

    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1==0 and s2==0:
        u= f1(a, b, c)
    elif s1==0 and s2==1:
        u= f2(a, b, c)
    elif s1==1 and s2==0:
        u= f3(a, b, c)
    elif s1==1 and s2==1:
        u= f4(a, b, c)
    else:
        u='Error'
        return u
exec(input().strip()) # DON'T remove this line
# 1641872, 2022-09-24 10:30:18, --xx[--][-x-x] (0%)

def f1(a, b, c):

    x=0
    if int(a)<0:
        a=1000
    elif int(b)<0:
        b=1000
    elif int(c)<0:
        c=1000
    x+=min(a,b,c)
    return x
def f2(a, b, c):
    y=0
    if int(a)>0:
        a=-1000
    elif int(b)>0:
        b=-1000
    elif int(c)>0:
        c=-1000
    else:
        y+=max(a,b,c)
    return y
def f3(a, b, c):

    k=int(a)+int(b)+int(c)
    u=abs(k)
    l=u[0]
    return l
def f4(a, b, c):
    t=int(a)+int(b)+int(c)
    p=abs(t)
    r=p[-1]
    return r

def main():

    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1==0 and s2==0:
        u= f1(a, b, c)
    elif s1==0 and s2==1:
        u= f2(a, b, c)
    elif s1==1 and s2==0:
        u= f3(a, b, c)
    elif s1==1 and s2==1:
        u= f4(a, b, c)
    else:
        u='Error'
        return u
exec(input().strip()) # DON'T remove this line
# 1642141, 2022-09-24 10:34:56, --xx[--][-x-x] (0%)

def f1(a, b, c):

    x=0
    if int(a)<0:
        a=1000
    elif int(b)<0:
        b=1000
    elif int(c)<0:
        c=1000
    x+=min(a,b,c)
    return x
def f2(a, b, c):
    y=0
    if int(a)>0:
        a= -1000
    elif int(b)>0:
        b= -1000
    elif int(c)>0:
        c= -1000
    y+=max(a,b,c)
    return y
def f3(a, b, c):

    k=int(a)+int(b)+int(c)
    u=abs(k)
    l=u[0]
    return l
def f4(a, b, c):
    t=int(a)+int(b)+int(c)
    p=abs(t)
    r=p[-1]
    return r

def main():

    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1==0 and s2==0:
        u= f1(a, b, c)
    elif s1==0 and s2==1:
        u= f2(a, b, c)
    elif s1==1 and s2==0:
        u= f3(a, b, c)
    elif s1==1 and s2==1:
        u= f4(a, b, c)
    else:
        u='Error'
        return u
exec(input().strip()) # DON'T remove this line
# 1642279, 2022-09-24 10:36:49, --PP[--][----] (33%)

def f1(a, b, c):

    x=0
    if int(a)<0:
        a=1000
    elif int(b)<0:
        b=1000
    elif int(c)<0:
        c=1000
    x+=min(a,b,c)
    return x
def f2(a, b, c):
    y=0
    if int(a)>0:
        a= -1000
    elif int(b)>0:
        b= -1000
    elif int(c)>0:
        c= -1000
    y+=max(a,b,c)
    return y
def f3(a, b, c):

    k=int(a)+int(b)+int(c)
    u=str(abs(k))
    l=int(u[0])
    return l
def f4(a, b, c):
    t=int(a)+int(b)+int(c)
    p=str(abs(t))
    r=int(p[-1])
    return r

def main():

    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1==0 and s2==0:
        u= f1(a, b, c)
    elif s1==0 and s2==1:
        u= f2(a, b, c)
    elif s1==1 and s2==0:
        u= f3(a, b, c)
    elif s1==1 and s2==1:
        u= f4(a, b, c)
    else:
        u='Error'
        return u
exec(input().strip()) # DON'T remove this line

6430142021
# 1640911, 2022-09-24 10:10:12, -xxx[xx][xxxx] (0%)

def f1(a, b, c):
    if a>0 or b>0 or c>0:
        if a<b<c:
            return a
        elif b<a<c:
            return b
        elif c<a<b:
            return c
            
exec(input().strip()) # DON'T remove this line
# 1641225, 2022-09-24 10:18:07, -xxP[xx][xxxx] (17%)

def f1(a, b, c):
    if a>0 or b>0 or c>0:
        if a<b<c:
            return a
        elif b<a<c:
            return b
        elif c<a<b:
            return c
            
def f4(a, b, c):
    s = a+b+c
    s = abs(s)
    return s%10            
            
exec(input().strip()) # DON'T remove this line
# 1641242, 2022-09-24 10:18:25, -xx-[xx][xxxx] (0%)

def f1(a, b, c):
    if a>0 or b>0 or c>0:
        if a<b<c:
            return a
        elif b<a<c:
            return b
        elif c<a<b:
            return c
            
def f4(a, b, c):
    s = a+b+c
    s = abs(s)
    return s%1000            
            
exec(input().strip()) # DON'T remove this line
# 1641252, 2022-09-24 10:18:35, -xx-[xx][xxxx] (0%)

def f1(a, b, c):
    if a>0 or b>0 or c>0:
        if a<b<c:
            return a
        elif b<a<c:
            return b
        elif c<a<b:
            return c
            
def f4(a, b, c):
    s = a+b+c
    s = abs(s)
    return s%100            
            
exec(input().strip()) # DON'T remove this line
# 1641255, 2022-09-24 10:18:45, -xxP[xx][xxxx] (17%)

def f1(a, b, c):
    if a>0 or b>0 or c>0:
        if a<b<c:
            return a
        elif b<a<c:
            return b
        elif c<a<b:
            return c
            
def f4(a, b, c):
    s = a+b+c
    s = abs(s)
    return s%10            
            
exec(input().strip()) # DON'T remove this line
# 1641676, 2022-09-24 10:26:45, -xx-[xx][xxxx] (0%)

def f1(a, b, c):
    if a>0 or b>0 or c>0:
        if a<b<c:
            return a
        elif b<a<c:
            return b
        elif c<a<b:
            return c
            
def f4(a, b, c):
    s = a+b+c
    s = abs(s)    
    x = str(s)
    x = x[:-1:-1]
    return x            
            
exec(input().strip()) # DON'T remove this line
# 1641684, 2022-09-24 10:27:00, -xx-[xx][xxxx] (0%)

def f1(a, b, c):
    if a>0 or b>0 or c>0:
        if a<b<c:
            return a
        elif b<a<c:
            return b
        elif c<a<b:
            return c
            
def f4(a, b, c):
    s = a+b+c
    s = abs(s)    
    x = str(s)
    x = x[::-1]
    return x            
            
exec(input().strip()) # DON'T remove this line
# 1641705, 2022-09-24 10:27:23, -xxP[xx][xxxx] (17%)

def f1(a, b, c):
    if a>0 or b>0 or c>0:
        if a<b<c:
            return a
        elif b<a<c:
            return b
        elif c<a<b:
            return c
            
def f4(a, b, c):
    s = a+b+c
    s = abs(s)
    return s%10           
            
exec(input().strip()) # DON'T remove this line
# 1641718, 2022-09-24 10:27:42, -x-P[xx][xxxx] (17%)

def f1(a, b, c):
    if a>0 or b>0 or c>0:
        if a<b<c:
            return a
        elif b<a<c:
            return b
        elif c<a<b:
            return c
def f3(a, b, c):
    s = a+b+c
    s = abs(s)
    x = str(s)
    x = x[:1]
    return x
    
def f4(a, b, c):
    s = a+b+c
    s = abs(s)
    return s%10           
            
exec(input().strip()) # DON'T remove this line
# 1641770, 2022-09-24 10:28:38, -xxP[xx][xxxx] (17%)

def f1(a, b, c):
    if a>0 or b>0 or c>0:
        if a<b<c:
            return a
        elif b<a<c:
            return b
        elif c<a<b:
            return c

    
def f4(a, b, c):
    s = a+b+c
    s = abs(s)
    return s%10           
            
exec(input().strip()) # DON'T remove this line
# 1641809, 2022-09-24 10:29:21, -xPP[xx][xxxx] (33%)

def f1(a, b, c):
    if a>0 or b>0 or c>0:
        if a<b<c:
            return a
        elif b<a<c:
            return b
        elif c<a<b:
            return c
def f3(a, b, c):
    s = a+b+c
    s = abs(s)
    x = str(s)
    x = x[:1]
    return int(x)
    
def f4(a, b, c):
    s = a+b+c
    s = abs(s)
    return s%10           
            
exec(input().strip()) # DON'T remove this line
# 1641921, 2022-09-24 10:31:03, -xPP[xx][xxxx] (33%)

def f1(a, b, c):
    if a>0 or b>0 or c>0:
        if a<b<c:
            return a
        elif b<a<c:
            return b
        elif c<a<b:
            return c
def f3(a, b, c):
    s = a+b+c
    s = abs(s)
    x = str(s)
    x = x[:1]
    return int(x)
    
def f4(a, b, c):
    s = a+b+c
    s = abs(s)    
    x = str(s)
    x = x[-1:-2:-1]
    return int(x)           
            
exec(input().strip()) # DON'T remove this line
# 1642207, 2022-09-24 10:35:52, xxPP[xx][xxxx] (33%)


def f3(a, b, c):
    s = a+b+c
    s = abs(s)
    x = str(s)
    x = x[:1]
    return int(x)
    
def f4(a, b, c):
    s = a+b+c
    s = abs(s)    
    x = str(s)
    x = x[-1:-2:-1]
    return int(x)           
            
exec(input().strip()) # DON'T remove this line

6530167821
# 1639555, 2022-09-24 09:33:21, ----[--][----] (0%)

import math
def f1(a, b, c):
    x = [a,b,c]
    x.sort()
    for e in x :
        if e <0 :
            x.remove(e)
    return x[0]

def f2(a, b, c):
    x = [a,b,c]
    x.sort(reverse = True)
    for e in x :
        if e >= 0 :
            x.remove(e)
    return x[0]

def f3(a, b, c):
    sum_abc = abs(a+b+c)
    if 10 <=abs(sum_abc) <= 99 :
        sum_abc //= 10
    elif 100 <=abs(sum_abc) <= 999 :
        sum_abc //= 10**2
    elif 1000 <=abs(sum_abc) <= 9999 :
        sum_abc //= 10**3
    return sum_abc

def f4(a, b, c):
    sum_abc = list(str(abs(a+b+c)))
    sum_abc.sort(reverse= True)
    return int(sum_abc[0])

def main():
    s1,s2,a,b, c  = (int (e) for e in input().split())
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print("Error")
# 1639567, 2022-09-24 09:33:41, ----[PP][PPPP] (33%)

import math
def f1(a, b, c):
    x = [a,b,c]
    x.sort()
    for e in x :
        if e <0 :
            x.remove(e)
    return x[0]

def f2(a, b, c):
    x = [a,b,c]
    x.sort(reverse = True)
    for e in x :
        if e >= 0 :
            x.remove(e)
    return x[0]

def f3(a, b, c):
    sum_abc = abs(a+b+c)
    if 10 <=abs(sum_abc) <= 99 :
        sum_abc //= 10
    elif 100 <=abs(sum_abc) <= 999 :
        sum_abc //= 10**2
    elif 1000 <=abs(sum_abc) <= 9999 :
        sum_abc //= 10**3
    return sum_abc

def f4(a, b, c):
    sum_abc = list(str(abs(a+b+c)))
    sum_abc.sort(reverse= True)
    return int(sum_abc[0])

def main():
    s1,s2,a,b, c  = (int (e) for e in input().split())
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print("Error")
exec(input().strip()) # DON'T remove this line

# 1639600, 2022-09-24 09:34:28, ----[PP][PPPP] (33%)

import math
def f1(a, b, c):
    x = [a,b,c]
    x.sort()
    for e in x :
        if e <0 :
            x.remove(e)
    return x[0]

def f2(a, b, c):
    x = [a,b,c]
    x.sort(reverse = True)
    for e in x :
        if e >= 0 :
            x.remove(e)
    return x[0]

def f3(a, b, c):
    sum_abc = abs(a+b+c)
    if 10 <=abs(sum_abc) <= 99 :
        sum_abc //= 10
    elif 100 <=abs(sum_abc) <= 999 :
        sum_abc //= 10**2
    elif 1000 <=abs(sum_abc) <= 9999 :
        sum_abc //= 10**3
    return sum_abc

def f4(a, b, c):
    sum_abc = list(str(abs(a+b+c)))
    sum_abc.sort(reverse= True)
    return int(sum_abc[0])

def main():
    s1,s2,a,b, c  = (int (e) for e in input().split())
    if s1 == 0 and s2 == 0 :
        return print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        return print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        return print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        return print(f4(a,b,c))
    else :
        return print("Error")
exec(input().strip()) # DON'T remove this line
# 1641696, 2022-09-24 10:27:11, compilation error (0%)

import math
def f1(a, b, c):
    x = [a,b,c]
    x.sort()
    for e in x :
        if e =<0 :
            x.remove(e)
    return x[0]

def f2(a, b, c):
    x = [a,b,c]
    x.sort(reverse = True)
    for e in x :
        if e >= 0 :
            x.remove(e)
    return x[0]

def f3(a, b, c):
    sum_abc = abs(a+b+c)
    if 10 <=abs(sum_abc) <= 99 :
        sum_abc //= 10
    elif 100 <=abs(sum_abc) <= 999 :
        sum_abc //= 10**2
    elif 1000 <=abs(sum_abc) <= 9999 :
        sum_abc //= 10**3
    return sum_abc

def f4(a, b, c):
    sum_abc = list(str(abs(a+b+c)))
    sum_abc.sort(reverse= True)
    return int(sum_abc[0])

def main():
    s1,s2,a,b, c  = (int (e) for e in input().split())
    if s1 == 0 and s2 == 0 :
        return print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        return print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        return print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        return print(f4(a,b,c))
    else :
        return print("Error")
exec(input().strip()) # DON'T remove this line
# 1641711, 2022-09-24 10:27:31, ----[PP][PPPP] (33%)

import math
def f1(a, b, c):
    x = [a,b,c]
    x.sort()
    for e in x :
        if e <=0 :
            x.remove(e)
    return x[0]

def f2(a, b, c):
    x = [a,b,c]
    x.sort(reverse = True)
    for e in x :
        if e >= 0 :
            x.remove(e)
    return x[0]

def f3(a, b, c):
    sum_abc = abs(a+b+c)
    if 10 <=abs(sum_abc) <= 99 :
        sum_abc //= 10
    elif 100 <=abs(sum_abc) <= 999 :
        sum_abc //= 10**2
    elif 1000 <=abs(sum_abc) <= 9999 :
        sum_abc //= 10**3
    return sum_abc

def f4(a, b, c):
    sum_abc = list(str(abs(a+b+c)))
    sum_abc.sort(reverse= True)
    return int(sum_abc[0])

def main():
    s1,s2,a,b, c  = (int (e) for e in input().split())
    if s1 == 0 and s2 == 0 :
        return print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        return print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        return print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        return print(f4(a,b,c))
    else :
        return print("Error")
exec(input().strip()) # DON'T remove this line
# 1641830, 2022-09-24 10:29:42, compilation error (0%)

import math
def f1(a, b, c):
    x = [a,b,c]
    x.sort()
    for e in x :
        if e =<0 :
            x.remove(e)
    y = x[0]
    return y

def f2(a, b, c):
    x = [a,b,c]
    x.sort(reverse = True)
    for e in x :
        if e >= 0 :
            x.remove(e)
    y = x[0]
    return y

def f3(a, b, c):
    sum_abc = abs(a+b+c)
    if 10 <=abs(sum_abc) <= 99 :
        sum_abc //= 10
    elif 100 <=abs(sum_abc) <= 999 :
        sum_abc //= 10**2
    elif 1000 <=abs(sum_abc) <= 9999 :
        sum_abc //= 10**3
    return sum_abc

def f4(a, b, c):
    sum_abc = list(str(abs(a+b+c)))
    sum_abc.sort(reverse= True)
    x= =int(sum_abc[0])
    return x

def main():
    s1,s2,a,b, c  = (int (e) for e in input().split())
    if s1 == 0 and s2 == 0 :
        return print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        return print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        return print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        return print(f4(a,b,c))
    else :
        return print("Error")
exec(input().strip()) # DON'T remove this line
# 1641861, 2022-09-24 10:30:08, ---x[PP][PPPP] (33%)

import math
def f1(a, b, c):
    x = [a,b,c]
    x.sort()
    for e in x :
        if e <=0 :
            x.remove(e)
    y = x[0]
    return y

def f2(a, b, c):
    x = [a,b,c]
    x.sort(reverse = True)
    for e in x :
        if e >= 0 :
            x.remove(e)
    y = x[0]
    return y

def f3(a, b, c):
    sum_abc = abs(a+b+c)
    if 10 <=abs(sum_abc) <= 99 :
        sum_abc //= 10
    elif 100 <=abs(sum_abc) <= 999 :
        sum_abc //= 10**2
    elif 1000 <=abs(sum_abc) <= 9999 :
        sum_abc //= 10**3
    return sum_abc

def f4(a, b, c):
    sum_abc = list(str(abs(a+b+c)))
    sum_abc.sort(reverse= True)
    x==int(sum_abc[0])
    return x

def main():
    s1,s2,a,b, c  = (int (e) for e in input().split())
    if s1 == 0 and s2 == 0 :
        return print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        return print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        return print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        return print(f4(a,b,c))
    else :
        return print("Error")
exec(input().strip()) # DON'T remove this line
# 1642004, 2022-09-24 10:32:50, ---x[PP][PPPP] (33%)

import math
def f1(a, b, c):
    x = [a,b,c]
    x.sort()
    for e in x :
        if e <=0 :
            x.remove(e)
    y = x[0]
    return y

def f2(a, b, c):
    x = [a,b,c]
    x.sort(reverse = True)
    for e in x :
        if e >= 0 :
            x.remove(e)
    y = x[0]
    return y

def f3(a, b, c):
    sum_abc = abs(a+b+c)
    if 10 <=abs(sum_abc) <= 99 :
        sum_abc //= 10
    elif 100 <=abs(sum_abc) <= 999 :
        sum_abc //= 10**2
    elif 1000 <=abs(sum_abc) <= 9999 :
        sum_abc //= 10**3
    return int(sum_abc)

def f4(a, b, c):
    sum_abc = list(str(abs(a+b+c)))
    sum_abc.sort(reverse= True)
    x==int(sum_abc[0])
    return x

def main():
    s1,s2,a,b, c  = (int (e) for e in input().split())
    if s1 == 0 and s2 == 0 :
        return print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        return print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        return print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        return print(f4(a,b,c))
    else :
        return print("Error")
exec(input().strip()) # DON'T remove this line
# 1642191, 2022-09-24 10:35:39, ----[PP][P-P-] (17%)

import math
def f1(a, b, c):
    x = [a,b,c]
    x.sort()
    for e in x :
        if e <=0 :
            x.remove(e)
    print(x[0])
    return

def f2(a, b, c):
    x = [a,b,c]
    x.sort(reverse = True)
    for e in x :
        if e >= 0 :
            x.remove(e)
    print(x[0])
    return

def f3(a, b, c):
    sum_abc = abs(a+b+c)
    if 10 <=abs(sum_abc) <= 99 :
        sum_abc //= 10
    elif 100 <=abs(sum_abc) <= 999 :
        sum_abc //= 10**2
    elif 1000 <=abs(sum_abc) <= 9999 :
        sum_abc //= 10**3
    return int(sum_abc)

def f4(a, b, c):
    sum_abc = list(str(abs(a+b+c)))
    sum_abc.sort(reverse= True)
    x=int(sum_abc[0])
    return print(x)

def main():
    s1,s2,a,b, c  = (int (e) for e in input().split())
    if s1 == 0 and s2 == 0 :
        return f1(a,b,c)
    elif s1 == 0 and s2 == 1 :
        return f2(a,b,c)
    elif s1 == 1 and s2 == 0 :
        return f3(a,b,c)
    elif s1 == 1 and s2 == 1 :
        return f4(a,b,c)
    else :
        return print("Error")
exec(input().strip()) # DON'T remove this line

6530202021
# 1639861, 2022-09-24 09:41:18, P---[--][----] (17%)

def f1(a, b, c):
    x=[]
    if a>0:
        x.append(a)
    if b>0:
        x.append(b)
    if c>0:
        x.append(c)
    min=x[0]
    for i in range(len(x)-1):
        if x[i]>x[i+1]:
            min=x[i+1]
    return min
        
def f2(a, b, c):
    x=[]
    if a>0:
        x.append(a)
    if b>0:
        x.append(b)
    if c>0:
        x.append(c)
    max=x[0]
    for i in range(len(x)-1):
        if x[i]<x[i+1]:
            max=x[i+1]
    return min
    
def f3(a, b, c):
    x=a+b+c
    x=str(x)
    return x[0]

def f4(a, b, c):
    x=a+b+c
    x=str(x)
    return x[-1]

def main():
    s1,s2,a,b,c=input().split()
    if s1==0 and s2==0:
        return  f1(a, b, c)
    elif s1==0 and s2==1:
        return  f2(a, b, c)
    elif s1==1 and s2==0:
        return  f3(a, b, c)
    elif s1==1 and s2==1:
        return  f4(a, b, c)
    else:
        return 'Error'
    
exec(input().strip())
# 1639963, 2022-09-24 09:44:10, PP--[--][----] (33%)

def f1(a, b, c):
    x=[]
    if a>0:
        x.append(a)
    if b>0:
        x.append(b)
    if c>0:
        x.append(c)
    min=x[0]
    for i in range(len(x)-1):
        if x[i]>x[i+1]:
            min=x[i+1]
    return min
        
def f2(a, b, c):
    x=[]
    if a<0:
        x.append(a)
    if b<0:
        x.append(b)
    if c<0:
        x.append(c)
    max=x[0]
    for i in range(len(x)-1):
        if x[i]<x[i+1]:
            max=x[i+1]
    return max
    
def f3(a, b, c):
    x=a+b+c
    x=abs(x)
    x=str(x)
    return x[0]

def f4(a, b, c):
    x=a+b+c
    x=str(x)
    return x[-1]

def main():
    s1,s2,a,b,c=input().split()
    if s1==0 and s2==0:
        return  f1(a, b, c)
    elif s1==0 and s2==1:
        return  f2(a, b, c)
    elif s1==1 and s2==0:
        return  f3(a, b, c)
    elif s1==1 and s2==1:
        return  f4(a, b, c)
    else:
        return 'Error'
    
exec(input().strip()) # DON'T remove this line
# 1639993, 2022-09-24 09:45:00, PP--[--][----] (33%)

def f1(a, b, c):
    x=[]
    if a>0:
        x.append(a)
    if b>0:
        x.append(b)
    if c>0:
        x.append(c)
    min=x[0]
    for i in range(len(x)-1):
        if x[i]>x[i+1]:
            min=x[i+1]
    return min
        
def f2(a, b, c):
    x=[]
    if a<0:
        x.append(a)
    if b<0:
        x.append(b)
    if c<0:
        x.append(c)
    max=x[0]
    for i in range(len(x)-1):
        if x[i]<x[i+1]:
            max=x[i+1]
    return max
    
def f3(a, b, c):
    x=a+b+c
    x=abs(x)
    x=str(x)
    return x[0]

def f4(a, b, c):
    x=a+b+c
    x=abs(x)
    x=str(x)
    return x[-1]

def main():
    s1,s2,a,b,c=input().split()
    if s1==0 and s2==0:
        return  f1(a, b, c)
    elif s1==0 and s2==1:
        return  f2(a, b, c)
    elif s1==1 and s2==0:
        return  f3(a, b, c)
    elif s1==1 and s2==1:
        return  f4(a, b, c)
    else:
        return 'Error'
    
exec(input().strip()) # DON'T remove this line
# 1640609, 2022-09-24 10:02:26, PP--[--][----] (33%)

def f1(a, b, c):
    x=[]
    if a>0:
        x.append(a)
    if b>0:
        x.append(b)
    if c>0:
        x.append(c)
    min=x[0]
    for i in range(len(x)-1):
        if x[i]>x[i+1]:
            min=x[i+1]
    return min
        
def f2(a, b, c):
    x=[]
    if a<0:
        x.append(a)
    if b<0:
        x.append(b)
    if c<0:
        x.append(c)
    max=x[0]
    for i in range(len(x)-1):
        if x[i]<x[i+1]:
            max=x[i+1]
    return max
    
def f3(a, b, c):
    x=a+b+c
    x=abs(x)
    x=str(x)
    return x[0]

def f4(a, b, c):
    x=a+b+c
    x=abs(x)
    x=str(x)
    return x[-1]

def main():
    k=0
    s1,s2,a,b,c=input().split()
    if s1==0 and s2==0:
        k+=f1(a, b, c)
    elif s1==0 and s2==1:
        k+=f1(a, b, c)

    elif s1==1 and s2==0:
        k+=f1(a, b, c)
 
    elif s1==1 and s2==1:
        k+=f1(a, b, c) 
    else:
        k='Error'
    return k
    
exec(input().strip())

# 1641320, 2022-09-24 10:19:55, PP--[--][----] (33%)

def f1(a, b, c):
    x=[]
    if a>0:
        x.append(a)
    if b>0:
        x.append(b)
    if c>0:
        x.append(c)
    min=x[0]
    for i in range(len(x)-1):
        if x[i]>x[i+1]:
            min=x[i+1]
    return min
        
def f2(a, b, c):
    x=[]
    if a<0:
        x.append(a)
    if b<0:
        x.append(b)
    if c<0:
        x.append(c)
    max=x[0]
    for i in range(len(x)-1):
        if x[i]<x[i+1]:
            max=x[i+1]
    return max
    
def f3(a, b, c):
    x=a+b+c
    x=abs(x)
    x=str(x)
    return x[0]

def f4(a, b, c):
    x=a+b+c
    x=abs(x)
    x=str(x)
    return x[-1]

def main():
    k=0
    s1,s2,a,b,c=input().split()
    print(a,b,c)
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))

    elif s1==1 and s2==0:
        print(f3(a, b, c))
 
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print('Error')
    
    
exec(input().strip())
# 1641723, 2022-09-24 10:27:50, PP--[--][----] (33%)

# quiz_QUIZ
def f1(a, b, c):
    x=[]
    if a>0:
        x.append(a)
    if b>0:
        x.append(b)
    if c>0:
        x.append(c)
    
    return min(x)
        
def f2(a, b, c):
    x=[]
    if a<0:
        x.append(a)
    if b<0:
        x.append(b)
    if c<0:
        x.append(c)
   
    return max(x)
    
def f3(a, b, c):
    x=a+b+c
    x=abs(x)
    x=str(x)
    return x[0]

def f4(a, b, c):
    x=a+b+c
    x=abs(x)
    x=str(x)
    return x[-1]

def main():
    k=0
    s1,s2,a,b,c=input().split()
    print(a,b,c)
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))

    elif s1==1 and s2==0:
        print(f3(a, b, c))
 
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print('Error')
    
    
exec(input().strip())
# 1641772, 2022-09-24 10:28:40, PP--[--][----] (33%)

def f1(a, b, c):
    x=[]
    if a>0:
        x.append(a)
    if b>0:
        x.append(b)
    if c>0:
        x.append(c)
    
    return min(x)
        
def f2(a, b, c):
    x=[]
    if a<0:
        x.append(a)
    if b<0:
        x.append(b)
    if c<0:
        x.append(c)
   
    return max(x)
    
def f3(a, b, c):
    x=a+b+c
    x=abs(x)
    x=str(x)
    return x[0]

def f4(a, b, c):
    x=a+b+c
    x=abs(x)
    x=str(x)
    return x[-1]

def main():
    k=0
    s1,s2,a,b,c=input().split()
    print(a,b,c)
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))

    elif s1==1 and s2==0:
        print(f3(a, b, c))
 
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print('Error')
    
    
exec(input().strip())
# 1641909, 2022-09-24 10:30:53, PP--[--][P-P-] (33%)

def f1(a, b, c):
    x=[]
    if a>0:
        x.append(a)
    if b>0:
        x.append(b)
    if c>0:
        x.append(c)
    
    return min(x)
        
def f2(a, b, c):
    x=[]
    if a<0:
        x.append(a)
    if b<0:
        x.append(b)
    if c<0:
        x.append(c)
   
    return max(x)
    
def f3(a, b, c):
    x=a+b+c
    x=abs(x)
    x=str(x)
    return x[0]

def f4(a, b, c):
    x=a+b+c
    x=abs(x)
    x=str(x)
    return x[-1]

def main():
    k=0
    s1,s2,a,b,c=input().split()
    
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))

    elif s1==1 and s2==0:
        print(f3(a, b, c))
 
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print('Error')
    
    
exec(input().strip())
# 1642303, 2022-09-24 10:37:08, PP--[xx][PxPx] (33%)

def f1(a, b, c):
    x=[]
    if a>0:
        x.append(a)
    if b>0:
        x.append(b)
    if c>0:
        x.append(c)
    
    return min(x)
        
def f2(a, b, c):
    x=[]
    if a<0:
        x.append(a)
    if b<0:
        x.append(b)
    if c<0:
        x.append(c)
   
    return max(x)
    
def f3(a, b, c):
    x=a+b+c
    x=abs(x)
    x=str(x)
    return x[0]

def f4(a, b, c):
    x=a+b+c
    x=abs(x)
    x=str(x)
    return x[-1]

def main():
    
    s1,s2,a,b,c=input().split()
    if s1=='0' and s2=='0':
        print(f1(a, b, c))
    elif s1=='0'and s2=='1':
        print(f2(a, b, c))

    elif s1=='1' and s2=='0':
        print(f3(a, b, c))
 
    elif s1=='1' and s2=='1':
        print(f4(a, b, c))
    else:
        print('Error')
    
    
exec(input().strip())

6531106721
# 1640562, 2022-09-24 10:00:57, ----[--][----] (0%)

def f1(a, b, c):
    -1000<=a<=1000
    -1000<=b<=1000
    -1000<=c<=1000
    a>0 or b>0 or c>0
    a<0 or b<0 or c<0
    if a>0 and b>0 and c<0:
        s=int(min(a,b))
    elif a>0 and c>0 and b<0:
        s=int(min(a,c))
    elif c>0 and b>0 and a<0:
        s=int(min(c,b))
    return s
# 1640572, 2022-09-24 10:01:17, xxxx[xx][xxxx] (0%)

def f1(a, b, c):
    -1000<=a<=1000
    -1000<=b<=1000
    -1000<=c<=1000
    a>0 or b>0 or c>0
    a<0 or b<0 or c<0
    if a>0 and b>0 and c<0:
        s=int(min(a,b))
    elif a>0 and c>0 and b<0:
        s=int(min(a,c))
    elif c>0 and b>0 and a<0:
        s=int(min(c,b))
    return s

exec(input().strip()) # DON'T remove this line
# 1640601, 2022-09-24 10:02:11, xxxx[xx][xxxx] (0%)

def f1(a, b, c):
    -1000<=a<=1000
    -1000<=b<=1000
    -1000<=c<=1000
    if a>0 and b>0 and c<0:
        s=int(min(a,b))
    elif a>0 and c>0 and b<0:
        s=int(min(a,c))
    elif c>0 and b>0 and a<0:
        s=int(min(c,b))
    return s


exec(input().strip()) # DON'T remove this line
# 1641303, 2022-09-24 10:19:35, xx-P[--][P-P-] (17%)

def f1(a, b, c):
    -1000<=a<=1000
    -1000<=b<=1000
    -1000<=c<=1000
    a>0 or b>0 or c>0
    a<0 or b<0 or c<0
    if a>0 and b>0 and c<0:
        s=int(min(a,b))
    elif a>0 and c>0 and b<0:
        s=int(min(a,c))
    elif c>0 and b>0 and a<0:
        s=int(min(c,b))
    return s
def f2(a, b, c):
    -1000<=a<=1000
    -1000<=b<=1000
    -1000<=c<=1000
    if a<0 and b<0 and c>0:
        s=int(max(a,b))
    elif a<0 and c<0 and b>0:
        s=int(max(a,c))
    elif c<0 and b<0 and a>0:
        s=int(max(c,b))
    return s
def f3(a, b, c):
    -1000<=a<=1000
    -1000<=b<=1000
    -1000<=c<=1000
    sum=a+b+c
    if sum<0:
        sum=-sum
    f=sum//10%10
    return f
def f4(a, b, c):
    -1000<=a<=1000
    -1000<=b<=1000
    -1000<=c<=1000
    sum=a+b+c
    if sum<0:
        sum=-sum
    f=sum%10
    return f
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    -1000<=a<=1000
    -1000<=b<=1000
    -1000<=c<=1000
    if s1==0 and s2==0:
        print (f1(a, b, c))
    if s1==0 and s2==1:
        print(f2(a, b, c))
    if s1==1 and s2==0:
        print(f3(a, b, c))
    if s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line


# 1641403, 2022-09-24 10:21:26, xx-P[--][P-P-] (17%)

def f1(a, b, c):
    -1000<=a<=1000
    -1000<=b<=1000
    -1000<=c<=1000
    if a>0 and b>0 and c<0:
        s=int(min(a,b))
    elif a>0 and c>0 and b<0:
        s=int(min(a,c))
    elif c>0 and b>0 and a<0:
        s=int(min(c,b))
    return s
def f2(a, b, c):
    -1000<=a<=1000
    -1000<=b<=1000
    -1000<=c<=1000
    if a<0 and b<0 and c>0:
        s=int(max(a,b))
    elif a<0 and c<0 and b>0:
        s=int(max(a,c))
    elif c<0 and b<0 and a>0:
        s=int(max(c,b))
    return s
def f3(a, b, c):
    -1000<=a<=1000
    -1000<=b<=1000
    -1000<=c<=1000
    sum=a+b+c
    if sum<0:
        sum=-sum
    f=sum//10%10
    return f
def f4(a, b, c):
    -1000<=a<=1000
    -1000<=b<=1000
    -1000<=c<=1000
    sum=a+b+c
    if sum<0:
        sum=-sum
    f=sum%10
    return f
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    -1000<=a<=1000
    -1000<=b<=1000
    -1000<=c<=1000
    if s1==0 and s2==0:
        print (f1(a, b, c))
    if s1==0 and s2==1:
        print(f2(a, b, c))
    if s1==1 and s2==0:
        print(f3(a, b, c))
    if s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1641466, 2022-09-24 10:22:56, xx-P[PP][P-P-] (33%)

def f1(a, b, c):
    -1000<=a<=1000
    -1000<=b<=1000
    -1000<=c<=1000
    if a>0 and b>0 and c<0:
        s=int(min(a,b))
    elif a>0 and c>0 and b<0:
        s=int(min(a,c))
    elif c>0 and b>0 and a<0:
        s=int(min(c,b))
    return s
def f2(a, b, c):
    -1000<=a<=1000
    -1000<=b<=1000
    -1000<=c<=1000
    if a<0 and b<0 and c>0:
        s=int(max(a,b))
    elif a<0 and c<0 and b>0:
        s=int(max(a,c))
    elif c<0 and b<0 and a>0:
        s=int(max(c,b))
    return s
def f3(a, b, c):
    -1000<=a<=1000
    -1000<=b<=1000
    -1000<=c<=1000
    sum=a+b+c
    if sum<0:
        sum=-sum
    f=sum//10%10
    return f
def f4(a, b, c):
    -1000<=a<=1000
    -1000<=b<=1000
    -1000<=c<=1000
    sum=a+b+c
    if sum<0:
        sum=-sum
    f=sum%10
    return f
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    -1000<=a<=1000
    -1000<=b<=1000
    -1000<=c<=1000
    if s1==0 and s2==0:
        print (f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1641488, 2022-09-24 10:23:28, xx-P[PP][P-P-] (33%)

def f1(a, b, c):
    a>= -1000 and a<=1000
    b>= -1000 and b<=1000
    c>= -1000 and c<=1000
    if a>0 and b>0 and c<0:
        s=int(min(a,b))
    elif a>0 and c>0 and b<0:
        s=int(min(a,c))
    elif c>0 and b>0 and a<0:
        s=int(min(c,b))
    return s
def f2(a, b, c):
    -1000<=a<=1000
    -1000<=b<=1000
    -1000<=c<=1000
    if a<0 and b<0 and c>0:
        s=int(max(a,b))
    elif a<0 and c<0 and b>0:
        s=int(max(a,c))
    elif c<0 and b<0 and a>0:
        s=int(max(c,b))
    return s
def f3(a, b, c):
    -1000<=a<=1000
    -1000<=b<=1000
    -1000<=c<=1000
    sum=a+b+c
    if sum<0:
        sum=-sum
    f=sum//10%10
    return f
def f4(a, b, c):
    -1000<=a<=1000
    -1000<=b<=1000
    -1000<=c<=1000
    sum=a+b+c
    if sum<0:
        sum=-sum
    f=sum%10
    return f
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    -1000<=a<=1000
    -1000<=b<=1000
    -1000<=c<=1000
    if s1==0 and s2==0:
        print (f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1641582, 2022-09-24 10:25:07, compilation error (0%)

def f1(a, b, c):
    a>= -1000 and a<=1000
    b>= -1000 and b<=1000
    c>= -1000 and c<=1000
    if a>0 and b>0 and c<0:
        s=int(min(a,b))
    elif a>0 and c>0 and b<0:
        s=int(min(a,c))
    elif c>0 and b>0 and a<0:
        s=int(min(c,b))
    return s
def f2(a, b, c):
    -1000<=a<=1000
    -1000<=b<=1000
    -1000<=c<=1000
    if a<0 and b<0 and c>0:
        s=int(max(a,b))
    elif a<0 and c<0 and b>0:
        s=int(max(a,c))
    elif c<0 and b<0 and a>0:
        s=int(max(c,b))
    return s
def f3(a, b, c):
    -1000<=a<=1000
    -1000<=b<=1000
    -1000<=c<=1000
    sum=a+b+c
    if sum<0:
        sum=-sum
    f=sum//10%10
    return int(f)
def f4(a, b, c):
    -1000<=a<=1000
    -1000<=b<=1000
    -1000<=c<=1000
    sum=a+b+c
    if sum<0:
        sum=-sum
    f=sum%10
    return in(f)
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    -1000<=a<=1000
    -1000<=b<=1000
    -1000<=c<=1000
    if s1==0 and s2==0:
        print (f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1641589, 2022-09-24 10:25:22, xx-P[PP][P-P-] (33%)

def f1(a, b, c):
    a>= -1000 and a<=1000
    b>= -1000 and b<=1000
    c>= -1000 and c<=1000
    if a>0 and b>0 and c<0:
        s=int(min(a,b))
    elif a>0 and c>0 and b<0:
        s=int(min(a,c))
    elif c>0 and b>0 and a<0:
        s=int(min(c,b))
    return s
def f2(a, b, c):
    -1000<=a<=1000
    -1000<=b<=1000
    -1000<=c<=1000
    if a<0 and b<0 and c>0:
        s=int(max(a,b))
    elif a<0 and c<0 and b>0:
        s=int(max(a,c))
    elif c<0 and b<0 and a>0:
        s=int(max(c,b))
    return s
def f3(a, b, c):
    -1000<=a<=1000
    -1000<=b<=1000
    -1000<=c<=1000
    sum=a+b+c
    if sum<0:
        sum=-sum
    f=sum//10%10
    return int(f)
def f4(a, b, c):
    -1000<=a<=1000
    -1000<=b<=1000
    -1000<=c<=1000
    sum=a+b+c
    if sum<0:
        sum=-sum
    f=sum%10
    return int(f)
def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    -1000<=a<=1000
    -1000<=b<=1000
    -1000<=c<=1000
    if s1==0 and s2==0:
        print (f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line

6531704021
# 1639513, 2022-09-24 09:32:05, ----[--][----] (0%)

def f1(a, b, c):
    if a<0: a=100
    if b<0: b=100
    if c<0: c=100
    return min(a,b,c)

def f2(a, b, c):
    if a>0: a=-100
    if b>0: b=-100
    if c>0: c=-100
    return max(a,b,c)

def f3(a, b, c):
    q=a+b+c
    q=abs(q)
    q=str(q)
    return q[0]

def f4(a, b, c):
    q=a+b+c
    q=abs(q)
    q=str(q)
    return q[-1]

def main():
    q=input().split()
    s1=q[0]
    s2=q[1]
    a=q[2]
    b=q[3]
    c=q[4]
    if s1==0 and s2==0: return f1(a, b, c)
    if s1==0 and s2==1: return f2(a, b, c)
    if s1==1 and s2==0: return f3(a, b, c)
    if s1==1 and s2==1: return f4(a, b, c)
    else: return 'Error'
exec(input().strip()) # DON'T remove this line
# 1639652, 2022-09-24 09:35:45, ----[--][P-P-] (0%)

#02
def f1(a, b, c):
    if a<0: a=100
    if b<0: b=100
    if c<0: c=100
    return min(a,b,c)

def f2(a, b, c):
    if a>0: a=-100
    if b>0: b=-100
    if c>0: c=-100
    return max(a,b,c)

def f3(a, b, c):
    q=a+b+c
    q=abs(q)
    q=str(q)
    return q[0]

def f4(a, b, c):
    q=a+b+c
    q=abs(q)
    q=str(q)
    return q[-1]

def main():
    q=input().split()
    s1=q[0]
    s2=q[1]
    a=q[2]
    b=q[3]
    c=q[4]
    if s1==0 and s2==0: print(f1(a, b, c))
    elif s1==0 and s2==1: print(f2(a, b, c))
    elif s1==1 and s2==0: print(f3(a, b, c))
    elif s1==1 and s2==1: print(f4(a, b, c))
    else: print('Error')
exec(input().strip()) # DON'T remove this line
# 1641073, 2022-09-24 10:14:26, ----[PP][PPPP] (33%)

#02
def f1(a, b, c):
    if a<0: a=100
    if b<0: b=100
    if c<0: c=100
    return min(a,b,c)

def f2(a, b, c):
    if a>0: a=-100
    if b>0: b=-100
    if c>0: c=-100
    return max(a,b,c)

def f3(a, b, c):
    q=a+b+c
    q=abs(q)
    q=str(q)
    return q[0]

def f4(a, b, c):
    q=int(a)+int(b)+int(c)
    q=abs(q)
    q=str(q)
    return q[-1]

def main():
    q=input().split()
    s1=int(q[0])
    s2=int(q[1])
    a=int(q[2])
    b=int(q[3])
    c=int(q[4])
    if s1==0 and s2==0: print(f1(a, b, c))
    elif s1==0 and s2==1: print(f2(a, b, c))
    elif s1==1 and s2==0: print(f3(a, b, c))
    elif s1==1 and s2==1: print(f4(a, b, c))
    elif s1!=0 or s1!=1 and s2!=0 or s2!=1: print('Error')
exec(input().strip()) # DON'T remove this line
# 1641126, 2022-09-24 10:15:58, ----[PP][PPPP] (33%)

#02
def f1(a, b, c):
    if a<0: a=100000000
    if b<0: b=100000000
    if c<0: c=100000000
    return min(a,b,c)

def f2(a, b, c):
    if a>0: a=-10000000
    if b>0: b=-10000000
    if c>0: c=-10000000
    return max(a,b,c)

def f3(a, b, c):
    q=a+b+c
    q=abs(q)
    q=str(q)
    return q[0]

def f4(a, b, c):
    q=int(a)+int(b)+int(c)
    q=abs(q)
    q=str(q)
    return q[-1]

def main():
    q=input().split()
    s1=int(q[0])
    s2=int(q[1])
    a=int(q[2])
    b=int(q[3])
    c=int(q[4])
    if s1==0 and s2==0: print(f1(a, b, c))
    elif s1==0 and s2==1: print(f2(a, b, c))
    elif s1==1 and s2==0: print(f3(a, b, c))
    elif s1==1 and s2==1: print(f4(a, b, c))
    elif s1!=0 or s1!=1 and s2!=0 or s2!=1: print('Error')
exec(input().strip()) # DON'T remove this line
# 1641189, 2022-09-24 10:17:21, ----[PP][PPPP] (33%)

#02
def f1(a, b, c):
    if a<0: a=1001
    if b<0: b=1001
    if c<0: c=1001
    return min(a,b,c)

def f2(a, b, c):
    if a>0: a=-1001
    if b>0: b=-1001
    if c>0: c=-1001
    return max(a,b,c)

def f3(a, b, c):
    q=a+b+c
    q=abs(q)
    q=str(q)
    return q[0]

def f4(a, b, c):
    q=int(a)+int(b)+int(c)
    q=abs(q)
    q=str(q)
    return q[-1]

def main():
    q=input().split()
    s1=int(q[0])
    s2=int(q[1])
    a=int(q[2])
    b=int(q[3])
    c=int(q[4])
    if s1==0 and s2==0: print(f1(a, b, c))
    elif s1==0 and s2==1: print(f2(a, b, c))
    elif s1==1 and s2==0: print(f3(a, b, c))
    elif s1==1 and s2==1: print(f4(a, b, c))
    elif s1!=0 or s1!=1 and s2!=0 or s2!=1: print('Error')
exec(input().strip()) # DON'T remove this line
# 1641207, 2022-09-24 10:17:46, ----[PP][PPPP] (33%)

#02
def f1(a, b, c):
    if a<0: a=1001
    if b<0: b=1001
    if c<0: c=1001
    return min(a,b,c)

def f2(a, b, c):
    if a>0: a=-1001
    if b>0: b=-1001
    if c>0: c=-1001
    return max(a,b,c)

def f3(a, b, c):
    q=a+b+c
    q=abs(q)
    q=str(q)
    return q[0]

def f4(a, b, c):
    q=int(a)+int(b)+int(c)
    q=abs(q)
    q=str(q)
    return q[-1]

def main():
    q=input().split()
    s1=int(q[0])
    s2=int(q[1])
    a=int(q[2])
    b=int(q[3])
    c=int(q[4])
    if s1==0 and s2==0: print(f1(a, b, c))
    elif s1==0 and s2==1: print(f2(a, b, c))
    elif s1==1 and s2==0: print(f3(a, b, c))
    elif s1==1 and s2==1: print(f4(a, b, c))
    else: print('Error')
exec(input().strip()) # DON'T remove this line
# 1641819, 2022-09-24 10:29:31, ----[PP][PPPP] (33%)

#02
def f1(a, b, c):
    if a<0: a=1001
    elif b<0: b=1001
    elif c<0: c=1001
    return min(a,b,c)

def f2(a, b, c):
    if a>0: a=-1001
    elif b>0: b=-1001
    elif c>0: c=-1001
    return max(a,b,c)

def f3(a, b, c):
    q=a+b+c
    q=abs(q)
    q=str(q)
    return q[0]

def f4(a, b, c):
    q=int(a)+int(b)+int(c)
    q=abs(q)
    q=str(q)
    return q[-1]

def main():
    q=input().split()
    s1=int(q[0])
    s2=int(q[1])
    a=int(q[2])
    b=int(q[3])
    c=int(q[4])
    if s1==0 and s2==0: print(f1(a, b, c))
    elif s1==0 and s2==1: print(f2(a, b, c))
    elif s1==1 and s2==0: print(f3(a, b, c))
    elif s1==1 and s2==1: print(f4(a, b, c))
    else: print('Error')
exec(input().strip()) # DON'T remove this line
# 1641896, 2022-09-24 10:30:38, ----[PP][PPPP] (33%)

#02
def f1(a, b, c):
    if a<0: a=1001
    elif b<0: b=1001
    elif c<0: c=1001
    return min(a,b,c)

def f2(a, b, c):
    if a>0: a=-1001
    elif b>0: b=-1001
    elif c>0: c=-1001
    return max(a,b,c)

def f3(a, b, c):
    q=int(a)+int(b)+int(c)
    q=abs(q)
    q=str(q)
    return q[0]

def f4(a, b, c):
    q=int(a)+int(b)+int(c)
    q=abs(q)
    q=str(q)
    return q[-1]

def main():
    q=input().split()
    s1=int(q[0])
    s2=int(q[1])
    a=int(q[2])
    b=int(q[3])
    c=int(q[4])
    if s1==0 and s2==0: print(f1(a, b, c))
    elif s1==0 and s2==1: print(f2(a, b, c))
    elif s1==1 and s2==0: print(f3(a, b, c))
    elif s1==1 and s2==1: print(f4(a, b, c))
    else: print('Error')
exec(input().strip()) # DON'T remove this line
# 1641954, 2022-09-24 10:31:41, ----[PP][PPPP] (33%)

def f1(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    if a<0: a=1001
    if b<0: b=1001
    if c<0: c=1001
    return min(a,b,c)

def f2(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    if a>0: a=-1001
    if b>0: b=-1001
    if c>0: c=-1001
    return max(a,b,c)

def f3(a, b, c):
    q=int(a)+int(b)+int(c)
    q=abs(q)
    q=str(q)
    return q[0]

def f4(a, b, c):
    q=int(a)+int(b)+int(c)
    q=abs(q)
    q=str(q)
    return q[-1]

def main():
    q=input().split()
    s1=int(q[0])
    s2=int(q[1])
    a=int(q[2])
    b=int(q[3])
    c=int(q[4])
    if s1==0 and s2==0: print(f1(a, b, c))
    elif s1==0 and s2==1: print(f2(a, b, c))
    elif s1==1 and s2==0: print(f3(a, b, c))
    elif s1==1 and s2==1: print(f4(a, b, c))
    else: print('Error')
exec(input().strip()) # DON'T remove this line

6530035621
# 1640726, 2022-09-24 10:05:35, --PP[--][P-P-] (33%)

def f1(a, b, c):
    min_x = a
    if a > 0:
        min_x = a
        
    if b >0:
        if b <min_x:
            min_x = b
            
    if c>0:
        if c < min_x:
            min_x = c
    return min_x
    

def f2(a, b, c):
    max_x = a
    if a < 0:
        max_x = a
    
    if b <0:
        if b > max_x:
            max_x = b
        
    if c < 0:
        if c > max_x:
            max_x = c
    return max_x
    
    
def f3(a, b, c):
     x = a+b+c
     x = abs(x)
     x = str(x)
     return int(x[0])


def f4(a, b, c):
    x = a+b+c
    x = abs(x)
    x = str(x)
    return int(x[-1])
    


def main():
    x = [int(e) for e in input().split()]
    if x[0] == 0 and x[1] == 0:
        return f1(x[2], x[3], x[4])
    if x[0] == 0 and x[1] == 1:
        return f2(x[2], x[3], x[4])
    if x[0] == 1 and x[1] == 0:
        return f3(x[2], x[3], x[4])
    if x[0] == 1 and x[1] == 1:
        return f4(x[2], x[3], x[4])
    else:
        print("Error")
    
     
exec(input().strip()) # DON'T remove this line

# 1641652, 2022-09-24 10:26:21, --PP[--][P-P-] (33%)

def f1(a, b, c):
    min_x = a
    if a > 0:
        min_x = a
        
    if b >0:
        if b <min_x:
            min_x = b
            
    if c>0:
        if c < min_x:
            min_x = c
    return min_x
    

def f2(a, b, c):
    max_x = a
    if a < 0:
        max_x = a
    
    if b <0:
        if b > max_x:
            max_x = b
        
    if c < 0:
        if c > max_x:
            max_x = c
    return max_x
    
    
def f3(a, b, c):
     x = a+b+c
     x = abs(x)
     x = str(x)
     return int(x[0])


def f4(a, b, c):
    x = a+b+c
    x = abs(x)
    x = str(x)
    return int(x[-1])
    


def main():
    x = [int(e) for e in input().split()]
    s1 = x[0] 
    s2 =x[1] 
    a =x[2] 
    b =x[3] 
    c =x[4] 
    if x[0] == 0 and x[1] == 0:
        print(f1(a, b, c))
    if x[0] == 0 and x[1] == 1:
        print(f2(a, b, c))
    if x[0] == 1 and x[1] == 0:
        print(f3(a, b, c))
    if x[0] == 1 and x[1] == 1:
        print(f4(a, b, c))
    else:
        print("Error")
    
     
exec(input().strip()) # DON'T remove this line

# 1641732, 2022-09-24 10:27:54, --PP[--][P-P-] (33%)

def f1(a, b, c):
    min_x = a
    if a > 0:
        min_x = a
        
    if b >0:
        if b <min_x:
            min_x = b
            
    if c>0:
        if c < min_x:
            min_x = c
    return min_x
    

def f2(a, b, c):
    max_x = a
    if a < 0:
        max_x = a
    
    if b <0:
        if b > max_x:
            max_x = b
        
    if c < 0:
        if c > max_x:
            max_x = c
    return max_x
    
    
def f3(a, b, c):
     x = a+b+c
     x = abs(x)
     x = str(x)
     return int(x[0])


def f4(a, b, c):
    x = a+b+c
    x = abs(x)
    x = str(x)
    return int(x[-1])
    


def main():
    x = [int(e) for e in input().split()]
    s1 = x[0] 
    s2 =x[1] 
    a =x[2] 
    b =x[3] 
    c =x[4] 
    if x[0] == 0 and x[1] == 0:
        print(int(f1(a, b, c)))
    if x[0] == 0 and x[1] == 1:
        print(int(f2(a, b, c)))
    if x[0] == 1 and x[1] == 0:
        print(int(f3(a, b, c)))
    if x[0] == 1 and x[1] == 1:
        print(int(f4(a, b, c)))
    else:
        print("Error")
    
     
exec(input().strip()) # DON'T remove this line

# 1641793, 2022-09-24 10:29:01, --PP[--][P-P-] (33%)

def f1(a, b, c):
    min_x = a
    if a > 0:
        min_x = a
        
    if b >0:
        if b <min_x:
            min_x = b
            
    if c>0:
        if c < min_x:
            min_x = c
    return int(min_x)
    

def f2(a, b, c):
    max_x = a
    if a < 0:
        max_x = a
    
    if b <0:
        if b > max_x:
            max_x = b
        
    if c < 0:
        if c > max_x:
            max_x = c
    return int(max_x)
    
    
def f3(a, b, c):
     x = a+b+c
     x = abs(x)
     x = str(x)
     return int(x[0])


def f4(a, b, c):
    x = a+b+c
    x = abs(x)
    x = str(x)
    return int(x[-1])
    


def main():
    x = [int(e) for e in input().split()]
    s1 = x[0] 
    s2 =x[1] 
    a =x[2] 
    b =x[3] 
    c =x[4] 
    if x[0] == 0 and x[1] == 0:
        print(int(f1(a, b, c)))
    if x[0] == 0 and x[1] == 1:
        print(int(f2(a, b, c)))
    if x[0] == 1 and x[1] == 0:
        print(int(f3(a, b, c)))
    if x[0] == 1 and x[1] == 1:
        print(int(f4(a, b, c)))
    else:
        print("Error")
    
     
exec(input().strip()) # DON'T remove this line

# 1641815, 2022-09-24 10:29:26, --PP[xx][xxxx] (33%)

def f1(a, b, c):
    min_x = a
    if a > 0:
        min_x = a
        
    if b >0:
        if b <min_x:
            min_x = b
            
    if c>0:
        if c < min_x:
            min_x = c
    return int(min_x)
    

def f2(a, b, c):
    max_x = a
    if a < 0:
        max_x = a
    
    if b <0:
        if b > max_x:
            max_x = b
        
    if c < 0:
        if c > max_x:
            max_x = c
    return int(max_x)
    
    
def f3(a, b, c):
     x = a+b+c
     x = abs(x)
     x = str(x)
     return int(x[0])


def f4(a, b, c):
    x = a+b+c
    x = abs(x)
    x = str(x)
    return int(x[-1])
    



    
     
exec(input().strip()) # DON'T remove this line
# 1641832, 2022-09-24 10:29:43, --PP[--][P-P-] (33%)

def f1(a, b, c):
    min_x = a
    if a > 0:
        min_x = a
        
    if b >0:
        if b <min_x:
            min_x = b
            
    if c>0:
        if c < min_x:
            min_x = c
    return int(min_x)
    

def f2(a, b, c):
    max_x = a
    if a < 0:
        max_x = a
    
    if b <0:
        if b > max_x:
            max_x = b
        
    if c < 0:
        if c > max_x:
            max_x = c
    return int(max_x)
    
    
def f3(a, b, c):
     x = a+b+c
     x = abs(x)
     x = str(x)
     return int(x[0])


def f4(a, b, c):
    x = a+b+c
    x = abs(x)
    x = str(x)
    return int(x[-1])
    


def main():
    x = [int(e) for e in input().split()]
    s1 = x[0] 
    s2 =x[1] 
    a =x[2] 
    b =x[3] 
    c =x[4] 
    if x[0] == 0 and x[1] == 0:
        print(int(f1(a, b, c)))
    if x[0] == 0 and x[1] == 1:
        print(int(f2(a, b, c)))
    if x[0] == 1 and x[1] == 0:
        print(int(f3(a, b, c)))
    if x[0] == 1 and x[1] == 1:
        print(int(f4(a, b, c)))
    else:
        print("Error")
    
     
exec(input().strip()) # DON'T remove this line

# 1641979, 2022-09-24 10:32:15, --PP[--][P-P-] (33%)

def f1(a, b, c):
    min_x = a
    if a > 0:
        min_x = a
        
    if b >0:
        if b <min_x:
            min_x = b
            
    if c>0:
        if c < min_x:
            min_x = c
    return int(min_x)
    

def f2(a, b, c):
    max_x = a
    if a < 0:
        max_x = a
    
    if b <0:
        if b > max_x:
            max_x = b
        
    if c < 0:
        if c > max_x:
            max_x = c
    return int(max_x)
    
    
def f3(a, b, c):
     x = a+b+c
     x = abs(x)
     x = str(x)
     return int(x[0])


def f4(a, b, c):
    x = a+b+c
    x = abs(x)
    x = str(x)
    return int(x[-1])
    


def main():
    x = [int(e) for e in input().split()]
    s1 = x[0] 
    s2 =x[1] 
    a =x[2] 
    b =x[3] 
    c =x[4] 
    if x[0] == 0 and x[1] == 0:
        print(f1(a, b, c))
    if x[0] == 0 and x[1] == 1:
        print(f2(a, b, c))
    if x[0] == 1 and x[1] == 0:
        print(f3(a, b, c))
    if x[0] == 1 and x[1] == 1:
        print(f4(a, b, c))
    else:
        print("Error")
    
     
exec(input().strip()) # DON'T remove this line

# 1642031, 2022-09-24 10:33:16, --PP[--][P-P-] (33%)

def f1(a, b, c):
    min_x = a
    if a > 0:
        min_x = a
        
    if b >0:
        if b <min_x:
            min_x = b
            
    if c>0:
        if c < min_x:
            min_x = c
    return int(min_x)
    

def f2(a, b, c):
    max_x = a
    if a < 0:
        max_x = a
    
    if b <0:
        if b > max_x:
            max_x = b
        
    if c < 0:
        if c > max_x:
            max_x = c
    return int(max_x)
    
    
def f3(a, b, c):
     x = a+b+c
     x = abs(x)
     x = str(x)
     return int(x[0])


def f4(a, b, c):
    x = a+b+c
    x = abs(x)
    x = str(x)
    return int(x[-1])
    


def main():
    x = [int(e) for e in input().split()]
    s1 = x[0] 
    s2 =x[1] 
    a =x[2] 
    b =x[3] 
    c =x[4] 
    if x[0] == 0 and x[1] == 0:
        print(int(f1(a, b, c)))
    if x[0] == 0 and x[1] == 1:
        print(int(f2(a, b, c)))
    if x[0] == 1 and x[1] == 0:
        print(int(f3(a, b, c)))
    if x[0] == 1 and x[1] == 1:
        print(int(f4(a, b, c)))
    else:
        print("Error")
    
     
exec(input().strip()) # DON'T remove this line


6530207221
# 1639679, 2022-09-24 09:36:28, ----[--][----] (0%)

import math as m

def f1(a, b, c):
    l = []
    l.append(a)
    l.append(b)
    l.append(c)
    for i in l :
        if i < 0:
            l.remove(i)
    return int(min(l))

def f2(a, b, c):
    l = []
    l.append(a)
    l.append(b)
    l.append(c)
    for i in l :
        if  i > 0 :
            l.remove(i)
    return int(max(l))

def f3(a, b, c):
    s = a+b+c
    if s < 0 :
        s = s*(-1)
    return int(str(s)[0])

def f4(a, b, c):
    s = a+b+c
    if s < 0 :
        s = s *(-1)
    return int(str(s)[-1])

def main():
    s1,s2,a,b,c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        return f1(a, b, c)
    elif s1 == 0 and s2 == 1 :
        return f2(a, b, c)
    elif s1 == 1 and s2 == 0 :
        return f3(a, b, c)
    elif s1 == 1 and s2 == 1 :
         return f4(a, b, c)
    else :
        out = "Error"
        return out
        
# 1639714, 2022-09-24 09:37:27, --PP[--][----] (33%)

import math as m

def f1(a, b, c):
    l = []
    l.append(a)
    l.append(b)
    l.append(c)
    for i in l :
        if i < 0:
            l.remove(i)
    return int(min(l))

def f2(a, b, c):
    l = []
    l.append(a)
    l.append(b)
    l.append(c)
    for i in l :
        if  i > 0 :
            l.remove(i)
    return int(max(l))

def f3(a, b, c):
    s = a+b+c
    if s < 0 :
        s = s*(-1)
    return int(str(s)[0])

def f4(a, b, c):
    s = a+b+c
    if s < 0 :
        s = s *(-1)
    return int(str(s)[-1])

def main():
    s1,s2,a,b,c = [int(x) for x in input().split()]
    if s1 == 0 and s2 == 0:
        return f1(a, b, c)
    elif s1 == 0 and s2 == 1 :
        return f2(a, b, c)
    elif s1 == 1 and s2 == 0 :
        return f3(a, b, c)
    elif s1 == 1 and s2 == 1 :
         return f4(a, b, c)
    else :
        out = "Error"
        return out
        
exec(input().strip()) # DON'T remove this line
# 1641250, 2022-09-24 10:18:32, --PP[--][----] (33%)

def f1(a, b, c):
    l = []
    l.append(a)
    l.append(b)
    l.append(c)
    for i in l :
        if i < 0:
            l.remove(i)
    out = int(min(l))
    return out

def f2(a, b, c):
    l = []
    l.append(a)
    l.append(b)
    l.append(c)
    for i in l :
        if  i > 0 :
            l.remove(i)
    out = int(max(l))
    return out

def f3(a, b, c):
    s = a+b+c
    if s < 0 :
        s = s*(-1)
    out = int(str(s)[0])
    return out

def f4(a, b, c):
    s = a+b+c
    if s < 0 :
        s = s *(-1)
    out = int(str(s)[-1])
    return out
def main() :
    s1 , s2 , a,b,c = input().split()
    if s1 == "0" and s2 == "0":
        a , b , c = int(a) ,int(b),int(c)
        return f1(a, b, c)
    if s1 == "0" and s2 == "1":
        a , b , c = int(a) ,int(b),int(c)
        return f2(a, b, c)
    if s1 == "1" and s2 == "0":
        a , b , c = int(a) ,int(b),int(c)
        return f3(a, b, c)
    if s1 == "1" and s2 == "1":
        a , b , c = int(a) ,int(b),int(c)
        return f4(a, b, c)
    else :
        return "Error"
exec(input().strip()) # DON'T remove this line        
# 1641952, 2022-09-24 10:31:39, --PP[--][----] (33%)

def f1(a, b, c):
    l = []
    l.append(a)
    l.append(b)
    l.append(c)
    m = l[0]
    for i in range(len(l)):
        if l[i] < m and l[i] > 0:
            m = l[i]
        else :
            pass
    return m

def f2(a, b, c):
    l = []
    l.append(a)
    l.append(b)
    l.append(c)
    for i in l :
        if  i > 0 :
            l.remove(i)
    out = int(max(l))
    return out

def f3(a, b, c):
    s = a+b+c
    if s < 0 :
        s = s*(-1)
    out = int(str(s)[0])
    return out

def f4(a, b, c):
    s = a+b+c
    if s < 0 :
        s = s *(-1)
    out = int(str(s)[-1])
    return out
def main() :
    s1 , s2 , a,b,c = [int(a) for a  in input().split()]
    if s1 == 0 and s2 == 0:
        return f1(a, b, c)
    if s1 == 0 and s2 == 1:
        return f2(a, b, c)
    if s1 == 1 and s2 == 0:
        return f3(a, b, c)
    if s1 == 1 and s2 == 1:
        return f4(a, b, c)
    else :
        return "Error"
exec(input().strip()) # DON'T remove this line        
# 1642016, 2022-09-24 10:32:59, --PP[--][----] (33%)

def f1(a, b, c):
    l = []
    l.append(a)
    l.append(b)
    l.append(c)
    m = l[0]
    for i in range(len(l)):
        if l[i] < m and l[i] > 0:
            m = l[i]
        else :
            pass
    return m

def f2(a, b, c):
    l = []
    l.append(a)
    l.append(b)
    l.append(c)
    m = l[0]
    for i in range(len(l)):
        if l[i] > m and l[i] < 0:
            m = l[i]
        else :
            pass
    return m

def f3(a, b, c):
    s = a+b+c
    if s < 0 :
        s = s*(-1)
    out = int(str(s)[0])
    return out

def f4(a, b, c):
    s = a+b+c
    if s < 0 :
        s = s *(-1)
    out = int(str(s)[-1])
    return out
def main() :
    s1 , s2 , a,b,c = [int(a) for a  in input().split()]
    if s1 == 0 and s2 == 0:
        return f1(a, b, c)
    if s1 == 0 and s2 == 1:
        return f2(a, b, c)
    if s1 == 1 and s2 == 0:
        return f3(a, b, c)
    if s1 == 1 and s2 == 1:
        return f4(a, b, c)
    else :
        return "Error"
exec(input().strip()) # DON'T remove this line        
# 1642283, 2022-09-24 10:36:55, ----[--][----] (0%)

def f1(a, b, c):
    l = []
    l.append(a)
    l.append(b)
    l.append(c)
    m = l[0]
    for i in range(len(l)):
        if l[i] < m and l[i] > 0:
            m = l[i]
        else :
            pass
    return m

def f2(a, b, c):
    l = []
    l.append(a)
    l.append(b)
    l.append(c)
    m = l[0]
    for i in range(len(l)):
        if l[i] > m and l[i] < 0:
            m = l[i]
        else :
            pass
    return m

def f3(a, b, c):
    s = a+b+c
    s = str(s)
    if s[0] == "-":
        return s[1]
    else :
        return s[0]
    
def f4(a, b, c):
    s = a+b+c
    s = str(s)
    if s[0] == "-":
        return s[-1]
    else :
        return s[-1]

def main() :
    s1 , s2 , a,b,c = [int(a) for a  in input().split()]
    if s1 == 0 and s2 == 0:
        return f1(a, b, c)
    if s1 == 0 and s2 == 1:
        return f2(a, b, c)
    if s1 == 1 and s2 == 0:
        return f3(a, b, c)
    if s1 == 1 and s2 == 1:
        return f4(a, b, c)
    else :
        return "Error"
exec(input().strip()) # DON'T remove this line        
# 1642324, 2022-09-24 10:37:23, ---P[--][----] (17%)

def f1(a, b, c):
    l = []
    l.append(a)
    l.append(b)
    l.append(c)
    m = l[0]
    for i in range(len(l)):
        if l[i] < m and l[i] > 0:
            m = l[i]
        else :
            pass
    return m

def f2(a, b, c):
    l = []
    l.append(a)
    l.append(b)
    l.append(c)
    m = l[0]
    for i in range(len(l)):
        if l[i] > m and l[i] < 0:
            m = l[i]
        else :
            pass
    return m

def f3(a, b, c):
    s = a+b+c
    s = str(s)
    if s[0] == "-":
        return s[1]
    else :
        return s[0]
    
def f4(a, b, c):
    s = a+b+c
    if s < 0 :
        s = s *(-1)
    out = int(str(s)[-1])
    return out
def main() :
    s1 , s2 , a,b,c = [int(a) for a  in input().split()]
    if s1 == 0 and s2 == 0:
        return f1(a, b, c)
    if s1 == 0 and s2 == 1:
        return f2(a, b, c)
    if s1 == 1 and s2 == 0:
        return f3(a, b, c)
    if s1 == 1 and s2 == 1:
        return f4(a, b, c)
    else :
        return "Error"
exec(input().strip()) # DON'T remove this line        
# 1642391, 2022-09-24 10:38:11, ---P[--][----] (17%)

def f1(a, b, c):
    l = []
    l.append(a)
    l.append(b)
    l.append(c)
    m = l[0]
    for i in range(len(l)):
        if l[i] < m and l[i] > 0:
            m = l[i]
        else :
            pass
    return m

def f2(a, b, c):
    l = []
    l.append(a)
    l.append(b)
    l.append(c)
    m = l[0]
    for i in range(len(l)):
        if l[i] > m and l[i] < 0:
            m = l[i]
        else :
            pass
    return m

def f3(a, b, c):
    s = a+b+c
    s = str(s)
    if s[0] == "-":
        return s[1]
    else :
        return s[0]
    
def f4(a, b, c):
    s = a+b+c
    if s < 0 :
        s = s *(-1)
    out = int(str(s)[-1])
    return out
def main() :
    s1 , s2 , a,b,c = [int(a) for a  in input().split()]
    if s1 == 0 and s2 == 0:
        return f1(a, b, c)
    if s1 == 0 and s2 == 1:
        return f2(a, b, c)
    if s1 == 1 and s2 == 0:
        return f3(a, b, c)
    if s1 == 1 and s2 == 1:
        return f4(a, b, c)
    else :
        return "Error"
exec(input().strip()) # DON'T remove this line        

6530046521
# 1639728, 2022-09-24 09:37:54, PP--[--][P-P-] (33%)

def f1(a, b, c):
    more = []
    a = int(a)
    b = int(b)
    c = int(c)
    if a > 0:
        more.append(a)
    if b > 0:
        more.append(b)
    if c > 0:
        more.append(c)
    result = int(min(more))
    return result

def f2(a, b, c):
    less = []
    a = int(a)
    b = int(b)
    c = int(c)
    if a < 0:
        less.append(a)
    if b < 0:
        less.append(b)
    if c < 0:
        less.append(c)
    result = int(max(less))
    return result
    
def f3(a, b, c):
    x = [a, b, c]
    sum_in = abs(sum(x))
    sum_in = str(sum_in)
    c = sum_in[0]
    return c
    
def f4(a, b, c):
    x = [a, b, c]
    sum_in = abs(sum(x))
    sum_in = str(sum_in)
    c = sum_in[-1]
    return c
    
def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line
# 1639883, 2022-09-24 09:41:48, PP--[--][P-P-] (33%)

def f1(a, b, c):
    more = []
    a = int(a)
    b = int(b)
    c = int(c)
    if a > 0:
        more.append(a)
    if b > 0:
        more.append(b)
    if c > 0:
        more.append(c)
    result = int(min(more))
    return result

def f2(a, b, c):
    less = []
    a = int(a)
    b = int(b)
    c = int(c)
    if a < 0:
        less.append(a)
    if b < 0:
        less.append(b)
    if c < 0:
        less.append(c)
    result = int(max(less))
    return result
    
def f3(a, b, c):
    x = [a, b, c]
    sum_in = abs(sum(x))
    sum_in = str(int(sum_in))
    c = sum_in[0]
    return c
    
def f4(a, b, c):
    x = [a, b, c]
    sum_in = abs(sum(x))
    sum_in = str(int(sum_in))
    c = sum_in[-1]
    return c
    
def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c)
)
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c)
)
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c)
)
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c)
)
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line
# 1640363, 2022-09-24 09:55:48, PP--[--][P-P-] (33%)

def f1(a, b, c):
    more = []
    if a > 0:
        more.append(a)
    if b > 0:
        more.append(b)
    if c > 0:
        more.append(c)
    result = int(min(more))
    return result

def f2(a, b, c):
    less = []
    if a < 0:
        less.append(a)
    if b < 0:
        less.append(b)
    if c < 0:
        less.append(c)
    result = int(max(less))
    return result
    
def f3(a, b, c):
    x = [a, b, c]
    sum_in = abs(sum(x))
    sum_in = str(int(sum_in))
    c = sum_in[0]
    return c
    
def f4(a, b, c):
    x = [a, b, c]
    sum_in = abs(sum(x))
    sum_in = str(int(sum_in))
    c = sum_in[-1]
    return c
    
def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c)
)
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c)
)
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c)
)
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c)
)
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line
# 1640441, 2022-09-24 09:57:54, PP--[--][P-P-] (33%)

def f1(a, b, c):
    more = []
    if a > 0:
        more.append(a)
    if b > 0:
        more.append(b)
    if c > 0:
        more.append(c)
    result = int(min(more))
    return result

def f2(a, b, c):
    less = []
    if a < 0:
        less.append(a)
    if b < 0:
        less.append(b)
    if c < 0:
        less.append(c)
    result = int(max(less))
    return result
    
def f3(a, b, c):
    x = [a, b, c]
    sum_in = abs(sum(x))
    sum_in = str(int(sum_in))
    t = sum_in[0]
    return t
    
def f4(a, b, c):
    x = [a, b, c]
    sum_in = abs(sum(x))
    sum_in = str(int(sum_in))
    t = sum_in[-1]
    return t
    
def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c)
)
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c)
)
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c)
)
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c)
)
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line
# 1640519, 2022-09-24 09:59:41, PP--[--][P-P-] (33%)

def f1(a, b, c):
    more = []
    if a > 0:
        more.append(a)
    if b > 0:
        more.append(b)
    if c > 0:
        more.append(c)
    result = int(min(more))
    return result

def f2(a, b, c):
    less = []
    if a < 0:
        less.append(a)
    if b < 0:
        less.append(b)
    if c < 0:
        less.append(c)
    result = int(max(less))
    return result
    
def f3(a, b, c):
    x = [a, b, c]
    sum_in = abs(sum(x))
    sum_in = str(int(sum_in))
    result = sum_in[0]
    return result
    
def f4(a, b, c):
    x = [a, b, c]
    sum_in = abs(sum(x))
    sum_in = str(int(sum_in))
    result = sum_in[-1]
    return result
    
def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line
# 1642358, 2022-09-24 10:37:42, PP--[--][P-P-] (33%)

def f1(a, b, c):
    more = []
    if a > 0:
        more.append(a)
    if b > 0:
        more.append(b)
    if c > 0:
        more.append(c)
    result = min(more)
    return int(result)

def f2(a, b, c):
    less = []
    if a < 0:
        less.append(a)
    if b < 0:
        less.append(b)
    if c < 0:
        less.append(c)
    result = max(less)
    return int(result)
    
def f3(a, b, c):
    x = [a, b, c]
    sum_in = abs(sum(x))
    sum_in = str(int(sum_in))
    result = sum_in[0]
    return result
    
def f4(a, b, c):
    x = [a, b, c]
    sum_in = abs(sum(x))
    sum_in = str(int(sum_in))
    result = sum_in[-1]
    return result
    
def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line
# 1642426, 2022-09-24 10:38:34, PP--[--][P-P-] (33%)

def f1(a, b, c):
    more = []
    if a > 0:
        more.append(a)
    if b > 0:
        more.append(b)
    if c > 0:
        more.append(c)
    result = min(more)
    return int(result)

def f2(a, b, c):
    less = []
    if a < 0:
        less.append(a)
    if b < 0:
        less.append(b)
    if c < 0:
        less.append(c)
    result = max(less)
    return int(result)
    
def f3(a, b, c):
    x = [a, b, c]
    sum_in = abs(sum(x))
    sum_in1 = str(int(sum_in))
    result = sum_in1[0]
    return result
    
def f4(a, b, c):
    x = [a, b, c]
    sum_in = abs(sum(x))
    sum_in = str(int(sum_in))
    result = sum_in[-1]
    return result
    
def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line

6530098121
# 1640210, 2022-09-24 09:51:11, compilation error (0%)

def f1(a, b, c):
  if a<=0:
    return(min(b,c))
  if b<=0:
    return(min(a,c))
  if c<=0:
    return(min(a,b))
  if a<=0 and b<=0:
    return(c)
  if b<=0 and c<=0:
    return(a)
  if a<=0 and c<=0:
    return(b)

def f2(a, b, c):
  
  
def f3(a, b, c):

def f4(a, b, c):

def main():

exec(input().strip())
# 1640226, 2022-09-24 09:51:29, ----[--][----] (0%)

def f1(a, b, c):
  if a<=0:
    return(min(b,c))
  if b<=0:
    return(min(a,c))
  if c<=0:
    return(min(a,b))
  if a<=0 and b<=0:
    return(c)
  if b<=0 and c<=0:
    return(a)
  if a<=0 and c<=0:
    return(b)


# 1640361, 2022-09-24 09:55:38, ----[--][----] (0%)

def f1(a, b, c):
  if b>=0 and c>=0:
    return(min(b,c))
  if a>=0 and c>=0:
    return(min(a,c))
  if a>=0 and b>=0:
    return(min(a,b))
  if a<=0 and b<=0:
    return(c)
  if b<=0 and c<=0:
    return(a)
  if a<=0 and c<=0:
    return(b)


# 1640945, 2022-09-24 10:10:58, --PP[--][P-P-] (33%)

def f1(a, b, c):
  if b>=0 and c>=0:
    return(min(b,c))
  if a>=0 and c>=0:
    return(min(a,c))
  if a>=0 and b>=0:
    return(min(a,b))
  if a<=0 and b<=0:
    return(c)
  if b<=0 and c<=0:
    return(a)
  if a<=0 and c<=0:
    return(b)

def f2(a, b, c):
  if b<=0 and c<=0:
    return(max(b,c))
  if a<=0 and c<=0:
    return(max(a,c))
  if a<=0 and b<=0:
    return(max(a,b))
  if a>=0 and b>=0:
    return(c)
  if b>=0 and c>=0:
    return(a)
  if a>=0 and c>=0:
    return(b)

def f3(a, b, c):
  x = a+b+c
  x = abs(x)
  x = str(x)
  y = x[0]
  y = int(y)
  return(y)

def f4(a, b, c):
  x = a+b+c
  x = abs(x)
  x = str(x)
  y = x[-1]
  y = int(y)
  return(y)

def main():
  s1,s2,a,b,c = [int(e) for e in input().split()]
  if s1==0 and s2==0:
    print(f1(a, b, c))
  if s1==0 and s2==1:
    print(f2(a, b, c))
  if s1==1 and s2==0:
    print(f3(a, b, c))
  if s1==1 and s2==1:
    print(f4(a, b, c))
  else:
    print("Error")

exec(input().strip())
# 1641106, 2022-09-24 10:15:27, --PP[--][P-P-] (33%)

def f1(a, b, c):
  if b>=0 and c>=0:
    return(min(b,c))
  if a>=0 and c>=0:
    return(min(a,c))
  if a>=0 and b>=0:
    return(min(a,b))
  if a<=0 and b<=0:
    return(c)
  if b<=0 and c<=0:
    return(a)
  if a<=0 and c<=0:
    return(b)

def f2(a, b, c):
  if b<=0 and c<=0:
    return(max(b,c))
  if a<=0 and c<=0:
    return(max(a,c))
  if a<=0 and b<=0:
    return(max(a,b))
  if a>=0 and b>=0:
    return(c)
  if b>=0 and c>=0:
    return(a)
  if a>=0 and c>=0:
    return(b)

def f3(a, b, c):
  x = a+b+c
  x = abs(x)
  x = str(x)
  y = x[0]
  y = int(y)
  return(y)

def f4(a, b, c):
  x = a+b+c
  x = abs(x)
  x = str(x)
  y = x[-1]
  y = int(y)
  return(y)

def main():
  s1,s2,a,b,c = [int(e) for e in input().split()]
  if s1==0 and s2==0:
    print(f1(a, b, c))
  if s1==0 and s2==1:
    print(f2(a, b, c))
  if s1==1 and s2==0:
    print(f3(a, b, c))
  if s1==1 and s2==1:
    print(f4(a, b, c))
  else:
    print("Error")

exec(input().strip())
# 1642257, 2022-09-24 10:36:34, --PP[--][P-P-] (33%)

def f1(a, b, c):
  if b>=0 and c>=0:
    return(min(b,c))
  if a>=0 and c>=0:
    return(min(a,c))
  if a>=0 and b>=0:
    return(min(a,b))
  if a<=0 and b<=0:
    return(c)
  if b<=0 and c<=0:
    return(a)
  if a<=0 and c<=0:
    return(b)

def f2(a, b, c):
  if b<=0 and c<=0:
    return(max(b,c))
  if a<=0 and c<=0:
    return(max(a,c))
  if a<=0 and b<=0:
    return(max(a,b))
  if a>=0 and b>=0:
    return(c)
  if b>=0 and c>=0:
    return(a)
  if a>=0 and c>=0:
    return(b)

def f3(a, b, c):
  x = a+b+c
  x = abs(x)
  x = str(x)
  y = x[0]
  y = int(y)
  return(y)

def f4(a, b, c):
  x = a+b+c
  x = abs(x)
  x = str(x)
  y = x[-1]
  y = int(y)
  return(y)

def main():
  s1,s2,a,b,c = [int(e) for e in input().split()]
  if s1==0 and s2==0:
    print(f1(a, b, c))
  if s1==0 and s2==1:
    print(f2(a, b, c))
  if s1==1 and s2==0:
    print(f3(a, b, c))
  if s1==1 and s2==1:
    print(f4(a, b, c))
  else:
    print("Error")

exec(input().strip())
# 1642302, 2022-09-24 10:37:08, --PP[--][P-P-] (33%)

def f1(a, b, c):
  if b>=0 and c>=0:
    return(min(b,c))
  if a>=0 and c>=0:
    return(min(a,c))
  if a>=0 and b>=0:
    return(min(a,b))
  if a<=0 and b<=0:
    return(c)
  if b<=0 and c<=0:
    return(a)
  if a<=0 and c<=0:
    return(b)

def f2(a, b, c):
  if b<=0 and c<=0:
    return(max(b,c))
  if a<=0 and c<=0:
    return(max(a,c))
  if a<=0 and b<=0:
    return(max(a,b))
  if a>=0 and b>=0:
    return(c)
  if b>=0 and c>=0:
    return(a)
  if a>=0 and c>=0:
    return(b)

def f3(a, b, c):
  x = a+b+c
  x = abs(x)
  x = str(x)
  y = x[0]
  y = int(y)
  return(y)

def f4(a, b, c):
  x = a+b+c
  x = abs(x)
  x = str(x)
  y = x[-1]
  y = int(y)
  return(y)

def main():
  s1,s2,a,b,c = [int(e) for e in input().split()]
  if s1==0 and s2==0:
    print(f1(a, b, c))
  if s1==0 and s2==1:
    print(f2(a, b, c))
  if s1==1 and s2==0:
    print(f3(a, b, c))
  if s1==1 and s2==1:
    print(f4(a, b, c))
  else:
    print("Error")

exec(input().strip())

6231129921
# 1640490, 2022-09-24 09:59:13, xxP-[-P][PPPP] (33%)

def f1(a, b, c):
    y = [a,b,c]
    x=[]
    for e in y:
        if e < 0:
            y.remove(e)
        else:
            x.append(e)
    ans = min(x)
    return ans

def f2(a, b, c):
    y = [a,b,c]
    x=[]
    for e in y:
        if e > 0:
            y.remove(e)
        else:
            x.append(e)
    ans = max(x)
    return ans

def f3(a,b,c):
    y = [a,b,c]
    x = str(sum(y))
    z = []
    for e in x:
        z.append(e)
    if z[0] == '-':
        ans = int(z[1])
    else:
        ans = int(z[0])
    return ans

def f4(a,b,c):
    y = [a,b,c]
    x = str(sum(y))
    z = []
    for e in x:
        z.append(e)
    ans = z[-1]
    return ans

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 ==0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 ==1 and s2 ==1:
        print(f4(a, b, c))
    else:
        print('Error')


exec(input().strip()) # DON'T remove this line

# 1640710, 2022-09-24 10:05:11, xxP-[-P][PPPP] (33%)

def f1(a, b, c):
    y = [a,b,c]
    x=[]
    for e in y:
        if e <= 0:
            y.remove(e)
        else:
            x.append(e)
    ans = min(x)
    return ans

def f2(a, b, c):
    y = [a,b,c]
    x=[]
    for e in y:
        if e >= 0:
            y.remove(e)
        else:
            x.append(e)
    ans = max(x)
    return ans

def f3(a,b,c):
    y = [a,b,c]
    x = str(sum(y))
    z = []
    for e in x:
        z.append(e)
    if z[0] == '-':
        ans = int(z[1])
    else:
        ans = int(z[0])
    return ans

def f4(a,b,c):
    y = [a,b,c]
    x = str(sum(y))
    z = []
    for e in x:
        z.append(e)
    ans = z[-1]
    return ans

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 ==0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 ==1 and s2 ==1:
        print(f4(a, b, c))
    else:
        print('Error')


exec(input().strip()) # DON'T remove this line
# 1640887, 2022-09-24 10:09:27, xxx-[-P][PxPx] (0%)

def f1(a, b, c):
    y = [a,b,c]
    x=[]
    for e in y:
        if e < 0:
            y.remove(e)
        else:
            x.append(e)
    ans = min(x)
    return ans

def f2(a, b, c):
    y = [a,b,c]
    x=[]
    for e in y:
        if e > 0:
            y.remove(e)
        else:
            x.append(e)
    ans = max(x)
    return ans

def f3(a,b,c):
    y = [a,b,c]
    x = abs(sum(y))
    strx = str(x)
    ans = int(x[0])
    return ans

def f4(a,b,c):
    y = [a,b,c]
    x = str(sum(y))
    z = []
    for e in x:
        z.append(e)
    ans = z[-1]
    return ans

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 ==0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 ==1 and s2 ==1:
        print(f4(a, b, c))
    else:
        print('Error')

exec(input().strip()) # DON'T remove this line

# 1640903, 2022-09-24 10:10:05, xxP-[-P][PPPP] (33%)

def f1(a, b, c):
    y = [a,b,c]
    x=[]
    for e in y:
        if e < 0:
            y.remove(e)
        else:
            x.append(e)
    ans = min(x)
    return ans

def f2(a, b, c):
    y = [a,b,c]
    x=[]
    for e in y:
        if e > 0:
            y.remove(e)
        else:
            x.append(e)
    ans = max(x)
    return ans

def f3(a,b,c):
    y = [a,b,c]
    x = str(sum(y))
    z = []
    for e in x:
        z.append(e)
    if z[0] == '-':
        ans = int(z[1])
    else:
        ans = int(z[0])
    return ans

def f4(a,b,c):
    y = [a,b,c]
    x = str(sum(y))
    z = []
    for e in x:
        z.append(e)
    ans = z[-1]
    return ans

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 ==0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 ==1 and s2 ==1:
        print(f4(a, b, c))
    else:
        print('Error')

exec(input().strip()) # DON'T remove this line

# 1642035, 2022-09-24 10:33:20, xxP-[-P][PPPP] (33%)

# a,b,c มีทั้งบวกและลบ

def f1(a, b, c):
    y = [a,b,c]
    x=[]
    for e in y:
        if e <= 0:
            y.remove(e)
        else:
            x.append(e)
    ans = int(min(x))
    return ans

def f2(a, b, c):
    y = [a,b,c]
    x=[]
    for e in y:
        if e >= 0:
            y.remove(e)
        else:
            x.append(e)
    ans = max(x)
    return ans

def f3(a,b,c):
    y = [a,b,c]
    x = str(sum(y))
    z = []
    for e in x:
        z.append(e)
    if z[0] == '-':
        ans = int(z[1])
    else:
        ans = int(z[0])
    return ans

def f4(a,b,c):
    y = [a,b,c]
    x = str(sum(y))
    z = []
    for e in x:
        z.append(e)
    ans = z[-1]
    return ans

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 ==0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 ==1 and s2 ==1:
        print(f4(a, b, c))
    else:
        print('Error')

exec(input().strip()) # DON'T remove this line

# 1642385, 2022-09-24 10:38:04, xxP-[-P][PPPP] (33%)

# a,b,c มีทั้งบวกและลบ

def f1(a, b, c):
    y = [a,b,c]
    x=[]
    for e in y:
        if e <= 0:
            y.remove(e)
        else:
            x.append(e)
    ans = int(min(x))
    return ans

def f2(a, b, c):
    y = [a,b,c]
    x=[]
    for e in y:
        if e >= 0:
            y.remove(e)
        else:
            x.append(e)
    ans = int(max(x))
    return ans

def f3(a,b,c):
    y = [a,b,c]
    x = str(sum(y))
    z = []
    for e in x:
        z.append(e)
    if z[0] == '-':
        ans = int(z[1])
    else:
        ans = int(z[0])
    return ans

def f4(a,b,c):
    y = [a,b,c]
    x = str(sum(y))
    ans = x[-1]
    return ans

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 ==0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 ==1 and s2 ==1:
        print(f4(a, b, c))
    else:
        print('Error')

exec(input().strip()) # DON'T remove this line


6530163221
# 1640028, 2022-09-24 09:46:17, compilation error (0%)

def f1(a, b, c):
    if a >= b and a >= c:
        return a
    elif b >= a and b >= c:
        return b
    else c >= a and c >= b:
        return c
    
def f2(a, b, c):
    if a >= b and a >= c and a < 0 :
        return a
    elif b >= a and b >= c and b < 0 :
        return b
    else c >= a and c >= b and c < 0 :
        return c
    
def f3(a, b, c):
    z = a + b + c
    z = str(z)
    return z[0]

def f4(a, b, c):
    z = a + b + c
    z = str(z)
    return z[(len(z)-1)]

def main():
    s1 , s2 , a , b , c = [int(e) for e in input().split]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else :
        print("Error")
        
# 1640098, 2022-09-24 09:48:03, ----[--][----] (0%)

def f1(a, b, c):
    if a >= b and a >= c:
        return a
    elif b >= a and b >= c:
        return b
    elif c >= a and c >= b:
        return c
    
def f2(a, b, c):
    if a >= b and a >= c and a < 0 :
        return a
    elif b >= a and b >= c and b < 0 :
        return b
    elif c >= a and c >= b and c < 0 :
        return c
    
def f3(a, b, c):
    z = a + b + c
    z = str(z)
    return z[0]

def f4(a, b, c):
    z = a + b + c
    z = str(z)
    return z[(len(z)-1)]

def main():
    s1 , s2 , a , b , c = [int(e) for e in input().split]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else :
        print("Error")
# 1640839, 2022-09-24 10:08:13, ----[--][----] (0%)

def f1(a, b, c):
    z = [a, b, c]
    for i in z:
        if i > 0:
            pass
        else:
            z.remove(i)
    return min(z)
    
def f2(a, b, c):
    z = [a, b, c]
    for i in z:
        if i < 0:
            pass
        else:
            z.remove(i)
    return max(z)
    
def f3(a, b, c):
    z = a + b + c
    if z > 0:
        z = str(z)
        return z[0]
    if z < 0:
        z = str(z)
        return z[1]

def f4(a, b, c):
    z = a + b + c
    z = str(z)
    return z[(len(z)-1)]

def main():
    [s1 , s2 , a , b , c] = [int(e) for e in input().split() ]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else :
        print("Error")
        
# 1640983, 2022-09-24 10:12:09, ----[--][----] (0%)

def f1(a, b, c):
    z = [a, b, c]
    for i in z:
        if i > 0:
            pass
        else:
            z.remove(i)
    return min(z)
    
def f2(a, b, c):
    z = [a, b, c]
    for i in z:
        if i < 0:
            pass
        else:
            z.remove(i)
    return max(z)
    
def f3(a, b, c):
    z = a + b + c
    if z > 0:
        z = str(z)
        return z[0]
    if z < 0:
        z = str(z)
        return z[1]

def f4(a, b, c):
    z = a + b + c
    z = str(z)
    return z[(len(z)-1)]

def main():
    [s1 , s2 , a , b , c] = [int(e) for e in input().split() ]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else :
        print("Error")
# 1641013, 2022-09-24 10:12:54, ----[PP][PPPP] (33%)

def f1(a, b, c):
    z = [a, b, c]
    for i in z:
        if i > 0:
            pass
        else:
            z.remove(i)
    return min(z)
    
def f2(a, b, c):
    z = [a, b, c]
    for i in z:
        if i < 0:
            pass
        else:
            z.remove(i)
    return max(z)
    
def f3(a, b, c):
    z = a + b + c
    if z > 0:
        z = str(z)
        return z[0]
    if z < 0:
        z = str(z)
        return z[1]

def f4(a, b, c):
    z = a + b + c
    z = str(z)
    return z[(len(z)-1)]

def main():
    [s1 , s2 , a , b , c] = [int(e) for e in input().split() ]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else :
        print("Error")
        
exec(input().strip()) # DON'T remove this line
# 1642474, 2022-09-24 10:39:10, compilation error (0%)

def f1(a, b, c):
    z = [a, b, c]
    for i in z:
        if i > 0:
            pass
        else:
            z.remove(i)
    for i in z:
        if i < for a in z:
            retun i
    
def f2(a, b, c):
    z = [a, b, c]
    for i in z:
        if i < 0:
            pass
        else:
            z.remove(i)
    for i in z:
        if i > for a in z:
            retun i
    
def f3(a, b, c):
    z = a + b + c
    if z > 0:
        z = str(z)
        return z[0]
    if z < 0:
        z = str(z)
        return z[1]

def f4(a, b, c):
    z = a + b + c
    z = str(z)
    return z[(len(z)-1)]

def main():
    [s1 , s2 , a , b , c] = [int(e) for e in input().split() ]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else :
        print("Error")
        
exec(input().strip()) # DON'T remove this line

6530052221
# 1640021, 2022-09-24 09:46:06, --xx[xx][xxxx] (0%)

def f1(a, b, c):
    d = [a,b,c]
    if a < 0:
        d.remove(a)
    if b < 0:
        d.remove(b)
    if c < 0:
        d.remove(c)
    e = min(d)
def f2(a, b, c):
    d = [a,b,c]
    if a > 0:
        d.remove(a)
    if b > 0:
        d.remove(b)
    if c > 0:
        d.remove(c)
    e = max(d)
def f3(a, b, c):
    d = str(a + b + c)
    e = abs(d[0])
def f4(a, b, c):
    d = str(a + b + c)
    e = abs(d[-1])
def main(a, b, c):
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    else:
        if s1 == 0 and s2 == 1:
            print(f2(a,b,c))
        else:
            if s1 == 1 and s2 == 0:
                print(f3(a,b,c))
            else:
                if s1 == 1 and s2 == 1:
                    print(f4(a,b,c))
                else:
                    print("Error")
exec(input().strip())
# 1640479, 2022-09-24 09:58:59, ----[xx][xxxx] (0%)

def f1(a, b, c):
    d = [a,b,c]
    if a < 0:
        d.remove(a)
    if b < 0:
        d.remove(b)
    if c < 0:
        d.remove(c)
    e = min(d)
    return e
def f2(a, b, c):
    d = [a,b,c]
    if a > 0:
        d.remove(a)
    if b > 0:
        d.remove(b)
    if c > 0:
        d.remove(c)
    e = max(d)
    return e
def f3(a, b, c):
    d = str(a + b + c)
    e = d[0]
    return e
def f4(a, b, c):
    d = str(a + b + c)
    e = d[-1]
    return e
def main(a, b, c):
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    else:
        if s1 == 0 and s2 == 1:
            print(f2(a,b,c))
        else:
            if s1 == 1 and s2 == 0:
                print(f3(a,b,c))
            else:
                if s1 == 1 and s2 == 1:
                    print(f4(a,b,c))
                else:
                    print("Error")
exec(input().strip())
# 1640624, 2022-09-24 10:02:46, ----[PP][PPP-] (17%)

def f1(a, b, c):
    d = [a,b,c]
    if a < 0:
        d.remove(a)
    if b < 0:
        d.remove(b)
    if c < 0:
        d.remove(c)
    e = min(d)
    return e
def f2(a, b, c):
    d = [a,b,c]
    if a > 0:
        d.remove(a)
    if b > 0:
        d.remove(b)
    if c > 0:
        d.remove(c)
    e = max(d)
    return e
def f3(a, b, c):
    d = str(a + b + c)
    e = d[0]
    return e
def f4(a, b, c):
    d = str(a + b + c)
    e = d[-1]
    return e
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    else:
        if s1 == 0 and s2 == 1:
            print(f2(a,b,c))
        else:
            if s1 == 1 and s2 == 0:
                print(f3(a,b,c))
            else:
                if s1 == 1 and s2 == 1:
                    print(f4(a,b,c))
                else:
                    print("Error")
exec(input().strip())
# 1640739, 2022-09-24 10:05:56, ----[PP][PPPP] (33%)

def f1(a, b, c):
    d = [a,b,c]
    if a < 0:
        d.remove(a)
    if b < 0:
        d.remove(b)
    if c < 0:
        d.remove(c)
    e = min(d)
    return e
def f2(a, b, c):
    d = [a,b,c]
    if a > 0:
        d.remove(a)
    if b > 0:
        d.remove(b)
    if c > 0:
        d.remove(c)
    e = max(d)
    return e
def f3(a, b, c):
    d = str(a + b + c)
    e = d[0]
    if e == "-":
        e = d[1]
    return e
def f4(a, b, c):
    d = str(a + b + c)
    e = d[-1]
    return e
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    else:
        if s1 == 0 and s2 == 1:
            print(f2(a,b,c))
        else:
            if s1 == 1 and s2 == 0:
                print(f3(a,b,c))
            else:
                if s1 == 1 and s2 == 1:
                    print(f4(a,b,c))
                else:
                    print("Error")
exec(input().strip())
# 1641171, 2022-09-24 10:16:58, ----[PP][PPPP] (33%)

def f1(a, b, c):
    d = [a,b,c]
    if a < 0:
        d.remove(a)
    if b < 0:
        d.remove(b)
    if c < 0:
        d.remove(c)
    e = min(d)
    return e
def f2(a, b, c):
    d = [a,b,c]
    if a > 0:
        d.remove(a)
    if b > 0:
        d.remove(b)
    if c > 0:
        d.remove(c)
    e = max(d)
    return e
def f3(a, b, c):
    d = str(a + b + c)
    e = d[0]
    if e == "-":
        e = d[1]
    return e
def f4(a, b, c):
    d = str(a + b + c)
    e = d[-1]
    return e
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    else:
        if s1 == 0 and s2 == 1:
            print(f2(a,b,c))
        else:
            if s1 == 1 and s2 == 0:
                print(f3(a,b,c))
            else:
                if s1 == 1 and s2 == 1:
                    print(f4(a,b,c))
                else:
                    print("Error")
exec(input().strip())

6530097521
# 1640237, 2022-09-24 09:51:50, -P--[-P][PPPP] (33%)

def f1(a, b, c):
    d= []
    if a > 0:
        d += [a]
    if b > 0:
        d += [a]
    if c > 0:
        d += [a]
    ans = min(d)
    return ans



def f2(a, b, c):
    d= []
    for i in [a,b,c]:
        if i < 0:
            d += [i]
    ans = max(d)
    return ans
    
def f3(a, b, c):
    n = a+b+c
    if n < 0:
        n *= -1
    return str(n)[0]
    
    
def f4(a, b, c):
    n = a+b+c
    return str(n)[-1]


def main():
    d = [int(e) for e in input().split()]
    s1 = d[0]
    s2 = d[1]
    a = d[2]
    b = d[3]
    c = d[4]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    d = [0,1]
    for i in d:
        if s1 != i and s2 != i:
            print("Error")
            


exec(input().strip()) # DON'T remove this line





# 1641201, 2022-09-24 10:17:35, -P--[-P][-P-P] (17%)

def f1(a, b, c):
    d= []
    if a > 0:
        d += [a]
    if b > 0:
        d += [a]
    if c > 0:
        d += [a]
    ans = min(d)
    return ans



def f2(a, b, c):
    d= []
    for i in [a,b,c]:
        if i < 0:
            d += [i]
    ans = max(d)
    return ans
    
def f3(a, b, c):
    n = a+b+c
    if n < 0:
        n *= -1
    return str(n)[0]
    
    
def f4(a, b, c):
    n = a+b+c
    return str(n)[-1]


def main():
    d = [int(e) for e in input().split()]
    s1 = d[0]
    s2 = d[1]
    a = d[2]
    b = d[3]
    c = d[4]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    if s1 != 1 and s2 != 1 and s1 != 0 and s2 != 0:
        print("Error")
            


exec(input().strip()) # DON'T remove this line





# 1641221, 2022-09-24 10:17:59, -P--[-P][PPPP] (33%)

def f1(a, b, c):
    d= []
    if a > 0:
        d += [a]
    if b > 0:
        d += [a]
    if c > 0:
        d += [a]
    ans = min(d)
    return ans



def f2(a, b, c):
    d= []
    for i in [a,b,c]:
        if i < 0:
            d += [i]
    ans = max(d)
    return ans
    
def f3(a, b, c):
    n = a+b+c
    if n < 0:
        n *= -1
    return str(n)[0]
    
    
def f4(a, b, c):
    n = a+b+c
    return str(n)[-1]


def main():
    d = [int(e) for e in input().split()]
    s1 = d[0]
    s2 = d[1]
    a = d[2]
    b = d[3]
    c = d[4]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    d = [0,1]
    for i in d:
        if s1 != i and s2 != i:
            print("Error")
            


exec(input().strip()) # DON'T remove this line





# 1641794, 2022-09-24 10:29:03, -P--[-P][PPPP] (33%)

def f1(a, b, c):
    d= []
    if a > 0:
        d += [a]
    if b > 0:
        d += [a]
    if c > 0:
        d += [a]
    ans = min(d)
    return ans



def f2(a, b, c):
    d= []
    for i in [a,b,c]:
        if i < 0:
            d += [i]
    ans = max(d)
    return ans
    
def f3(a, b, c):
    n = a+b+c
    if n < 0:
        n *= -1
    return str(n)[0]
    
    
def f4(a, b, c):
    n = a+b+c
    return str(n)[-1]


def main():
    d = [int(e) for e in input().split()]
    s1 = d[0]
    s2 = d[1]
    a = d[2]
    b = d[3]
    c = d[4]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        d = [0,1]
        for i in d:
            if s1 != i and s2 != i:
                print("Error")
            


exec(input().strip()) # DON'T remove this line






6430382221
# 1640936, 2022-09-24 10:10:47, --xP[--][P-Px] (17%)


def f1(a,b,c):
    d =[a,b,c]
    d.sort()
    i =0
    mn = d[i]
    if mn <= 0:
        i +=1
        mn = d[i]
    return int(mn)
def f2(a,b,c):
    d =[a,b,c]
    d.sort()
    i = 2
    mx = d[i]
    if mx >= 0:
        i -=1
        mx = d[i]
    return int(mx)
    
def f3(a,b,c):
    d = int(a) + int(b) + int(c)
    e = str(d)
    return int(e[0])
    
def f4(a,b,c):
    d = int(a) + int(b) + int(c)
    e = str(d)
    f = len(e)
    return int(e[f-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 ==0:
         print ( f1(a, b, c))
    if s1 == 0 and s2 ==1:
         print ( f2(a, b, c))
    if s1 == 1 and s2 ==0:
         print ( f3(a, b, c))
    if s1 == 1 and s2 ==1:
         print ( f4(a, b, c))
    else:
        print('Error')

exec(input().strip()) 
# 1641337, 2022-09-24 10:20:10, --PP[xx][P-P-] (33%)


def f1(a,b,c):
    d =[a,b,c]
    d.sort()
    i =0
    mn = d[i]
    if mn <= 0:
        i +=1
        mn = d[i]
    return int(mn)
def f2(a,b,c):
    d =[a,b,c]
    d.sort()
    i = 2
    mx = d[i]
    if mx >= 0:
        i -=1
        mx = d[i]
    return int(mx)
    
def f3(a,b,c):
    d = int(a) + int(b) + int(c)
    e = str(abs(d))
    return int(e[0])
    
def f4(a,b,c):
    d = int(a) + int(b) + int(c)
    e = str(abs(d))
    f = len(e)
    return int(e[f-1])

def main():
    s1,s2,a,b,c =input().split()
    if int(s1) == 0 and int(s2) ==0:
         print ( f1(a, b, c))
    if int(s1) == 0 and int(s2) ==1:
         print ( f2(a, b, c))
    if int(s1) == 1 and int(s2) ==0:
         print ( f3(a, b, c))
    if int(s1) == 1 and int(s2) ==1:
         print ( f4(a, b, c))
    else:
        print('Error')

exec(input().strip()) 

# 1641499, 2022-09-24 10:23:38, --PP[xx][P-P-] (33%)

def f1(a,b,c):
    d =[a,b,c]
    d.sort()
    i =0
    mn = d[i]
    if mn <= 0:
        i +=1
        mn = d[i]
    return mn
def f2(a,b,c):
    d =[a,b,c]
    d.sort()
    i = 2
    mx = d[i]
    if mx >= 0:
        i -=1
        mx = d[i]
    return int(mx)
    
def f3(a,b,c):
    d = int(a) + int(b) + int(c)
    e = str(abs(d))
    return int(e[0])
    
def f4(a,b,c):
    d = int(a) + int(b) + int(c)
    e = str(abs(d))
    f = len(e)
    return int(e[f-1])

def main():
    s1,s2,a,b,c =input().split()
    if int(s1) == 0 and int(s2) ==0:
         print ( f1(a, b, c))
    if int(s1) == 0 and int(s2) ==1:
         print ( f2(a, b, c))
    if int(s1) == 1 and int(s2) ==0:
         print ( f3(a, b, c))
    if int(s1) == 1 and int(s2) ==1:
         print ( f4(a, b, c))
    else:
        print('Error')

exec(input().strip())

6530009321
# 1641737, 2022-09-24 10:28:00, compilation error (0%)

def f1(a, b, c):
    x = []
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000:
        if a>0:
            x.append(a)​
        if b>0:
            x.append(b)​
        if c>0:
            x.append(c)​
        y = min(x)
    return y
def f2(a, b, c):
    x = []
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000:
        if a<0:
            x.append(a)​
        if b<0:
            x.append(b)​
        if c<0:
            x.append(c)​
        y = max(x)
    return y
def f3(a, b, c):
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000:
        x = a+b+c
            
    return(x[0])
def f4(a, b, c):
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000:
        x = a+b+c
    return(x[-1])
def main():
    t = input().split()
    if t[0] == 0 and t[1] == 0:
        print(f1(a, b, c))
    elif t[0] == 0 and t[1] == 1:
        print(f2(a, b, c))
    elif t[0] == 1 and t[1] == 0:
        print(f1(a, b, c))
    elif t[0] == 1 and t[1] == 1:
        print(f1(a, b, c))
    else:
        print('Error')
print(f1(2, -18, 4))
    
    
    
    
    
    
    
    
    

# 1641841, 2022-09-24 10:29:52, PPxx[--][P-P-] (33%)

def f1(a, b, c):
    x = []
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000:
        if a>0:
            x.append(a)
        if b>0:
            x.append(b)
        if c>0:
            x.append(c)
        y = min(x)
    return y
def f2(a, b, c):
    x = []
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000:
        if a<0:
            x.append(a)
        if b<0:
            x.append(b)
        if c<0:
            x.append(c)
        y = max(x)
    return y
def f3(a, b, c):
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000:
        x = a+b+c
            
    return(x[0])
def f4(a, b, c):
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000:
        x = a+b+c
    return(x[-1])
def main():
    t = input().split()
    if t[0] == 0 and t[1] == 0:
        print(f1(a, b, c))
    elif t[0] == 0 and t[1] == 1:
        print(f2(a, b, c))
    elif t[0] == 1 and t[1] == 0:
        print(f1(a, b, c))
    elif t[0] == 1 and t[1] == 1:
        print(f1(a, b, c))
    else:
        print('Error')

exec(input().strip()) # DON'T remove this line
# 1641867, 2022-09-24 10:30:10, PPxx[--][P-P-] (33%)

def f1(a, b, c):
    x = []
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000:
        if a>0:
            x.append(a)
        if b>0:
            x.append(b)
        if c>0:
            x.append(c)
        y = min(x)
    return y
def f2(a, b, c):
    x = []
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000:
        if a<0:
            x.append(a)
        if b<0:
            x.append(b)
        if c<0:
            x.append(c)
        y = max(x)
    return y
def f3(a, b, c):
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000:
        x = a+b+c
            
    return(x[0])
def f4(a, b, c):
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000:
        x = a+b+c
    return(x[-1])
def main():
    t = input().split()
    if t[0] == 0 and t[1] == 0:
        print(f1(a, b, c))
    elif t[0] == 0 and t[1] == 1:
        print(f2(a, b, c))
    elif t[0] == 1 and t[1] == 0:
        print(f1(a, b, c))
    elif t[0] == 1 and t[1] == 1:
        print(f1(a, b, c))
    else:
        print('Error')

exec(input().strip()) # DON'T remove this line

6531508321
# 1640378, 2022-09-24 09:56:07, xxxx[xx][xxxx] (0%)

def f1(a, b, c) :
    a = int(input())
    b = int(input())
    c = int(input())
    x = []
    for a  in range(0,1000) :
        x.append
    for b  in range(0,1000) :
        x.append
    for c in range(0,1000) :
        x.append
    return max(x)
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่าน้อยท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
def f2(a, b, c):
    a = int(input())
    b = int(input())
    c = int(input())
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
def f3(a, b, c):
    a = int(input())
    b = int(input())
    c = int(input())
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเคร่ืองหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
def f4(a, b, c):
    a = int(input())
    b = int(input())
    c = int(input())
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
def main():
    s1 = int(input())
    s2 = int(input())
    a = int(input())
    b = int(input())
    c = int(input())
# รับข้อมูลจากคีย์บอร์ดเป็นจํานวนเต็ม 5 จํานวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกําหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c) # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c) # ถ้าs1 หรือs2 เป็นค่าอ่ืนให้แสดงคําว่าError
exec(input().strip()) # DON'T remove this line
# 1641203, 2022-09-24 10:17:40, xxxx[xx][xxxx] (0%)

def f1(a, b, c) :
    a = int(input())
    b = int(input())
    c = int(input())
    k = []
    if a > 0 :
        k.append(a)
    if b > 0 :
        k.append(b)
    if c > 0 :
        k.append(c)
        
    return max(k)
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่าน้อยท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
def f2(a, b, c):
    a = int(input())
    b = int(input())
    c = int(input())
    k = []
    if a < 0 :
        k.append(a)
    if b < 0 :
        k.append(b)
    if c < 0 :
        k.append(c)
    return max(k)    
        
    
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
def f3(a, b, c):
    a = int(input())
    b = int(input())
    c = int(input())
    
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเคร่ืองหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
def f4(a, b, c):
    a = int(input())
    b = int(input())
    c = int(input())
    m = abs(a+b+c).split(number)
    return m
    
   
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
def main():
    s1 = int(input())
    s2 = int(input())
    a = int(input())
    b = int(input())
    c = int(input())
    if s1 == 0 and s2 == 0 :
        print(f1)
    if s1 == 0 and s2 == 1 :
        print(f2)
    if s1==1 and s2==0 :
        print(f3)
    if s1 ==1 and s2==1 :
        print(f4)
    else :
        print("error")
        
#รับข้อมูลจากคีย์บอร์ดเป็นจํานวนเต็ม 5 จํานวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกําหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c) # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c) # ถ้าs1 หรือs2 เป็นค่าอ่ืนให้แสดงคําว่าError
exec(input().strip()) # DON'T remove this line
# 1641949, 2022-09-24 10:31:35, PP--[--][----] (33%)

def f1(a, b, c) :
    k = []
    if a > 0 :
        k.append(a)
    if b > 0 :
        k.append(b)
    if c > 0 :
        k.append(c)
        
    return min(k)
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่าน้อยท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
def f2(a, b, c):
    k = []
    if a < 0 :
        k.append(a)
    if b < 0 :
        k.append(b)
    if c < 0 :
        k.append(c)
    return max(k)    
        
    
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
def f3(a, b, c):
    m = str(abs(a+b+c))
    return m[0]
    
    
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเคร่ืองหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
def f4(a, b, c):
    m = str(abs(a+b+c))
    return m[-1]
    
   
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1)
    if s1 == 0 and s2 == 1 :
        print(f2)
    if s1 == 1 and s2==0 :
        print(f3)
    if s1 ==1 and s2==1 :
        print(f4)
    else :
        print("error")
        
#รับข้อมูลจากคีย์บอร์ดเป็นจํานวนเต็ม 5 จํานวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกําหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c) # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c) # ถ้าs1 หรือs2 เป็นค่าอ่ืนให้แสดงคําว่าError
exec(input().strip()) # DON'T remove this line

6531517021
# 1640401, 2022-09-24 09:56:54, -x--[xx][xxxx] (0%)

def f1(a, b, c):
    if a > 0:
        if a < b and a < c:
            f1 = a
    if b > 0:
        if b < a and b < c:
            f1 = b
    if c > 0:
        if c < a and c < b:
            f1 = c
            return f1
        
def f2(a, b, c):
    if a < 0:
        if a > b and a > c:
            f2 = a
    if b < 0:
        if b > a and b > c:
            f2 = b
    if c < 0:
        if c > a and c > b:
            f2 = c
        return f2
    
def f3(a, b, c):
    x = [a, b, c]
    y = sum(x)
    f3 = y
    return f3

def f4(a, b, c):
    p = [a, b, c]
    o = sum(p)
    f4 = o
    return f4

def main():

    s1, s2, a, b, c == input().split()
    s1 = int(s1)
    s2 = int(s2)
    a = int(a)
    b = int(b)
    c = int(c)
    
    if s1 == 0 and s2 == 0:
        t = f1(a, b, c)
        print(t)
    elif s1 == 0 and s2 == 1:
        v = f2(a, b, c)
        print(v)
    elif s1 == 1 and s2 == 0:
        g = f3(a, b, c)
        print(g)
    elif s1 == 1 and s2 == 1:
        l = f4(a, b, c)
        print(l)
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line
# 1640977, 2022-09-24 10:11:55, PP--[xx][xxxx] (33%)

def f1(a, b, c):
    
    y = []
    if a > 0:
        y.append(a)
    if b > 0:
        y.append(b)
    if c > 0:
        y.append(c)
    e = min(y)
    f1 = e
    
    return f1
        
def f2(a, b, c):
    
    q = []
    if a < 0:
        q.append(a)
    if b < 0:
        q.append(b)
    if c < 0:
        q.append(c)
    h = max(q)
    f2 = h
    
    return f2
    
def f3(a, b, c):
    x = [a, b, c]
    y = sum(x)
    f3 = y
    return f3

def f4(a, b, c):
    p = [a, b, c]
    o = sum(p)
    f4 = o
    return f4

def main():

    s1, s2, a, b, c == input().split()
    s1 = int(s1)
    s2 = int(s2)
    a = int(a)
    b = int(b)
    c = int(c)
    
    if s1 == 0 and s2 == 0:
        t = f1(a, b, c)
        print(t)
    elif s1 == 0 and s2 == 1:
        v = f2(a, b, c)
        print(v)
    elif s1 == 1 and s2 == 0:
        g = f3(a, b, c)
        print(g)
    elif s1 == 1 and s2 == 1:
        l = f4(a, b, c)
        print(l)
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line
# 1641411, 2022-09-24 10:21:44, PP--[xx][xxxx] (33%)

def f1(a, b, c):
    
    y = []
    if a > 0:
        y.append(a)
    if b > 0:
        y.append(b)
    if c > 0:
        y.append(c)
    e = min(y)
    f1 = e
    
    return f1
        
def f2(a, b, c):
    
    q = []
    if a < 0:
        q.append(a)
    if b < 0:
        q.append(b)
    if c < 0:
        q.append(c)
    h = max(q)
    f2 = h
    
    return f2
    
def f3(a, b, c):
    x = [a, b, c]
    y = sum(x)
    f3 = y%13
    return f3

def f4(a, b, c):
    p = [a, b, c]
    o = sum(p)
    f4 = o%7
    return f4

def main():

    s1, s2, a, b, c == input().split()
    s1 = int(s1)
    s2 = int(s2)
    a = int(a)
    b = int(b)
    c = int(c)
    
    if s1 == 0 and s2 == 0:
        t = f1(a, b, c)
        print(t)
    elif s1 == 0 and s2 == 1:
        v = f2(a, b, c)
        print(v)
    elif s1 == 1 and s2 == 0:
        g = f3(a, b, c)
        print(g)
    elif s1 == 1 and s2 == 1:
        l = f4(a, b, c)
        print(l)
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line

6530036221
# 1640905, 2022-09-24 10:10:06, --PP[--][----] (33%)

def f1(a, b, c):
    min_x = 0
    if a>0 :
        min_x = a
    if b>0 and b<a:
        min_x = b
    if c>0 and c<a:
        min_x = c
        
    return(min_x)

def f2(a, b, c):
    max_x = 0
    if a<0 :
        max_x = a
    if b<0 and b>a:
        max_x = b
    if c<0 and c>a:
        max_x = c
        
    return(max_x)

def f3(a, b, c):
    x = a+b+c
    x = str(x)
    if "-" in x :
        x = x[1::]
    x = int(x[0:1:])
    return(x)

def f4(a, b, c):
    x = a+b+c
    x = str(x)
    if "-" in x :
        x = x[1::]
    x = int(x[-1::])
    return(x)

def main():
    x = input().split()
    s1 = int(x[0])
    s2 = int(x[0])
    a = int(x[0])
    b = int(x[0])
    c = int(x[0])
    if s1==0 and s2==0:
        return f1(a,b,c)

        
        
exec(input().strip()) # DON'T remove this 
# 1641278, 2022-09-24 10:19:07, --PP[--][-PP-] (33%)

def f1(a, b, c):
    min_x = 0
    if a>0 :
        min_x = a
    if b>0 and b<a:
        min_x = b
    if c>0 and c<a:
        min_x = c
        
    return(min_x)

def f2(a, b, c):
    max_x = 0
    if a<0 :
        max_x = a
    if b<0 and b>a:
        max_x = b
    if c<0 and c>a:
        max_x = c
        
    return(max_x)

def f3(a, b, c):
    x = a+b+c
    x = str(x)
    if "-" in x :
        x = x[1::]
    x = int(x[0:1:])
    return(x)

def f4(a, b, c):
    x = a+b+c
    x = str(x)
    if "-" in x :
        x = x[1::]
    x = int(x[-1::])
    return(x)

def main():
    x = input().split()
    s1 = int(x[0])
    s2 = int(x[0])
    a = int(x[0])
    b = int(x[0])
    c = int(x[0])
    if s1==0 and s2==0:
        return print(f1(a, b, c))
    if s1==0 and s2==1:
        return print(f2(a, b, c))
    if s1==1 and s2==0:
        return print(f3(a, b, c))
    if s1==1 and s2==1:
        return print(f4(a, b, c))
    else :
        print("Error")
        
exec(input().strip()) # DON'T remove this line


# 1642248, 2022-09-24 10:36:28, --PP[--][-PP-] (33%)

def f1(a, b, c):
    min_x = 0
    if a>0 :
        min_x = a
    if b>0 and b<a:
        min_x = b
    if c>0 and c<a:
        min_x = c
        
    return(min_x)

def f2(a, b, c):
    max_x = 0
    if a<0 :
        max_x = a
    if b<0 and b>a:
        max_x = b
    if c<0 and c>a:
        max_x = c
        
    return(max_x)

def f3(a, b, c):
    x = a+b+c
    x = str(x)
    if "-" in x :
        x = x[1::]
    x = int(x[0:1:])
    return(x)

def f4(a, b, c):
    x = a+b+c
    x = str(x)
    if "-" in x :
        x = x[1::]
    x = int(x[-1::])
    return(x)

def main():
    x = input().split()
    s1 = int(x[0])
    s2 = int(x[0])
    a = int(x[0])
    b = int(x[0])
    c = int(x[0])
    if s1==0 and s2==0:
        return(print(f1(a, b, c)))
    elif s1==0 and s2==1:
        return(print(f2(a, b, c)))
    elif s1==1 and s2==0:
        return(print(f3(a, b, c)))
    elif s1==1 and s2==1:
        return(print(f4(a, b, c)))
    else :
        print("Error")
        
exec(input().strip()) # DON'T remove this line

6530043621
# 1640493, 2022-09-24 09:59:15, PP--[xx][PxPx] (33%)

def f1(a, b, c):
    one = []
    a = int(a)
    b = int(b)
    c = int(c)
    if a > 0:
     one.append(a)
    if b > 0:
     one.append(b)
    if c > 0:
     one.append(c)
    result = int(min(one))
    return result

def f2(a, b, c):
    two = []
    a = int(a)
    b = int(b)
    c = int(c)
    if a < 0:
     two.append(a)
    if b < 0:
     two.append(b)
    if c < 0:
     two.append(c)
    result = int(max(two))
    return result
    
def f3(a, b, c):
    x = [a,b,c]
    three = abs(sum(x))
    three = str(three)
    c = three[0]
    return c

def f4(a, b, c):
    x = [a,b,c]
    four = abs(sum(x))
    four = str(four)
    c = four[-1]
    return c

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0:
        print(f1)(a, b,c)
    if s1 == 0 and s2 == 1:
        print(f2)(a, b,c)
    if s1 == 1 and s2 == 0:
        print(f3)(a, b,c)
    if s1 == 1 and s2 == 1:
        print(f4)(a, b,c)
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line
# 1641788, 2022-09-24 10:28:59, PP--[--][P-P-] (33%)

def f1(a, b, c):
    one = []
    a = int(a)
    b = int(b)
    c = int(c)
    if a > 0:
     one.append(a)
    if b > 0:
     one.append(b)
    if c > 0:
     one.append(c)
    result = int(min(one))
    return result

def f2(a, b, c):
    two = []
    a = int(a)
    b = int(b)
    c = int(c)
    if a < 0:
     two.append(a)
    if b < 0:
     two.append(b)
    if c < 0:
     two.append(c)
    result = int(max(two))
    return result
    
def f3(a, b, c):
    x = [a,b,c]
    three = abs(sum(x))
    three = str(three)
    c = three[0]
    return c

def f4(a, b, c):
    x = [a,b,c]
    four = abs(sum(x))
    four = str(four)
    c = four[-1]
    return c

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line
# 1641934, 2022-09-24 10:31:15, PP--[--][P-P-] (33%)

def f1(a, b, c):
    one = []
    a = int(a)
    b = int(b)
    c = int(c)
    if a > 0:
     one.append(a)
    if b > 0:
     one.append(b)
    if c > 0:
     one.append(c)
    result = int(min(one))
    return result

def f2(a, b, c):
    two = []
    a = int(a)
    b = int(b)
    c = int(c)
    if a < 0:
     two.append(a)
    if b < 0:
     two.append(b)
    if c < 0:
     two.append(c)
    result = int(max(two))
    return result
    
def f3(a, b, c):
    x = [a,b,c]
    three = sum(x)
    three = str(three)
    c = three[0]
    return c

def f4(a, b, c):
    x = [a,b,c]
    four = sum(x)
    four = str(four)
    c = four[-1]
    return c

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line

6530076321
# 1641635, 2022-09-24 10:26:05, ----[--][----] (0%)

def f1(a,b,c):
    list1 =[a,b,c]
    list1.sort()
    for e in range(len(list1)):
        if list1[e]<0:
            d =list1.pop(e)
        else:
            return int(min(list1))
def f2(a,b,c):
    list2= [a,b,c]
    list2.sort()
    for e in range (len(list2)):
        if list2[e]>0:
            d = list2.pop(e)
            return int(max(list2))
def f3(a,b,c):
    list3 = [a,b,c]
    sum3=sum(list3)
    if sum3 <0:
        sum3 = sum3*-1
    sum3 = str(sum3)
    list33=[]
    for i in sum3:
        list33.append(i)
        return list33[0]
    
def f4(a,b,c):
    list4 =[a,b,c]
    sum4 = sum(list4)
    if sum4<0:
        sum4 = sum4*-1
    sum4 = str(sum4)
    list44 = []
    for i in sum4:
        list44.append(i)
    return list44[-1]

def main():
    def mainmain(s1,s2,a,b,c):
        if s1 ==0 and s2 ==0:
            print(f1(a,b,c))
        elif s1==0 and s2== 1:
            print(f2(a,b,c))
        elif s1==1 and s2== 0:
            print(f3(a,b,c))
        elif s1==1 and s2==1:
            print(f4(a,b,c))
        else:
            print("Error")
    
exec(input().strip())
# 1641966, 2022-09-24 10:31:57, ----[PP][PPPP] (33%)

def f1(a,b,c):
    list1 =[a,b,c]
    list1.sort()
    for e in range(len(list1)):
        if list1[e]<0:
            d =list1.pop(e)
        else:
            return int(min(list1))
def f2(a,b,c):
    list2= [a,b,c]
    list2.sort()
    for e in range (len(list2)):
        if list2[e]>0:
            d = list2.pop(e)
            return int(max(list2))
def f3(a,b,c):
    list3 = [a,b,c]
    sum3=sum(list3)
    if sum3 <0:
        sum3 = sum3*-1
    sum3 = str(sum3)
    list33=[]
    for i in sum3:
        list33.append(i)
        return list33[0]
    
def f4(a,b,c):
    list4 =[a,b,c]
    sum4 = sum(list4)
    if sum4<0:
        sum4 = sum4*-1
    sum4 = str(sum4)
    list44 = []
    for i in sum4:
        list44.append(i)
    return list44[-1]

def main():
    s1,s2,a,b,c = [float(e) for e in input().split()]
    if s1 ==0 and s2 ==0:
        print(f1(a,b,c))
    elif s1==0 and s2== 1:
        print(f2(a,b,c))
    elif s1==1 and s2== 0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print("Error")
    
exec(input().strip())
# 1642375, 2022-09-24 10:37:59, ----[PP][PPPP] (33%)

def f1(a,b,c):
    list1 =[a,b,c]
    list1.sort()
    for e in range(len(list1)):
        if list1[e]<0:
            d =list1.pop(e)
        else:
            return int(min(list1))
def f2(a,b,c):
    list2= [a,b,c]
    list2.sort()
    for e in range (len(list2)):
        if list2[e]>0:
            d = list2.pop(e)
            return int(max(list2))
def f3(a,b,c):
    list3 = [a,b,c]
    sum3=sum(list3)
    if sum3 <0:
        sum3 = sum3*-1
    sum3 = str(sum3)
    list33=[]
    for i in sum3:
        list33.append(i)
        return list33[0]
    
def f4(a,b,c):
    list4 =[a,b,c]
    sum4 = sum(list4)
    if sum4<0:
        sum4 = sum4*-1
    sum4 = str(sum4)
    list44 = []
    for i in sum4:
        list44.append(i)
    return list44[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 ==0 and s2 ==0:
        print(f1(a,b,c))
    elif s1==0 and s2== 1:
        print(f2(a,b,c))
    elif s1==1 and s2== 0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print("Error")
    
exec(input().strip())

6530092321
# 1640314, 2022-09-24 09:54:11, --x-[PP][P-PP] (17%)

def f1(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่าน้อยท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    m=[a,b,c]
    
    if a<=0:
        m.remove(a)
    elif b<=0:
        m.remove(b)
    elif c<=0:
        m.remove(c)    
    else:
        pass
    
    x=min(m)
    return x
def f2(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    m=[a,b,c]
    
    if a>=0:
        m.remove(a)
    elif b>=0:
        m.remove(b)
    elif c>=0:
        m.remove(c)    
    else:
        pass
    
    x=max(m)
    return x
def f3(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเคร่ืองหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
    m=[a,b,c]
    y=str(sum(m))
    x= (y[1])
    return x
def f4(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    m=[a,b,c]
    y=str(sum(m))
    x= (y[1])
    return x
def main():
# รับข้อมูลจากคีย์บอร์ดเป็นจํานวนเต็ม 5 จํานวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกําหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c) # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c) # ถ้าs1 หรือs2 เป็นค่าอ่ืนให้แสดงคําว่าError
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0 :
        print(f1(a, b, c))
    elif s1==0 and s2==1 :
        print(f2(a, b, c))
    elif s1==1 and s2==0 :
        print(f3(a, b, c))
    elif s1==1 and s2==1 :
        print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line
# 1640583, 2022-09-24 10:01:46, ----[PP][PPPP] (33%)

def f1(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่าน้อยท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    m=[a,b,c]
    
    if a<=0:
        m.remove(a)
    elif b<=0:
        m.remove(b)
    elif c<=0:
        m.remove(c)    
    else:
        pass
    
    x=min(m)
    return x
def f2(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    m=[a,b,c]
    
    if a>=0:
        m.remove(a)
    elif b>=0:
        m.remove(b)
    elif c>=0:
        m.remove(c)    
    else:
        pass
    
    x=max(m)
    return x
def f3(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเคร่ืองหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
    m=[a,b,c]
    y= sum(m)
    if y <0:
        y*=(-1)
    o= str(y)
    x= o[:1]
    return x
def f4(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    m=[a,b,c]
    y= sum(m)
    if y <0:
        y*=(-1)
    o= str(y)
    x= o[-1:-2]
    return x
def main():
# รับข้อมูลจากคีย์บอร์ดเป็นจํานวนเต็ม 5 จํานวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกําหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c) # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c) # ถ้าs1 หรือs2 เป็นค่าอ่ืนให้แสดงคําว่าError
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0 :
        print(f1(a, b, c))
    elif s1==0 and s2==1 :
        print(f2(a, b, c))
    elif s1==1 and s2==0 :
        print(f3(a, b, c))
    elif s1==1 and s2==1 :
        print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line
# 1642244, 2022-09-24 10:36:25, ----[PP][PPPP] (33%)

def f1(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่าน้อยท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    m=[a,b,c]
    
    if a<=0:
        m.remove(a)
    elif b<=0:
        m.remove(b)
    elif c<=0:
        m.remove(c)    
    else:
        pass
    
    x=min(m)
    return x
def f2(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    m=[a,b,c]
    
    if a>=0:
        m.remove(a)
    elif b>=0:
        m.remove(b)
    elif c>=0:
        m.remove(c)    
    else:
        pass
    
    x=max(m)
    return x
def f3(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเคร่ืองหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
    m=[a,b,c]
    y= sum(m)
    if y <0:
        y*=(-1)
    o= str(y)
    x= o[:1]
    return x
def f4(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    m=[a,b,c]
    y= sum(m)
    if y <0:
        y*=(-1)
    o= str(y)
    x= o[:-2:-1]
    return x
def main():
# รับข้อมูลจากคีย์บอร์ดเป็นจํานวนเต็ม 5 จํานวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกําหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c) # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c) # ถ้าs1 หรือs2 เป็นค่าอ่ืนให้แสดงคําว่าError
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0 :
        print(f1(a, b, c))
    elif s1==0 and s2==1 :
        print(f2(a, b, c))
    elif s1==1 and s2==0 :
        print(f3(a, b, c))
    elif s1==1 and s2==1 :
        print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line


6530131121
# 1639924, 2022-09-24 09:43:12, xxxx[xx][xxxx] (0%)

def f1(a, b, c):
    data=[a,b,c]
    renewd=[]
    for e in data:
        if e > 0:
            renewd.append(e)
    return min(renewd)
def f2(a, b, c):
    data=[a,b,c]
    renewd=[]
    for e in data:
        if e < 0:
            renewd.append(e)
    return max(renewd)
def f3(a, b, c):
    a = abs(int(a))
    b = abs(int(b))
    c = abs(int(c))
    for i in range (len(str(a))-1):
        a=a//10
    for i in range (len(str(b))-1):
        b=b//10
    for i in range (len(str(c))-1):
        c=c//10
    data = a+b+c
    return data
def f4(a, b, c):
    a = abs(int(a))
    b = abs(int(b))
    c = abs(int(c))
    a=a%10
    b=b%10
    c=c%10
    data = a+b+c
    return data
def main():
    OdOp= input().strip()
    if OdOp[0] ==0:
       if OdOp[1] ==0:
           print(f1(OdOp[2], OdOp[3], OdOp[4]))
       elif OdOp[1] ==1:
           print(f2(OdOp[2], OdOp[3], OdOp[4]))
    elif OdOp[0]==1:
        if OdOp[1] ==0:
           print(f3(OdOp[2], OdOp[3], OdOp[4]))
        elif OdOp[1] ==1:
           print(f4(OdOp[2], OdOp[3], OdOp[4]))
    else:
        return "Error"
exec(input().split())
# 1642242, 2022-09-24 10:36:22, compilation error (0%)

def f1(a, b, c):
    data=[a,b,c]
    renewd=[]
    for e in data:
        if e > 0:
            renewd.append(e)
    return min(renewd)
def f2(a, b, c):
    data=[a,b,c]
    renewd=[]
    for e in data:
        if e < 0:
            renewd.append(e)
    return max(renewd)
def f3(a, b, c):
    a = abs(int(a))
    b = abs(int(b))
    c = abs(int(c))
    for i in range (len(str(a))-1):
        a=a//10
    for i in range (len(str(b))-1):
        b=b//10
    for i in range (len(str(c))-1):
        c=c//10
    data = a+b+c
    return data
def f4(a, b, c):
    a = abs(int(a))
    b = abs(int(b))
    c = abs(int(c))
    a=a%10
    b=b%10
    c=c%10
    data = a+b+c
    return data
def main():
    OdOp= input().strip()
    if OdOp[0] ==0:
       if OdOp[1] ==0:
           print(f1(OdOp[2], OdOp[3], OdOp[4]))
       elif OdOp[1] ==1:
           print(f2(OdOp[2], OdOp[3], OdOp[4]))
    elif OdOp[0]==1:
        if OdOp[1] ==0:
           print(f3(OdOp[2], OdOp[3], OdOp[4]))
        elif OdOp[1] ==1:
           print(f4(OdOp[2], OdOp[3], OdOp[4]))
    else:
        return "Error"
exec(input().strip()
# 1642258, 2022-09-24 10:36:35, PP--[--][----] (33%)

def f1(a, b, c):
    data=[a,b,c]
    renewd=[]
    for e in data:
        if e > 0:
            renewd.append(e)
    return min(renewd)
def f2(a, b, c):
    data=[a,b,c]
    renewd=[]
    for e in data:
        if e < 0:
            renewd.append(e)
    return max(renewd)
def f3(a, b, c):
    a = abs(int(a))
    b = abs(int(b))
    c = abs(int(c))
    for i in range (len(str(a))-1):
        a=a//10
    for i in range (len(str(b))-1):
        b=b//10
    for i in range (len(str(c))-1):
        c=c//10
    data = a+b+c
    return data
def f4(a, b, c):
    a = abs(int(a))
    b = abs(int(b))
    c = abs(int(c))
    a=a%10
    b=b%10
    c=c%10
    data = a+b+c
    return data
def main():
    OdOp= input().strip()
    if OdOp[0] ==0:
       if OdOp[1] ==0:
           print(f1(OdOp[2], OdOp[3], OdOp[4]))
       elif OdOp[1] ==1:
           print(f2(OdOp[2], OdOp[3], OdOp[4]))
    elif OdOp[0]==1:
        if OdOp[1] ==0:
           print(f3(OdOp[2], OdOp[3], OdOp[4]))
        elif OdOp[1] ==1:
           print(f4(OdOp[2], OdOp[3], OdOp[4]))
    else:
        return "Error"
exec(input().strip())

6531327021
# 1640235, 2022-09-24 09:51:46, ---P[PP][-P-P] (33%)

def f1(a, b, c) :
    x = [a,b,c]
    if x[0] <= 0 :
        x.remove(x[0])
    if x[1] <= 0 :
        x.remove(x[1])
    if x[-1] <= 0 :
        x.remove(x[-1])
    m = min(x)
    return m

def f2(a, b, c) :
    x = [a,b,c]
    if x[0] >= 0 :
        x.remove(x[0])
    if x[1] >= 0 :
        x.remove(x[1])
    if x[-1] >= 0 :
        x.remove(x[-1])
    m = max(x)
    return m

def f3(a, b, c) :
    s = abs(a + b + c)
    if s >= 1000 :
        x = s//1000
    elif s >= 100 :
        x = s//100
    elif s >= 10 :
        x = s//10
    else :
        x = s
    return x

def f4(a, b, c) :
    s = abs(a + b + c) % 10
    return s

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print('ERROR')
        
exec(input().strip())
# 1640347, 2022-09-24 09:55:18, ---P[--][----] (17%)

def f1(a, b, c) :
    x = [a,b,c]
    if x[0] <= 0 :
        x.remove(x[0])
    if x[1] <= 0 :
        x.remove(x[1])
    if x[-1] <= 0 :
        x.remove(x[-1])
    m = min(x)
    return m

def f2(a, b, c) :
    x = [a,b,c]
    if x[0] >= 0 :
        x.remove(x[0])
    if x[1] >= 0 :
        x.remove(x[1])
    if x[-1] >= 0 :
        x.remove(x[-1])
    m = max(x)
    return m

def f3(a, b, c) :
    s = abs(a + b + c)
    if s >= 1000 :
        x = s//1000
    elif s >= 100 :
        x = s//100
    elif s >= 10 :
        x = s//10
    else :
        x = s
    return x

def f4(a, b, c) :
    s = abs(a + b + c) % 10
    return s

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    if s1 or s2 != 0 or 1 :
        print('ERROR')
        
exec(input().strip())
# 1640428, 2022-09-24 09:57:34, ---P[PP][-P-P] (33%)

def f1(a, b, c) :
    x = [a,b,c]
    if x[0] <= 0 :
        x.remove(x[0])
    if x[1] <= 0 :
        x.remove(x[1])
    if x[-1] <= 0 :
        x.remove(x[-1])
    m = min(x)
    return m

def f2(a, b, c) :
    x = [a,b,c]
    if x[0] >= 0 :
        x.remove(x[0])
    if x[1] >= 0 :
        x.remove(x[1])
    if x[-1] >= 0 :
        x.remove(x[-1])
    m = max(x)
    return m

def f3(a, b, c) :
    s = abs(a + b + c)
    if s >= 1000 :
        x = s//1000
    elif s >= 100 :
        x = s//100
    elif s >= 10 :
        x = s//10
    else :
        x = s
    return x

def f4(a, b, c) :
    s = abs(a + b + c) % 10
    return s

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print('ERROR')
        
exec(input().strip())

6531802821
# 1641917, 2022-09-24 10:31:02, ----[xx][xxxx] (0%)

def f1(a, b, c):
    if a < 0 :
        a = 1001
    if b < 0 :
        b = 1001
    if c < 0 :
        c = 1001
    return min(a, b, c)
    
def f2(a, b, c):
    if a > 0 :
        a = -1001
    if b > 0 :
        b = -1001
    if c > 0 :
        c = -1001
    return max(a, b, c)
def f3(a, b, c):
    k = str(a+b+c)
    if k[0] == "-" :
        return k[1]
    else :
        return k[0]

def f4(a, b, c):
    k = str(a+b+c)
    return k[-1]

def main():
    s1,s2,a,b,c = int(input())
    if s1 ==0 and s2==0 :
        print(f1(a, b, c))
    elif s1 ==0 and s2==1 :
        print(f2(a, b, c))
    elif s1==1 and s2==0 :
        print(f3(a, b, c))
    elif s1==1 and s2==1 :
        print(f4(a, b, c))
    else :
        print("Error")   
exec(input().strip()) # DON'T remove this line
# 1642134, 2022-09-24 10:34:49, ----[PP][PPPP] (33%)

def f1(a, b, c):
    if a < 0 :
        a = 1001
    if b < 0 :
        b = 1001
    if c < 0 :
        c = 1001
    return min(a, b, c)
    
def f2(a, b, c):
    if a > 0 :
        a = -1001
    if b > 0 :
        b = -1001
    if c > 0 :
        c = -1001
    return max(a, b, c)
def f3(a, b, c):
    k = str(a+b+c)
    if k[0] == "-" :
        return k[1]
    else :
        return k[0]

def f4(a, b, c):
    k = str(a+b+c)
    return k[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 ==0 and s2==0 :
        print(f1(a, b, c))
    elif s1 ==0 and s2==1 :
        print(f2(a, b, c))
    elif s1==1 and s2==0 :
        print(f3(a, b, c))
    elif s1==1 and s2==1 :
        print(f4(a, b, c))
    else :
        print("Error")   
exec(input().strip()) # DON'T remove this line
# 1642264, 2022-09-24 10:36:38, ----[PP][PPPP] (33%)

def f1(a, b, c):
    if a < 0 :
        a = 1001
    if b < 0 :
        b = 1001
    if c < 0 :
        c = 1001
    return min(a, b, c)
    
def f2(a, b, c):
    if a > 0 :
        a = -1001
    if b > 0 :
        b = -1001
    if c > 0 :
        c = -1001
    return max(a, b, c)
def f3(a, b, c):
    k = str(a+b+c)
    if k[0] == "-" :
        return k[1]
    else :
        return k[0]

def f4(a, b, c):
    k = str(a+b+c)
    return k[-1]

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 ==0 and s2==0 :
        print(f1(a, b, c))
    elif s1 ==0 and s2==1 :
        print(f2(a, b, c))
    elif s1==1 and s2==0 :
        print(f3(a, b, c))
    elif s1==1 and s2==1 :
        print(f4(a, b, c))
    else :
        print("Error")   
exec(input().strip()) # DON'T remove this line

6431013921
# 1639823, 2022-09-24 09:40:30, ----[PP][PPPP] (33%)

def f1(a, b, c):
    f1ans = 0
    temp = []
    if a < 0 or b < 0 or c < 0:
        if a > 0 or b > 0 or c > 0:
            temp.append(a)
            temp.append(b)
            temp.append(c)
    for elem in temp:
        if elem <= 0:
            temp.remove(elem)
            
    return min(temp)

def f2(a, b, c):
    f1ans = 0
    temp = []
    if a < 0 or b < 0 or c < 0:
        if a > 0 or b > 0 or c > 0:
            temp.append(a)
            temp.append(b)
            temp.append(c)
    for elem in temp:
        if elem >= 0:
            temp.remove(elem)
        
    return max(temp)
    
def f3(a, b, c):
    f1ans = 0
    temp = []
    res = 0
    if a < 0 or b < 0 or c < 0:
        if a > 0 or b > 0 or c > 0:
            temp.append(a)
            temp.append(b)
            temp.append(c)
            
    for elem in temp:
        res = res + elem
    res = abs(res)
    res = str(res)
    res = res[0]
            
    return res
 
def f4(a, b, c):
    f1ans = 0
    temp = []
    res = 0
    if a < 0 or b < 0 or c < 0:
        if a > 0 or b > 0 or c > 0:
            temp.append(a)
            temp.append(b)
            temp.append(c)
            
    for elem in temp:
        res = res + elem
    res = str(res)
    res = res[-1]
            
    return res
 
def main():
    s1, s2, a, b, c = [int(elem) for elem in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line


# 1640574, 2022-09-24 10:01:23, ----[PP][PPPP] (33%)

def f1(a, b, c):
    f1ans = 0
    temp = []
    if a > 0 or b > 0 or c > 0:
        if a < 0 or b < 0 or c < 0:
            temp.append(a)
            temp.append(b)
            temp.append(c)
    for elem in temp:
        if elem <= 0:
            temp.remove(elem)
            
    return min(temp)

def f2(a, b, c):
    f1ans = 0
    temp = []
    if a > 0 or b > 0 or c > 0:
        if a < 0 or b < 0 or c < 0:
            temp.append(a)
            temp.append(b)
            temp.append(c)
    for elem in temp:
        if elem >= 0:
            temp.remove(elem)
        
    return max(temp)
    
def f3(a, b, c):
    f1ans = 0
    temp = []
    res = 0
    if a > 0 or b > 0 or c > 0:
        if a < 0 or b < 0 or c < 0:
            temp.append(a)
            temp.append(b)
            temp.append(c)
            
    for elem in temp:
        res = res + elem
    res = abs(res)
    res = str(res)
    res = res[0]
            
    return res
 
def f4(a, b, c):
    f1ans = 0
    temp = []
    res = 0
    if a > 0 or b > 0 or c > 0:
        if a < 0 or b < 0 or c < 0:
            temp.append(a)
            temp.append(b)
            temp.append(c)
            
    for elem in temp:
        res = res + elem
    res = str(res)
    res = res[-1]
            
    return res
 
def main():
    s1, s2, a, b, c = [int(elem) for elem in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line

6530012121
# 1640333, 2022-09-24 09:54:43, P---[PP][P-P-] (33%)

def f1(a, b, c):
    data =[]
    if a > 0:
        data.append(a)
    if b > 0:
        data.append(b)
    if c >0 :
        data.append(c)
    data.sort()
    return data[0]
def f2(a, b, c):
    data1 =[]
    if a < 0:
        data1.append(a)
    if b < 0:
        data1.append(b)
    if c < 0 :
        data1.append(c)
    return data1[-1]    
def f3(a, b, c):
    data2 =[]
    data2.append(a)
    data2.append(b)
    data2.append(c)
    test= []
    for i in range(len(data2)):
        test.append(len(str(abs(data2[i]))))
    test.sort()
    for i in range(len(data2)):
        if data2[i] > 0:
            data2[i] = data2[i]//(10**test[-2])
        else:
            data2[i] = data2[i]//(-10**test[-2])
    return abs(sum(data2)) 
def f4(a, b, c):
    data2 =[]
    data2.append(a)
    data2.append(b)
    data2.append(c)
    for i in range(len(data2)):
        if data2[i]>=0:
            data2[i] = data2[i]%10
        if data2[i]<0:
            data2[i] = abs(data2[i])%10
            data2[i] *= -1
    return abs(sum(data2))                
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
    
exec(input().strip()) # DON'T remove this line

# 1641856, 2022-09-24 10:30:05, P---[PP][P-P-] (33%)

def f1(a, b, c):
    data =[]
    if a > 0:
        data.append(a)
    if b > 0:
        data.append(b)
    if c >0 :
        data.append(c)
    data.sort()
    return data[0]
def f2(a, b, c):
    data1 =[]
    if a < 0:
        data1.append(a)
    if b < 0:
        data1.append(b)
    if c < 0 :
        data1.append(c)
    return data1[-1]    
def f3(a, b, c):
    data2 =[]
    data2.append(a)
    data2.append(b)
    data2.append(c)
    test= []
    for i in range(len(data2)):
        test.append(len(str(abs(data2[i]))))
    test.sort()
    for i in range(len(data2)):
        if data2[i] > 0:
            data2[i] = data2[i]//(10**test[-2])
        else:
            data2[i] = data2[i]//(-10**test[-2])
    return abs(sum(data2)) 
def f4(a, b, c):
    data2 =[]
    data2.append(a)
    data2.append(b)
    data2.append(c)
    for i in range(len(data2)):
        if data2[i]>=0:
            data2[i] = data2[i]%10
        if data2[i]<0:
            data2[i] = abs(data2[i])%10
            data2[i] *= -1
    return abs(sum(data2))                
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
    
exec(input().strip()) # DON'T remove this line


6530115121
# 1639488, 2022-09-24 09:31:32, xxxx[xx][xxxx] (0%)

def f1(a, b, c):
    y=[]
    if a >=0 and a is int:
        y.append(a)
    if b>=0 and b is int:
        y.append(b)
    if c>=0 and b is int:
        y.append(c)
    y.sort()
    return y[0]
def f2(a, b, c):
    y=[]
    if a >=0 and a is int:
        y.append(a)
    if b>=0 and b is int:
        y.append(b)
    if c>=0 and b is int:
        y.append(c)
    y.sort()
    return y[-1]
def f3(a, b, c):
    z=int(a)+int(b)+int(c)
    y=abs(z)
    return str(y)[0]

def f4(a, b, c):
    z=int(a)+int(b)+int(c)
    y=abs(z)
    return str(y)[-1]
def main():
    C=input().split()
    s1=C[0]
    s2=C[1]
    a=C[2]
    b=C[3]
    c=C[4]
    if int(s1)== 0 and int(s2)==0:
        print(f1(a, b, c))
    elif int(s1)== 0 and int(s2)==1:
        print(f2(a, b, c))
    elif int(s1)== 1 and int(s2)==0:
        print(f3(a, b, c))
    elif int(s1)== 1 and int(s2)==1:
        print(f4(a, b, c))
    else:
        print("Error")
    






andexec(input().strip()) # DON'T remove this line

# 1639623, 2022-09-24 09:34:54, -P--[xx][PPPP] (33%)

def f1(a, b, c):
    y=[]
    if a >=0 :
        y.append(int(a))
    if b>=0 :
        y.append(int(b))
    if c>=0 :
        y.append(int(c))
    y.sort()
    return y[0]
def f2(a, b, c):
    y=[]
    if a <0 :
        y.append(int(a))
    if b<0 :
        y.append(int(b))
    if c<0 :
        y.append(int(c))
    y.sort()
    return y[-1]
def f3(a, b, c):
    z=int(a)+int(b)+int(c)
    y=abs(z)
    return str(y)[0]

def f4(a, b, c):
    z=int(a)+int(b)+int(c)
    y=abs(z)
    return str(y)[-1]
def main():
    C=input().split()
    s1=C[0]
    s2=C[1]
    a=C[2]
    b=C[3]
    c=C[4]
    if int(s1)== 0 and int(s2)==0:
        print(f1(a, b, c))
    elif int(s1)== 0 and int(s2)==1:
        print(f2(a, b, c))
    elif int(s1)== 1 and int(s2)==0:
        print(f3(a, b, c))
    elif int(s1)== 1 and int(s2)==1:
        print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line


6531028421
# 1640592, 2022-09-24 10:01:58, PPxx[xx][xxxx] (33%)

def f1(a, b, c):
    p = []
    if int (a) > 0:
        p += [a]
    if int (b) > 0:
        p += [b]
    if int (c) > 0:
        p += [c]
    return min(p)

def f2(a, b, c):
    k = []
    if int (a) < 0:
        k += [a]
    if int (b) < 0:
        k += [b]
    if int (c) < 0:
        k += [c]
    return max(k)










exec(input().strip()) # DON'T remove this line

# 1640818, 2022-09-24 10:07:49, PPxx[-P][P-P-] (33%)

def f1(a, b, c):
    p = []
    if int (a) > 0:
        p += [a]
    if int (b) > 0:
        p += [b]
    if int (c) > 0:
        p += [c]
    return min(p)

def f2(a, b, c):
    k = []
    if int (a) < 0:
        k += [a]
    if int (b) < 0:
        k += [b]
    if int (c) < 0:
        k += [c]
    return max(k)
def main ():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        m = f1(a, b, c)
    if s1 == 0 and s2 == 1:
        m = f2(a, b, c)
    else : 
        m = ('Error')
        
    return print(m)
    









exec(input().strip()) # DON'T remove this line


6430071021
# 1639753, 2022-09-24 09:38:34, ----[PP][PPPP] (33%)

def f1(a, b, c):
    G = [a,b,c]
    for y in G:
        if y <= 0:
            G.remove(y)
    mn = G[0]
    for t in G:
        if t < mn:
            mn = t
    return mn
def f2(a, b, c):
    M = [a,b,c]
    for y in M:
        if y >= 0:
            M.remove(y)
    mx = M[0]
    for t in M:
        if t > mx:
            mx = t
    return mx
def f3(a, b, c):
    O = 0
    K = [a,b,c]
    for d in K:
        O += d
    R = abs(O)
    Q = str(R)
    return Q[0]
def f4(a, b, c):
    O = 0
    K = [a,b,c]
    for d in K:
        O += d
    R = abs(O)
    Q = str(R)
    return Q[1]  
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if (s1 == 0) and (s2 == 0):
        print(f1(a, b, c)
)
    elif (s1 == 0) and (s2 == 1):
        print(f2(a, b, c)
)
    elif (s1 == 1) and (s2 == 0):
        print(f3(a, b, c)
)
    elif (s1 == 1) and (s2 == 1):
        print(f4(a, b, c)
)
    else:
        print('Error')
        
exec(input().strip()) # DON'T remove this line


6530103621
# 1641243, 2022-09-24 10:18:26, PP--[--][----] (33%)

def f1(a,b,c):
    x = []
    if a>0:
        x.append(a)
    if b>0:
        x.append(b)
    if c>0:
        x.append(c)
    y = min(x)
    return y
    
    
def f2(a,b,c):
    x = []
    if a<0:
        x.append(a)
    if b<0:
        x.append(b)
    if c<0:
        x.append(c)
    y = max(x)
    return y
    
def f3(a,b,c):
    x = abs(a+b+c)
    y = str(x)
    return y[0]
      
def f4(a,b,c):
    x = abs(a+b+c)
    y = str(x)
    return y[-1]
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0 :
        y = f1(a,b,c)
        return y
    elif s1==0 and s2==1 :
        y = f2(a,b,c)
        return y
    elif s1==1 and s2==0 :
        y = f3(a,b,c)
        return y
    elif s1==1 and s2==1 :
        y = f4(a,b,c)
        return y
    else:
        return "Error"

exec(input().strip())

6530121921
# 1641525, 2022-09-24 10:24:11, PP--[xx][xxxx] (33%)

def f1(a, b, c):
    x = []
    x.append(a) 
    x.append(b)
    x.append(c)
    
    x[0] = int(x[0])
    x[1] = int(x[1])
    x[2] = int(x[2])
    d = []
    for e in x:
        if e > 0:
            d.append(e)
    d.sort()
    return d[0]
def f2(a, b, c):
    x = []
    x.append(a) 
    x.append(b)
    x.append(c)
    
    x[0] = int(x[0])
    x[1] = int(x[1])
    x[2] = int(x[2])
    d = []
    for e in x:
        if e < 0:
            d.append(e)
    d.sort()
    return d[-1]
def f3(a, b, c):
    sum = a+b+c
    if sum < 0:
        sum = sum*(-1)
    else:
        sum = sum
    x = [sum]
    print(x)
def f4(a, b, c):
    sum = a+b+c
    if sum < 0:
        sum = sum*(-1)
    else:
        sum = sum
    x = [str(sum)]
    print(x[0])
def main():
    x = input().split()
    s1 =  x[0]
    s2 =  x[1]
    a =  x[2]
    b =  x[3]
    c =  x[4]
    if s1==0 and s2==0:
        return f1(a, b, c)
    elif s1==0 and s2==1:
        return f2(a, b, c)
    elif s1==1 and s2==0:
        return f3(a, b, c)
    elif s1==1 and s2==1:
        return f4(a, b, c)
    else:
        return Error
exec(input().strip()) # DON'T remove this line



6530143721
# 1639359, 2022-09-24 09:28:26, ----[PP][PPPP] (33%)

def f1(a, b, c):
    l = [a,b,c]
    for i in l:
        if i < 0:
            l.remove(i)
    return min(l)
def f2(a, b, c):
    l = [a,b,c]
    for i in l:
        if i > 0:
            l.remove(i)
    return max(l)
def f3(a, b, c):
    l = [a,b,c]
    sum_l = sum(l)
    if sum_l < 0:
        sum_l *= -1
    sum_l = str(sum_l)
    return sum_l[0]
def f4(a, b, c):
    l = [a,b,c]
    sum_l = sum(l)
    if sum_l < 0:
        sum_l *= -1
    sum_l = str(sum_l)
    return sum_l[-1]
def main():
    s1, s2, a, b, c = input().split()
    s1, s2, a, b, c = int(s1), int(s2), int(a), int(b), int(c)
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1== 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print('Error')
        
exec(input().strip()) 

Max Score = 17


6231416021
# 1639266, 2022-09-24 09:25:59, ----[--][----] (0%)

def f1(a,b,c) :
    return min(a,b,c)     
def f2(a,b,c) :
    pass
def f3(a,b,c) :
    pass
def f4(a,b,c) :
    pass
def main():
    pass

exec(input().strip())
# 1639745, 2022-09-24 09:38:22, ----[--][----] (0%)

def f1(a,b,c) :
    return min(a,-b,c)     
def f2(a,b,c) :
    pass
def f3(a,b,c) :
    pass
def f4(a,b,c) :
    pass
def main():
    pass

exec(input().strip())
# 1640161, 2022-09-24 09:50:00, ----[--][----] (0%)

def f1(a,b,c) :
    pass     
def f2(a,b,c) :
    pass
def f3(a,b,c) :
    pass
def f4(a,b,c) :
    d = a + b + c
    return str(d)[-1]
def main():
    pass

exec(input().strip())
# 1640431, 2022-09-24 09:57:41, ----[--][P-P-] (0%)

def f1(a,b,c) :
    pass     
def f2(a,b,c) :
    pass
def f3(a,b,c) :
    pass
def f4(a,b,c) :
    pass
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')

exec(input().strip())
# 1640606, 2022-09-24 10:02:24, ----[--][----] (0%)

def f1(a,b,c) :
  pass
def f2(a,b,c) :
  pass
def f3(a,b,c) :
  d = a + b + c
  return str(d)[1]
def f4(a,b,c) :
  d = a + b + c
  return str(d)[-1]
def main():
  pass
# 1640811, 2022-09-24 10:07:43, --x-[--][----] (0%)

def f1(a,b,c) :
  pass     
def f2(a,b,c) :
  pass
def f3(a,b,c) :
  d = abs(a + b + c)
  return str(d)[1]
def f4(a,b,c) :
  d = abs(a + b + c)
  return str(d)[-1]
def main():
  pass
exec(input().strip())
# 1640835, 2022-09-24 10:08:07, ----[--][----] (0%)

def f1(a,b,c) :
  pass     
def f2(a,b,c) :
  pass
def f3(a,b,c) :
  pass
def f4(a,b,c) :
  d = abs(a + b + c)
  return str(d)[-1]
def main():
  pass
exec(input().strip())
# 1640899, 2022-09-24 10:09:55, ----[--][----] (0%)

def f1(a,b,c) :
  pass     
def f2(a,b,c) :
  pass
def f3(a,b,c) :
  pass
def f4(a,b,c) :
  d = abs(a + b + c)
  d = str(d)
  return str(d)[-1]
def main():
  pass
exec(input().strip())
# 1640995, 2022-09-24 10:12:29, ----[--][----] (0%)

def f1(a,b,c) :
  pass     
def f2(a,b,c) :
  pass
def f3(a,b,c) :
  pass
def f4(a,b,c) :
  pass
def main():
  s1,s2,a,b,c = [int(e) for e in input().split()]
  if s1 == 0 and s2 == 0 :
    return(f1(a,b,c))
  elif s1 == 0 and s2 == 1 :
    return(f2(a,b,c))
  elif s1 == 1 and s2 == 0 :
    return(f3(a,b,c))
  elif s1 == 1 and s2 == 1 :
    return(f4(a,b,c))
  else :
    return('Error')

exec(input().strip())
# 1641297, 2022-09-24 10:19:27, --x-[--][P-PP] (0%)

def f1(a,b,c) :
    pass     
def f2(a,b,c) :
    pass
def f3(a,b,c) :
    return str(a+b+c)[1]
def f4(a,b,c) :
    return str(a+b+c)[-1]
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')

exec(input().strip())
# 1641319, 2022-09-24 10:19:53, ----[--][PPP-] (0%)

def f1(a,b,c) :
    pass     
def f2(a,b,c) :
    pass
def f3(a,b,c) :
    return str(a+b+c)[0]
def f4(a,b,c) :
    return str(a+b+c)[-1]
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')

exec(input().strip())
# 1641376, 2022-09-24 10:20:58, --xx[--][PxPx] (0%)

def f1(a,b,c) :
    pass     
def f2(a,b,c) :
    pass
def f3(a,b,c) :
    return int((a+b+c)[0])
def f4(a,b,c) :
    return int((a+b+c)[-1])
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')

exec(input().strip())
# 1641408, 2022-09-24 10:21:38, --xx[--][PxPx] (0%)

def f1(a,b,c) :
    pass     
def f2(a,b,c) :
    pass
def f3(a,b,c) :
    return int(abs((a+b+c)[0]))
def f4(a,b,c) :
    return int(abs((a+b+c)[-1]))
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')

exec(input().strip())
# 1641419, 2022-09-24 10:21:57, ----[--][P-P-] (0%)

def f1(a,b,c) :
    pass     
def f2(a,b,c) :
    pass
def f3(a,b,c) :
    pass
def f4(a,b,c) :
    pass
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')

exec(input().strip())
# 1641992, 2022-09-24 10:32:31, ----[--][----] (0%)

def f1(a,b,c) :
    a = abs(a)
    b = abs(b)
    c = abs(c)
    return min(a,b,c)
def f2(a,b,c) :
    pass
def f3(a,b,c) :
    pass
def f4(a,b,c) :
    pass
def main():
    pass

exec(input().strip())
# 1642037, 2022-09-24 10:33:23, x---[--][----] (0%)

import math
def f1(a,b,c) :
    a = math.abs(a)
    b = math.abs(b)
    c = math.abs(c)
    return min(a,b,c)
def f2(a,b,c) :
    pass
def f3(a,b,c) :
    pass
def f4(a,b,c) :
    pass
def main():
    pass

exec(input().strip())
# 1642090, 2022-09-24 10:34:16, x---[--][----] (0%)

import math
def f1(a,b,c) :
    return min(math.abs(a),math.abs(b),math.abs(c))
def f2(a,b,c) :
    pass
def f3(a,b,c) :
    pass
def f4(a,b,c) :
    pass
def main():
    pass

exec(input().strip())
# 1642133, 2022-09-24 10:34:49, ----[--][----] (0%)

def f1(a,b,c) :
    return min(abs(a),abs(b),abs(c))
def f2(a,b,c) :
    pass
def f3(a,b,c) :
    pass
def f4(a,b,c) :
    pass
def main():
    pass

exec(input().strip())
# 1642234, 2022-09-24 10:36:15, --x-[--][----] (0%)

def f1(a,b,c) :
    pass
def f2(a,b,c) :
    pass
def f3(a,b,c) :
    d = a + b + c
    return str(d)[1]
def f4(a,b,c) :
    pass
def main():
    pass

exec(input().strip())
# 1642267, 2022-09-24 10:36:40, --xx[--][----] (0%)

def f1(a,b,c) :
    pass
def f2(a,b,c) :
    pass
def f3(a,b,c) :
    d = a + b + c
    return str(d)[1]
def f4(a,b,c) :
    return str(d)[-1]
def main():
    pass

exec(input().strip())
# 1642305, 2022-09-24 10:37:11, --xx[--][----] (0%)

def f1(a,b,c) :
    pass
def f2(a,b,c) :
    pass
def f3(a,b,c) :
    d = a + b + c
    d = str(d)
    return str(d)[1]
def f4(a,b,c) :
    return str(d)[-1]
def main():
    pass

exec(input().strip())
# 1642422, 2022-09-24 10:38:31, ----[--][----] (0%)

def f1(a,b,c) :
    pass
def f2(a,b,c) :
    pass
def f3(a,b,c) :
    pass
def f4(a,b,c) :
    d = a + b + c
    return d % 10
def main():
    pass

exec(input().strip())
# 1642459, 2022-09-24 10:38:59, ---P[--][----] (17%)

def f1(a,b,c) :
    pass
def f2(a,b,c) :
    pass
def f3(a,b,c) :
    pass
def f4(a,b,c) :
    d = a + b + c
    return abs(d) % 10
def main():
    pass

exec(input().strip())

6531001421
# 1640470, 2022-09-24 09:58:44, compilation error (0%)

rng = []
for i in range(-1000,1001):
    rng.append(i)
def f1(a,b,c):
    blank = []
    a = int
    b = int
    c = int
    if a in range(len(rng)):
        blank.append(a)
    if b in range(len(rng)):
        blank.append(b)
    if c in range(len(rng)):
        blank.append(c)
    kp_max = max(blank)
    return(kp_max)
def f2(a,b,c):
    vacant = []
    a = int
    b = int
    c = int
    if a in range(-1000,0):
        blank.append(a)
    if b in range(-1000,0):
        blank.append(b)
    if c in range(-1000,0):
        blank.append(c)
    kp_mimax = max(vacant)
    return(kp_mimax)
def f3(a,b,c):
    a = int
    b = int
    c = int
    none = []
    hope = []
    if a in range(-1000,1001):
        none.append(a)
    if b in range(-1000,1001):
        none.append(b)
    if c in range(-1000,1001):
        none.append(c)
    kp_com = sum(none)
    for idx,x in enumerate(none):
        hope.append(x)
    return(hope[1])
def f4(a,b,c):
    try = []
    sub = []
    if a in range(-1000,1001):
        try.append(a)
    if b in range(-1000,1001):
        try.append(b)
    if c in range(-1000,1001):
        try.append(c)
    kp_try = sum(try)
    for idx,x in enumerate(try):
        sub.append(x)
    return(sub[-1])
def main():
    god = []
    s1 = int(input())
    s2 = int(input())
    a = int(input())
    b = int(input())
    c = int(input())
    if a in range(-1000,1001):
        god.append(a)
    else:
        return(Error)
    if b in range(-1000,1001):
        god.append(b)
    else:
        return(Error)
    if c in range(-1000,1001):
        god.append(c)
    else:
        return(Error)
    if s1 == 0 and s2 == 0:
        return(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        return(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        return(f3(a,b,c))
    if s1 == 1 and s2 ==1:
        return(f4(a,b,c))
    else:
        return(Error)
exec(input().strip()) # DON'T remove this line
    
    

# 1640525, 2022-09-24 09:59:53, ----[--][----] (0%)

def f1(a,b,c):
    blank = []
    a = int
    b = int
    c = int
    kp_max = max(a,b,c)
# 1640532, 2022-09-24 10:00:06, ----[--][----] (0%)

def f1(a,b,c):
    blank = []
    a = int
    b = int
    c = int
    kp_max = max(a,b,c)
    return(kp_max)
# 1640548, 2022-09-24 10:00:42, compilation error (0%)

def f1(a,b,c):
    blank = []
    a = int
    b = int
    c = int
    kp_max = max(a,b,c)
    return(kp_max)
def f2(a,b,c):
    vacant = []
    a = int
    b = int
    c = int
    if a in range(-1000,0):
        blank.append(a)
    if b in range(-1000,0):
        blank.append(b)
    if c in range(-1000,0):
        blank.append(c)
    kp_mimax = max(vacant)
    return(kp_mimax)
def f3(a,b,c):
    a = int
    b = int
    c = int
    none = []
    hope = []
    if a in range(-1000,1001):
        none.append(a)
    if b in range(-1000,1001):
        none.append(b)
    if c in range(-1000,1001):
        none.append(c)
    kp_com = sum(none)
    for idx,x in enumerate(none):
        hope.append(x)
    return(hope[1])
def f4(a,b,c):
    try = []
    sub = []
    if a in range(-1000,1001):
        try.append(a)
    if b in range(-1000,1001):
        try.append(b)
    if c in range(-1000,1001):
        try.append(c)
    kp_try = sum(try)
    for idx,x in enumerate(try):
        sub.append(x)
    return(sub[-1])
def main():
    god = []
    s1 = int(input())
    s2 = int(input())
    a = int(input())
    b = int(input())
    c = int(input())
    if a in range(-1000,1001):
        god.append(a)
    else:
        return(Error)
    if b in range(-1000,1001):
        god.append(b)
    else:
        return(Error)
    if c in range(-1000,1001):
        god.append(c)
    else:
        return(Error)
    if s1 == 0 and s2 == 0:
        return(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        return(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        return(f3(a,b,c))
    if s1 == 1 and s2 ==1:
        return(f4(a,b,c))
    else:
        return(Error)
exec(input().strip()) # DON'T remove this line
    
    


# 1640589, 2022-09-24 10:01:56, compilation error (0%)

def f1(a,b,c):
    blank = []
    a = int
    b = int
    c = int
    kp_max = max(a,b,c)
    return(kp_max)
def f2(a,b,c):
    vacant = []
    a = int
    b = int
    c = int
    if a in range(-1000,0):
        blank.append(a)
    if b in range(-1000,0):
        blank.append(b)
    if c in range(-1000,0):
        blank.append(c)
    kp_mimax = max(vacant)
    return(kp_mimax)
def f3(a,b,c):
    a = int
    b = int
    c = int
    none = []
    hope = []
    if a in range(-1000,1001):
        none.append(a)
    if b in range(-1000,1001):
        none.append(b)
    if c in range(-1000,1001):
        none.append(c)
    kp_com = sum(none)
    for idx,x in enumerate(none):
        hope.append(x)
    return(hope[1])
def f4(a,b,c):
    try = []
    sub = []
    if a in range(-1000,1001):
        try.append(a)
    if b in range(-1000,1001):
        try.append(b)
    if c in range(-1000,1001):
        try.append(c)
    kp_try = sum(try)
    for idx,x in enumerate(try):
        sub.append(x)
    return(sub[-1])
def main():
    god = []
    s1 = int(input())
    s2 = int(input())
    a = int(input())
    b = int(input())
    c = int(input())
    if a in range(-1000,1001):
        god.append(a)
    else:
        return(Error)
    if b in range(-1000,1001):
        god.append(b)
    else:
        return(Error)
    if c in range(-1000,1001):
        god.append(c)
    else:
        return(Error)
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 ==1:
        print(f4(a,b,c))
    else:
        return(Error)
exec(input().strip()) # DON'T remove this line
    

# 1640633, 2022-09-24 10:03:09, compilation error (0%)

def f1(a,b,c):
    a = int
    b = int
    c = int
    kp_max = max(a,b,c)
    return(kp_max)
def f2(a,b,c):
    vacant = []
    if a in range(-1000,0):
        vacant.append(a)
    if b in range(-1000,0):
        vacant.append(b)
    if c in range(-1000,0):
        vacant.append(c)
    kp_mimax = max(vacant)
    return(kp_mimax)
def f3(a,b,c):
    a = int
    b = int
    c = int
    none = []
    hope = []
    if a in range(-1000,1001):
        none.append(a)
    if b in range(-1000,1001):
        none.append(b)
    if c in range(-1000,1001):
        none.append(c)
    kp_com = sum(none)
    for idx,x in enumerate(none):
        hope.append(x)
    return(hope[1])
def f4(a,b,c):
    try = []
    sub = []
    if a in range(-1000,1001):
        try.append(a)
    if b in range(-1000,1001):
        try.append(b)
    if c in range(-1000,1001):
        try.append(c)
    kp_try = sum(try)
    for idx,x in enumerate(try):
        sub.append(x)
    return(sub[-1])
def main():
    god = []
    s1 = int(input())
    s2 = int(input())
    a = int(input())
    b = int(input())
    c = int(input())
    if a in range(-1000,1001):
        god.append(a)
    else:
        return(Error)
    if b in range(-1000,1001):
        god.append(b)
    else:
        return(Error)
    if c in range(-1000,1001):
        god.append(c)
    else:
        return(Error)
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 ==1:
        print(f4(a,b,c))
    else:
        return(Error)
exec(input().strip()) # DON'T remove this line
# 1640664, 2022-09-24 10:03:54, xxxx[xx][xxxx] (0%)

def f1(a,b,c):
    a = int
    b = int
    c = int
    kp_max = max(a,b,c)
    return(kp_max)
exec(input().strip())
# 1640701, 2022-09-24 10:04:55, xxxx[xx][xxxx] (0%)

def f1(a,b,c):
    a = int
    b = int
    c = int
    blank = []
    blank.append(a)
    blank.append(b)
    blank.append(c)
    kp_max = max(a,b,c)
    return(kp_max)
exec(input().strip())
# 1640767, 2022-09-24 10:06:30, compilation error (0%)

def f1(a,b,c):
    a = int
    b = int
    c = int
    kp_max = max(a,b,c)
    return(kp_max)
def f2(a,b,c):
    vacant = []
    if a in range(-1000,0):
        vacant.append(a)
    if b in range(-1000,0):
        vacant.append(b)
    if c in range(-1000,0):
        vacant.append(c)
    kp_mimax = max(vacant)
    return(kp_mimax)
def f3(a,b,c):
    a = int
    b = int
    c = int
    none = []
    hope = []
    kp_com = sum(a,b,c)
    for idx,x in enumerate(kp_com):
        hope.append(x)
    return(hope[1])
def f4(a,b,c):
    try = []
    sub = []
    if a in range(-1000,1001):
        try.append(a)
    if b in range(-1000,1001):
        try.append(b)
    if c in range(-1000,1001):
        try.append(c)
    kp_try = sum(try)
    for idx,x in enumerate(try):
        sub.append(x)
    return(sub[-1])
def main():
    god = []
    s1 = int(input())
    s2 = int(input())
    a = int(input())
    b = int(input())
    c = int(input())
    if a in range(-1000,1001):
        god.append(a)
    else:
        return(Error)
    if b in range(-1000,1001):
        god.append(b)
    else:
        return(Error)
    if c in range(-1000,1001):
        god.append(c)
    else:
        return(Error)
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 ==1:
        print(f4(a,b,c))
    else:
        return(Error)
exec(input().strip()) # DON'T remove this line
# 1640803, 2022-09-24 10:07:28, xPxx[xx][xxxx] (17%)

def f1(a,b,c):
    a = int
    b = int
    c = int
    kp_max = max(a,b,c)
    return(kp_max)
def f2(a,b,c):
    vacant = []
    if a in range(-1000,0):
        vacant.append(a)
    if b in range(-1000,0):
        vacant.append(b)
    if c in range(-1000,0):
        vacant.append(c)
    kp_mimax = max(vacant)
    return(kp_mimax)
def f3(a,b,c):
    a = int
    b = int
    c = int
    none = []
    hope = []
    kp_com = sum(a,b,c)
    for idx,x in enumerate(kp_com):
        hope.append(x)
    return(hope[1])
def f4(a,b,c):
    kp_try = sum(a,b,c)
    sub = []
    for idx,x in enumerate(kp_try):
        sub.append(x)
    return(sub[-1])
def main():
    god = []
    s1 = int(input())
    s2 = int(input())
    a = int(input())
    b = int(input())
    c = int(input())
    if a in range(-1000,1001):
        god.append(a)
    else:
        return(Error)
    if b in range(-1000,1001):
        god.append(b)
    else:
        return(Error)
    if c in range(-1000,1001):
        god.append(c)
    else:
        return(Error)
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 ==1:
        print(f4(a,b,c))
    else:
        return(Error)
exec(input().strip()) # DON'T remove this line
# 1641467, 2022-09-24 10:22:56, xPxx[xx][xxxx] (17%)

def f1(a,b,c):
    a = int
    b = int
    c = int
    kp_max = max(a,b,c)
    return(kp_max)
def f2(a,b,c):
    vacant = []
    if a in range(-1000,0):
        vacant.append(a)
    if b in range(-1000,0):
        vacant.append(b)
    if c in range(-1000,0):
        vacant.append(c)
    kp_mimax = max(vacant)
    return(kp_mimax)
def f3(a,b,c):
    a = int
    b = int
    c = int
    none = []
    hope = []
    kp_com = sum(a,b,c)
    for idx,x in enumerate(kp_com):
        hope.append(x)
    return(hope[1])
def f4(a,b,c):
    sub =[]
    kp_try = sum(a,b,c)
    for idx,x in enumerate(Kp_try):
        sub.append(x)
    return(sub[-1])
def main():
    god = []
    s1 = int(input())
    s2 = int(input())
    a = int(input())
    b = int(input())
    c = int(input())
    if a in range(-1000,1001):
        god.append(a)
    else:
        return(Error)
    if b in range(-1000,1001):
        god.append(b)
    else:
        return(Error)
    if c in range(-1000,1001):
        god.append(c)
    else:
        return(Error)
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 ==1:
        print(f4(a,b,c))
    else:
        return(Error)
exec(input().strip()) # DON'T remove this line

# 1641542, 2022-09-24 10:24:27, compilation error (0%)

def f1(a,b,c):
    a = int
    b = int
    c = int
    kp_max = max(a,b,c)
    return(kp_max)
def f2(a,b,c):
    vacant = []
    if a in range(-1000,0):
        vacant.append(a)
    if b in range(-1000,0):
        vacant.append(b)
    if c in range(-1000,0):
        vacant.append(c)
    kp_mimax = max(vacant)
    return(kp_mimax)
def f3(a,b,c):
    a = int
    b = int
    c = int
    none = []
    hope = []
    kp_com = sum(a,b,c)
    for idx,x in enumerate(kp_com):
        hope.append(x)
    return(hope[1])
def f4(a,b,c):
    sub =[]
    kp_try = sum(a,b,c)
    for idx,x in enumerate(Kp_try):
        sub.append(x)
    return(sub[-1])
def main():
    god = []
    s1 = int(input())
    s2 = int(input())
    a = int(input())
    b = int(input())
    c = int(input())
    
    if a not in range(-1000,1001)
        return(Error)
    if b not in range(-1000,1001)
        return(Error)
    if c not in range(-1000,1001)
        return(Error)
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 ==1:
        print(f4(a,b,c))
    else:
        return(Error)
exec(input().strip()) # DON'T remove this line
    
    
# 1641585, 2022-09-24 10:25:14, xPxx[xx][xxxx] (17%)

def f1(a,b,c):
    a = int
    b = int
    c = int
    kp_max = max(a,b,c)
    return(kp_max)
def f2(a,b,c):
    vacant = []
    if a in range(-1000,0):
        vacant.append(a)
    if b in range(-1000,0):
        vacant.append(b)
    if c in range(-1000,0):
        vacant.append(c)
    kp_mimax = max(vacant)
    return(kp_mimax)
def f3(a,b,c):
    none = []
    hope = []
    kp_com = sum(a,b,c)
    for idx,x in enumerate(kp_com):
        hope.append(x)
    return(hope[1])
def f4(a,b,c):
    sub
    kp_try = sum(a,b,c)
    for idx,x in enumerate(Kp_try):
        sub.append(x)
    return(sub[-1])
def main():
    god = []
    s1 = int(input())
    s2 = int(input())
    a = int(input())
    b = int(input())
    c = int(input())
    if a in range(-1000,1001):
        god.append(a)
    else:
        return(Error)
    if b in range(-1000,1001):
        god.append(b)
    else:
        return(Error)
    if c in range(-1000,1001):
        god.append(c)
    else:
        return(Error)
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 ==1:
        print(f4(a,b,c))
    else:
        return(Error)
exec(input().strip()) # DON'T remove this line

# 1641671, 2022-09-24 10:26:43, -Pxx[xx][xxxx] (17%)

def f1(a,b,c):
    kp_max = max(a,b,c)
    return(kp_max)
def f2(a,b,c):
    vacant = []
    if a in range(-1000,0):
        vacant.append(a)
    if b in range(-1000,0):
        vacant.append(b)
    if c in range(-1000,0):
        vacant.append(c)
    kp_mimax = max(vacant)
    return(kp_mimax)
def f3(a,b,c):
    none = []
    hope = []
    kp_com = sum(a,b,c)
    for idx,x in enumerate(kp_com):
        hope.append(x)
    return(hope[1])
def f4(a,b,c):
    sub
    kp_try = sum(a,b,c)
    for idx,x in enumerate(Kp_try):
        sub.append(x)
    return(sub[-1])
def main():
    god = []
    s1 = int(input())
    s2 = int(input())
    a = int(input())
    b = int(input())
    c = int(input())
    if a in range(-1000,1001):
        god.append(a)
    else:
        return(Error)
    if b in range(-1000,1001):
        god.append(b)
    else:
        return(Error)
    if c in range(-1000,1001):
        god.append(c)
    else:
        return(Error)
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 ==1:
        print(f4(a,b,c))
    else:
        return(Error)
exec(input().strip()) # DON'T remove this line
# 1641746, 2022-09-24 10:28:10, -Pxx[xx][xxxx] (17%)

def f1(a,b,c):
    kp_max = min(a,b,c)
    return(kp_max)
def f2(a,b,c):
    vacant = []
    if a in range(-1000,0):
        vacant.append(a)
    if b in range(-1000,0):
        vacant.append(b)
    if c in range(-1000,0):
        vacant.append(c)
    kp_mimax = max(vacant)
    return(kp_mimax)
def f3(a,b,c):
    none = []
    hope = []
    kp_com = sum(a,b,c)
    for idx,x in enumerate(kp_com):
        hope.append(x)
    return(hope[1])
def f4(a,b,c):
    sub
    kp_try = sum(a,b,c)
    for idx,x in enumerate(Kp_try):
        sub.append(x)
    return(sub[-1])
def main():
    god = []
    s1 = int(input())
    s2 = int(input())
    a = int(input())
    b = int(input())
    c = int(input())
    if a in range(-1000,1001):
        god.append(a)
    else:
        return(Error)
    if b in range(-1000,1001):
        god.append(b)
    else:
        return(Error)
    if c in range(-1000,1001):
        god.append(c)
    else:
        return(Error)
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 ==1:
        print(f4(a,b,c))
    else:
        return(Error)
exec(input().strip()) # DON'T remove this line
    

# 1641877, 2022-09-24 10:30:21, -Pxx[xx][xxxx] (17%)

def f1(a,b,c):
    eco = []
    if a in range(0,1001):
        eco.append(a)
    if b in range(0,1001):
        eco.append(b)
    if c in range(0,1001):
        eco.append(c)
    kp_mimax = min(eco)
    return(kp_mimax)
def f2(a,b,c):
    vacant = []
    if a in range(-1000,0):
        vacant.append(a)
    if b in range(-1000,0):
        vacant.append(b)
    if c in range(-1000,0):
        vacant.append(c)
    kp_mimax = max(vacant)
    return(kp_mimax)
def f3(a,b,c):
    none = []
    hope = []
    kp_com = sum(a,b,c)
    for idx,x in enumerate(kp_com):
        hope.append(x)
    return(hope[1])
def f4(a,b,c):
    sub
    kp_try = sum(a,b,c)
    for idx,x in enumerate(Kp_try):
        sub.append(x)
    return(sub[-1])
def main():
    god = []
    s1 = int(input())
    s2 = int(input())
    a = int(input())
    b = int(input())
    c = int(input())
    if a in range(-1000,1001):
        god.append(a)
    else:
        return(Error)
    if b in range(-1000,1001):
        god.append(b)
    else:
        return(Error)
    if c in range(-1000,1001):
        god.append(c)
    else:
        return(Error)
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 ==1:
        print(f4(a,b,c))
    else:
        return(Error)
exec(input().strip()) # DON'T remove this line

# 1641996, 2022-09-24 10:32:39, -Pxx[xx][xxxx] (17%)

def f1(a,b,c):
    eco = []
    if a in range(0,1001):
        eco.append(a)
    if b in range(0,1001):
        eco.append(b)
    if c in range(0,1001):
        eco.append(c)
    kp_mimax = min(eco)
    return(kp_mimax)
def f2(a,b,c):
    vacant = []
    if a in range(-1000,0):
        vacant.append(a)
    if b in range(-1000,0):
        vacant.append(b)
    if c in range(-1000,0):
        vacant.append(c)
    kp_mimax = max(vacant)
    return(kp_mimax)
def f3(a,b,c):
    a = int
    b = int
    c = int
    none = []
    hope = []
    kp_com = sum(a,b,c)
    for idx,x in enumerate(kp_com):
        hope.append(x)
    return(hope[1])
def f4(a,b,c):
    sub
    kp_try = sum(a,b,c)
    for idx,x in enumerate(Kp_try):
        sub.append(x)
    return(sub[-1])
def main():
    god = []
    s1 = int(input())
    s2 = int(input())
    a = int(input())
    b = int(input())
    c = int(input())
    if a in range(-1000,1001):
        god.append(a)
    else:
        return(Error)
    if b in range(-1000,1001):
        god.append(b)
    else:
        return(Error)
    if c in range(-1000,1001):
        god.append(c)
    else:
        return(Error)
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 ==1:
        print(f4(a,b,c))
    else:
        return(Error)
exec(input().strip()) # DON'T remove this line
    
    


# 1642225, 2022-09-24 10:36:08, -Pxx[xx][xxxx] (17%)

def f1(a,b,c):
    eco = []
    if a in range(0,1001):
        eco.append(a)
    if b in range(0,1001):
        eco.append(b)
    if c in range(0,1001):
        eco.append(c)
    kp_mimax = min(eco)
    return(kp_mimax)
def f2(a,b,c):
    vacant = []
    if a in range(-1000,0):
        vacant.append(a)
    if b in range(-1000,0):
        vacant.append(b)
    if c in range(-1000,0):
        vacant.append(c)
    kp_mimax = max(vacant)
    return(kp_mimax)
def f3(a,b,c):
    sp = []
    kp_com = sum(a,b,c)
    for idx,x in enumerate(kp_com):
        sp.append(x)
    print(sp[-1])
def f4(a,b,c):
    sub
    kp_try = sum(a,b,c)
    for idx,x in enumerate(Kp_try):
        sub.append(x)
    return(sub[-1])
def main():
    god = []
    s1 = int(input())
    s2 = int(input())
    a = int(input())
    b = int(input())
    c = int(input())
    if a in range(-1000,1001):
        god.append(a)
    else:
        return(Error)
    if b in range(-1000,1001):
        god.append(b)
    else:
        return(Error)
    if c in range(-1000,1001):
        god.append(c)
    else:
        return(Error)
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 ==1:
        print(f4(a,b,c))
    else:
        return(Error)
exec(input().strip()) # DON'T remove this line

# 1642298, 2022-09-24 10:37:06, -Pxx[xx][xxxx] (17%)

def f1(a,b,c):
    eco = []
    if a in range(0,1001):
        eco.append(a)
    if b in range(0,1001):
        eco.append(b)
    if c in range(0,1001):
        eco.append(c)
    kp_mimax = min(eco)
    return(kp_mimax)
def f2(a,b,c):
    vacant = []
    if a in range(-1000,0):
        vacant.append(a)
    if b in range(-1000,0):
        vacant.append(b)
    if c in range(-1000,0):
        vacant.append(c)
    kp_mimax = max(vacant)
    return(kp_mimax)
def f3(a,b,c):
    sp = []
    kp_com = sum(a,b,c)
    for idx,x in enumerate(kp_com):
        sp.append(x)
    print(sp[-1])
def f4(a,b,c):
    sub = []
    kp_try = sum(a,b,c)
    for idx,x in enumerate(Kp_try):
        sub.append(x)
    return(sub[-1])
def main():
    god = []
    s1 = int(input())
    s2 = int(input())
    a = int(input())
    b = int(input())
    c = int(input())
    if a in range(-1000,1001):
        god.append(a)
    else:
        return(Error)
    if b in range(-1000,1001):
        god.append(b)
    else:
        return(Error)
    if c in range(-1000,1001):
        god.append(c)
    else:
        return(Error)
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 ==1:
        print(f4(a,b,c))
    else:
        return(Error)
exec(input().strip()) # DON'T remove this line
    
    


# 1642396, 2022-09-24 10:38:14, -Pxx[xx][xxxx] (17%)

def f1(a,b,c):
    eco = []
    if a in range(0,1001):
        eco.append(a)
    if b in range(0,1001):
        eco.append(b)
    if c in range(0,1001):
        eco.append(c)
    kp_mimax = min(eco)
    return(kp_mimax)
def f2(a,b,c):
    vacant = []
    if a in range(-1000,0):
        vacant.append(a)
    if b in range(-1000,0):
        vacant.append(b)
    if c in range(-1000,0):
        vacant.append(c)
    kp_mimax = max(vacant)
    return(kp_mimax)
def f3(a,b,c):
    sp = []
    kp_com = sum(a,b,c)
    for idx,x in enumerate(kp_com):
        sp.append(x)
    print(sp[-1])
def f4(a,b,c):
    sub = []
    kp_try = sum(a,b,c)
    for idx,x in enumerate(Kp_try):
        sub.append(x)
    return(sub[0])
def main():
    god = []
    s1 = int(input())
    s2 = int(input())
    a = int(input())
    b = int(input())
    c = int(input())
    if a in range(-1000,1001):
        god.append(a)
    else:
        return(Error)
    if b in range(-1000,1001):
        god.append(b)
    else:
        return(Error)
    if c in range(-1000,1001):
        god.append(c)
    else:
        return(Error)
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 ==1:
        print(f4(a,b,c))
    else:
        return(Error)
exec(input().strip()) # DON'T remove this line
    
    


# 1642456, 2022-09-24 10:38:53, -Pxx[xx][xxxx] (17%)

def f1(a,b,c):
    eco = []
    if a in range(0,1001):
        eco.append(a)
    if b in range(0,1001):
        eco.append(b)
    if c in range(0,1001):
        eco.append(c)
    kp_mimax = min(eco)
    return(kp_mimax)
def f2(a,b,c):
    vacant = []
    if a in range(-1000,0):
        vacant.append(a)
    if b in range(-1000,0):
        vacant.append(b)
    if c in range(-1000,0):
        vacant.append(c)
    kp_mimax = max(vacant)
    return(kp_mimax)
def f3(a,b,c):
    sp = []
    kp_com = sum(a,b,c)
    for idx,x in enumerate(kp_com):
        sp.append(x)
    print(sp[0])
def f4(a,b,c):
    sub = []
    kp_try = sum(a,b,c)
    for idx,x in enumerate(Kp_try):
        sub.append(x)
    return(sub[0])
def main():
    god = []
    s1 = int(input())
    s2 = int(input())
    a = int(input())
    b = int(input())
    c = int(input())
    if a in range(-1000,1001):
        god.append(a)
    else:
        return(Error)
    if b in range(-1000,1001):
        god.append(b)
    else:
        return(Error)
    if c in range(-1000,1001):
        god.append(c)
    else:
        return(Error)
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 ==1:
        print(f4(a,b,c))
    else:
        return(Error)
exec(input().strip()) # DON'T remove this line
    
    



6531505421
# 1640135, 2022-09-24 09:49:18, --xx[xx][xxxx] (0%)

def f1(a, b, c):
    y = []
    if a >= 0:
        y.append(a)
    if b >= 0:
        y.append(b)
    if c >= 0:
        y.append(c)
    z = min(y)
    return z
def f2(a, b, c):
    o = []
    if a <= 0:
        o.append(a)
    if b <= 0:
        o.append(b)
    if c <= 0:
        o.append(c)
    p = max(o)
    return p
def f3(a, b, c):
    (p) = int(a+b+c)
    if p >= 0:
        v = p[0]
    if p < 0 :
        j = p*(-1)
        v = p[0]
    return v
def f4(a, b, c):
    (m) = a+b+c
    if m >= 0:
        q = str(m[-1])
    if m < 0 :
        m = m*(-1)
        q = (m[-1])
    return q
    





exec(input().strip()) # DON'T remove this line
   
# 1641307, 2022-09-24 10:19:38, ---P[--][----] (17%)

def f1(a, b, c):
    y = []
    if a >= 0:
        y.append(a)
    if b >= 0:
        y.append(b)
    if c >= 0:
        y.append(c)
    z = min(y)
    return z
def f2(a, b, c):
    o = []
    if a <= 0:
        o.append(a)
    if b <= 0:
        o.append(b)
    if c <= 0:
        o.append(c)
    p = max(o)
    return p
def f3(a, b, c):
    (p) = int(a+b+c)
    l = []
    if p >= 0:
        l.append(p)
    if p < 0 :
        p = p*(-1)
        l.append(p)
    l = str(l)
    k = int(l[-2:-1])
    
    return k
def f4(a, b, c):
    (m) = int(a+b+c)
    q = []
    if m >= 0:
        q.append(m)
    if m < 0 :
        m = m*(-1)
        q.append(m)
    u = q[0]
    u = u%10
    return u
def main():
    x = input().split()
    s1 = x[0]
    s2 = x[1]
    a = x[2]
    b = x[3]
    c = x[4]
    if s1 == 0 and s2 == 0 :
        print (z)
    if s1 == 0 and s2 == 1 :
        print (p)
    if s1 == 1 and s2 ==0 :
        print (k)
    if s1 ==1 and s2 == 1:
        print('f4(a, b, c)')
        
        
    
    
exec(input().strip()) # DON'T remove this line
 
 
# 1641342, 2022-09-24 10:20:17, ---P[--][----] (17%)

def f1(a, b, c):
    y = []
    if a >= 0:
        y.append(a)
    if b >= 0:
        y.append(b)
    if c >= 0:
        y.append(c)
    z = min(y)
    return z
def f2(a, b, c):
    o = []
    if a <= 0:
        o.append(a)
    if b <= 0:
        o.append(b)
    if c <= 0:
        o.append(c)
    p = max(o)
    return p
def f3(a, b, c):
    (p) = int(a+b+c)
    l = []
    if p >= 0:
        l.append(p)
    if p < 0 :
        p = p*(-1)
        l.append(p)
    l = str(l)
    k = int(l[-2:-1])
    
    return k
def f4(a, b, c):
    (m) = int(a+b+c)
    q = []
    if m >= 0:
        q.append(m)
    if m < 0 :
        m = m*(-1)
        q.append(m)
    u = q[0]
    u = u%10
    return u
def main():
    x = input().split()
    s1 = x[0]
    s2 = x[1]
    a = x[2]
    b = x[3]
    c = x[4]
    if s1 == 0 and s2 == 0 :
        print (f1)
    if s1 == 0 and s2 == 1 :
        print (f2)
    if s1 == 1 and s2 ==0 :
        print (f3)
    if s1 ==1 and s2 == 1:
        print(f4)
        
        
    
    
exec(input().strip()) # DON'T remove this line
# 1641584, 2022-09-24 10:25:11, ---P[xx][PxPx] (17%)

def f1(a, b, c):
    y = []
    if a >= 0:
        y.append(a)
    if b >= 0:
        y.append(b)
    if c >= 0:
        y.append(c)
    z = min(y)
    return z
def f2(a, b, c):
    o = []
    if a <= 0:
        o.append(a)
    if b <= 0:
        o.append(b)
    if c <= 0:
        o.append(c)
    p = max(o)
    return p
def f3(a, b, c):
    (p) = int(a+b+c)
    l = []
    if p >= 0:
        l.append(p)
    if p < 0 :
        p = p*(-1)
        l.append(p)
    l = str(l)
    k = int(l[-2:-1])
    
    return k
def f4(a, b, c):
    (m) = int(a+b+c)
    q = []
    if m >= 0:
        q.append(m)
    if m < 0 :
        m = m*(-1)
        q.append(m)
    u = q[0]
    u = u%10
    return u
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print (z)
    if s1 == 0 and s2 == 1 :
        print (p)
    if s1 == 1 and s2 ==0 :
        print (k)
    if s1 ==1 and s2 == 1:
        print(f4(a, b, c))
    if s1 != 1 or s1 != 0 and s2 != 1 or s2 != 0:
        print ('Error')
exec(input().strip()) # DON'T remove this line
  
# 1641596, 2022-09-24 10:25:26, ---P[xx][-x-x] (17%)

def f1(a, b, c):
    y = []
    if a >= 0:
        y.append(a)
    if b >= 0:
        y.append(b)
    if c >= 0:
        y.append(c)
    z = min(y)
    return z
def f2(a, b, c):
    o = []
    if a <= 0:
        o.append(a)
    if b <= 0:
        o.append(b)
    if c <= 0:
        o.append(c)
    p = max(o)
    return p
def f3(a, b, c):
    (p) = int(a+b+c)
    l = []
    if p >= 0:
        l.append(p)
    if p < 0 :
        p = p*(-1)
        l.append(p)
    l = str(l)
    k = int(l[-2:-1])
    
    return k
def f4(a, b, c):
    (m) = int(a+b+c)
    q = []
    if m >= 0:
        q.append(m)
    if m < 0 :
        m = m*(-1)
        q.append(m)
    u = q[0]
    u = u%10
    return u
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print (z)
    if s1 == 0 and s2 == 1 :
        print (p)
    if s1 == 1 and s2 ==0 :
        print (k)
    if s1 ==1 and s2 == 1:
        print(f4(a, b, c))
    
exec(input().strip()) # DON'T remove this line
# 1641658, 2022-09-24 10:26:27, compilation error (0%)

def f1(a, b, c):
    y = []
    if a >= 0:
        y.append(a)
    if b >= 0:
        y.append(b)
    if c >= 0:
        y.append(c)
    z = min(y)
    return z
def f2(a, b, c):
    o = []
    if a <= 0:
        o.append(a)
    if b <= 0:
        o.append(b)
    if c <= 0:
        o.append(c)
    p = max(o)
    return p
def f3(a, b, c):
    (p) = int(a+b+c)
    l = []
    if p >= 0:
        l.append(p)
    if p < 0 :
        p = p*(-1)
        l.append(p)
    l = str(l)
    k = int(l[-2:-1])
    
    return k
def f4(a, b, c):
    (m) = int(a+b+c)
    q = []
    if m >= 0:
        q.append(m)
    if m < 0 :
        m = m*(-1)
        q.append(m)
    u = q[0]
    u = u%10
    return u
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print (def f1(a, b, c):)
    if s1 == 0 and s2 == 1 :
        print (def f2(a, b, c):)
    if s1 == 1 and s2 ==0 :
        print (def f3(a, b, c):)
    if s1 ==1 and s2 == 1:
        print(f4(a, b, c))
    if s1 != 1 or s1 != 0 and s2 != 1 or s2 != 0:
        print ('Error')
        
    
    
exec(input().strip()) # DON'T remove this line
    
    

# 1641683, 2022-09-24 10:26:58, compilation error (0%)

def f1(a, b, c):
    y = []
    if a >= 0:
        y.append(a)
    if b >= 0:
        y.append(b)
    if c >= 0:
        y.append(c)
    z = min(y)
    return z
def f2(a, b, c):
    o = []
    if a <= 0:
        o.append(a)
    if b <= 0:
        o.append(b)
    if c <= 0:
        o.append(c)
    p = max(o)
    return p
def f3(a, b, c):
    (p) = int(a+b+c)
    l = []
    if p >= 0:
        l.append(p)
    if p < 0 :
        p = p*(-1)
        l.append(p)
    l = str(l)
    k = int(l[-2:-1])
    
    return k
def f4(a, b, c):
    (m) = int(a+b+c)
    q = []
    if m >= 0:
        q.append(m)
    if m < 0 :
        m = m*(-1)
        q.append(m)
    u = q[0]
    u = u%10
    return u
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print ( f1(a, b, c):)
    if s1 == 0 and s2 == 1 :
        print ( f2(a, b, c):)
    if s1 == 1 and s2 ==0 :
        print ( f3(a, b, c):)
    if s1 ==1 and s2 == 1:
        print(f4(a, b, c))
    if s1 != 1 or s1 != 0 and s2 != 1 or s2 != 0:
        print ('Error')
        
    
    
exec(input().strip()) # DON'T remove this line
# 1641703, 2022-09-24 10:27:22, ---P[--][P-P-] (17%)

def f1(a, b, c):
    y = []
    if a >= 0:
        y.append(a)
    if b >= 0:
        y.append(b)
    if c >= 0:
        y.append(c)
    z = min(y)
    return z
def f2(a, b, c):
    o = []
    if a <= 0:
        o.append(a)
    if b <= 0:
        o.append(b)
    if c <= 0:
        o.append(c)
    p = max(o)
    return p
def f3(a, b, c):
    (p) = int(a+b+c)
    l = []
    if p >= 0:
        l.append(p)
    if p < 0 :
        p = p*(-1)
        l.append(p)
    l = str(l)
    k = int(l[-2:-1])
    
    return k
def f4(a, b, c):
    (m) = int(a+b+c)
    q = []
    if m >= 0:
        q.append(m)
    if m < 0 :
        m = m*(-1)
        q.append(m)
    u = q[0]
    u = u%10
    return u
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print ( f1(a, b, c))
    if s1 == 0 and s2 == 1 :
        print ( f2(a, b, c))
    if s1 == 1 and s2 ==0 :
        print ( f3(a, b, c))
    if s1 ==1 and s2 == 1:
        print(f4(a, b, c))
    if s1 != 1 or s1 != 0 and s2 != 1 or s2 != 0:
        print ('Error')
        
    
    
exec(input().strip()) # DON'T remove this line
# 1641901, 2022-09-24 10:30:43, ---P[--][P-P-] (17%)

def f1(a, b, c):
    y = []
    if a >= 0:
        y.append(a)
    if b >= 0:
        y.append(b)
    if c >= 0:
        y.append(c)
    z = min(y)
    return z
def f2(a, b, c):
    o = []
    if a <= 0:
        o.append(a)
    if b <= 0:
        o.append(b)
    if c <= 0:
        o.append(c)
    p = max(o)
    return p
def f3(a, b, c):
    (p) = int(a+b+c)
    l = []
    if p >= 0:
        l.append(p)
    if p < 0 :
        p = p*(-1)
        l.append(p)
    l = str(l)
    k = int(l[-2:-1])
    
    return k
def f4(a, b, c):
    (m) = int(a+b+c)
    q = []
    if m >= 0:
        q.append(m)
    if m < 0 :
        m = m*(-1)
        q.append(m)
    u = q[0]
    u = u%10
    return u
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print ( f1(a, b, c))
    if s1 == 0 and s2 == 1 :
        print ( f2(a, b, c))
    if s1 == 1 and s2 ==0 :
        print ( f3(a, b, c))
    if s1 ==1 and s2 == 1:
        print(f4(a, b, c))
    if s1 != 0 and s2 != 0 or s1 != 0 and s2 != 1 or s1 != 1 and s2 !=0 or s1 !=1 and s2 != 1 :
        print ('Error')
    
    
exec(input().strip()) # DON'T remove this line
# 1642073, 2022-09-24 10:34:00, ---P[--][P-P-] (17%)

def f1(a, b, c):
    y = []
    if a >= 0:
        y.append(a)
    if b >= 0:
        y.append(b)
    if c >= 0:
        y.append(c)
    z = min(y)
    return z
def f2(a, b, c):
    o = []
    if a <= 0:
        o.append(a)
    if b <= 0:
        o.append(b)
    if c <= 0:
        o.append(c)
    p = max(o)
    return p
def f3(a, b, c):
    (p) = int(a+b+c)
    l = []
    if p >= 0:
        l.append(p)
    if p < 0 :
        p = p*(-1)
        l.append(p)
    l = l[0]
    k = l//10
    
    return k
def f4(a, b, c):
    (m) = int(a+b+c)
    q = []
    if m >= 0:
        q.append(m)
    if m < 0 :
        m = m*(-1)
        q.append(m)
    u = q[0]
    u = u%10
    return u
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print ( f1(a, b, c))
    if s1 == 0 and s2 == 1 :
        print ( f2(a, b, c))
    if s1 == 1 and s2 ==0 :
        print ( f3(a, b, c))
    if s1 ==1 and s2 == 1:
        print(f4(a, b, c))
    if s1 != 0 and s2 != 0 or s1 != 0 and s2 != 1 or s1 != 1 and s2 !=0 or s1 !=1 and s2 != 1 :
        print ('Error')
    
    
exec(input().strip()) # DON'T remove this line
    
# 1642209, 2022-09-24 10:35:57, compilation error (0%)

def f1(a, b, c):
    y = []
    if a >= 0:
        y.append(a)
    if b >= 0:
        y.append(b)
    if c >= 0:
        y.append(c)
    z = min(y)
    return z
def f2(a, b, c):
    o = []
    if a <= 0:
        o.append(a)
    if b <= 0:
        o.append(b)
    if c <= 0:
        o.append(c)
    p = max(o)
    return p
def f3(a, b, c):
    (p) = int(a+b+c)
    l = []
    if p >= 0:
        l.append(p)
    if p < 0 :
        p = p*(-1)
        l.append(p)
    l = l[0]
    if len(l) = 2:
        k = l//10
    if len(l) =3 :
        k = //100
        
    
    return k
def f4(a, b, c):
    (m) = int(a+b+c)
    q = []
    if m >= 0:
        q.append(m)
    if m < 0 :
        m = m*(-1)
        q.append(m)
    u = q[0]
    u = u%10
    return u
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print ( f1(a, b, c))
    if s1 == 0 and s2 == 1 :
        print ( f2(a, b, c))
    if s1 == 1 and s2 ==0 :
        print ( f3(a, b, c))
    if s1 ==1 and s2 == 1:
        print(f4(a, b, c))
    if s1 != 0 and s2 != 0 or s1 != 0 and s2 != 1 or s1 != 1 and s2 !=0 or s1 !=1 and s2 != 1 :
        print ('Error')
    
    
exec(input().strip()) # DON'T remove this line
 
# 1642224, 2022-09-24 10:36:08, compilation error (0%)

def f1(a, b, c):
    y = []
    if a >= 0:
        y.append(a)
    if b >= 0:
        y.append(b)
    if c >= 0:
        y.append(c)
    z = min(y)
    return z
def f2(a, b, c):
    o = []
    if a <= 0:
        o.append(a)
    if b <= 0:
        o.append(b)
    if c <= 0:
        o.append(c)
    p = max(o)
    return p
def f3(a, b, c):
    (p) = int(a+b+c)
    l = []
    if p >= 0:
        l.append(p)
    if p < 0 :
        p = p*(-1)
        l.append(p)
    l = l[0]
    if len(l) == 2:
        k = l//10
    if len(l) ==3 :
        k = //100
        
    
    return k
def f4(a, b, c):
    (m) = int(a+b+c)
    q = []
    if m >= 0:
        q.append(m)
    if m < 0 :
        m = m*(-1)
        q.append(m)
    u = q[0]
    u = u%10
    return u
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print ( f1(a, b, c))
    if s1 == 0 and s2 == 1 :
        print ( f2(a, b, c))
    if s1 == 1 and s2 ==0 :
        print ( f3(a, b, c))
    if s1 ==1 and s2 == 1:
        print(f4(a, b, c))
    if s1 != 0 and s2 != 0 or s1 != 0 and s2 != 1 or s1 != 1 and s2 !=0 or s1 !=1 and s2 != 1 :
        print ('Error')
    
    
exec(input().strip()) # DON'T remove this line
# 1642285, 2022-09-24 10:36:55, compilation error (0%)

def f1(a, b, c):
    y = []
    if a >= 0:
        y.append(a)
    if b >= 0:
        y.append(b)
    if c >= 0:
        y.append(c)
    z = min(y)
    return z
def f2(a, b, c):
    o = []
    if a <= 0:
        o.append(a)
    if b <= 0:
        o.append(b)
    if c <= 0:
        o.append(c)
    p = max(o)
    return p
def f3(a, b, c):
    (p) = int(a+b+c)
    l = []
    if p >= 0:
        l.append(p)
    if p < 0 :
        p = p*(-1)
        l.append(p)
    l = l[0]
    if len(l) == 2:
        k = l//10
    if len(l) ==3 :
        k = //100
        
    
    return k
def f4(a, b, c):
    (m) = int(a+b+c)
    q = []
    if m >= 0:
        q.append(m)
    if m < 0 :
        m = m*(-1)
        q.append(m)
    u = q[0]
    u = u%10
    return u
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print ( f1(a, b, c))
    if s1 == 0 and s2 == 1 :
        print ( f2(a, b, c))
    if s1 == 1 and s2 ==0 :
        print ( f3(a, b, c))
    if s1 ==1 and s2 == 1:
        print(f4(a, b, c))
    if s1 != 0 and s2 != 0 or s1 != 0 and s2 != 1 or s1 != 1 and s2 !=0 or s1 !=1 and s2 != 1 :
        print ('Error')
    
    
exec(input().strip()) # DON'T remove this line
# 1642374, 2022-09-24 10:37:58, --xP[--][PxPx] (17%)

def f1(a, b, c):
    y = []
    if a >= 0:
        y.append(a)
    if b >= 0:
        y.append(b)
    if c >= 0:
        y.append(c)
    z = min(y)
    return z
def f2(a, b, c):
    o = []
    if a <= 0:
        o.append(a)
    if b <= 0:
        o.append(b)
    if c <= 0:
        o.append(c)
    p = max(o)
    return p
def f3(a, b, c):
    (p) = int(a+b+c)
    l = []
    if p >= 0:
        l.append(p)
    if p < 0 :
        p = p*(-1)
        l.append(p)
    l = l[0]
    if len(l) == 2:
        k = l//10
    if len(l) ==3 :
        k = l//100
        
    
    return k
def f4(a, b, c):
    (m) = int(a+b+c)
    q = []
    if m >= 0:
        q.append(m)
    if m < 0 :
        m = m*(-1)
        q.append(m)
    u = q[0]
    u = u%10
    return u
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print ( f1(a, b, c))
    if s1 == 0 and s2 == 1 :
        print ( f2(a, b, c))
    if s1 == 1 and s2 ==0 :
        print ( f3(a, b, c))
    if s1 ==1 and s2 == 1:
        print(f4(a, b, c))
    if s1 != 0 and s2 != 0 or s1 != 0 and s2 != 1 or s1 != 1 and s2 !=0 or s1 !=1 and s2 != 1 :
        print ('Error')
    
    
exec(input().strip()) # DON'T remove this line

6531104421
# 1640165, 2022-09-24 09:50:07, --xx[xx][xxxx] (0%)

def f1(a, b, c):
    min1 = 0
    if a < b:
        min1 = a
    else:
        min1 = b

    if min1 <c:
        print(min1)
    else:
        min1 = c
        print(min1)
def f2(a, b, c):
    max1 = 0
    if a > b:
        max1 = a
    else:
        max1 = b

    if max1 > c:
        print(max1)
    else:
        max1 = c
        print(max1)
        
        
        
exec(input().strip()) # DON'T remove this line





# 1640291, 2022-09-24 09:53:25, ----[xx][xxxx] (0%)

def f1(a, b, c):
    min1 = 0
    if a < b:
        min1 = a
    else:
        min1 = b

    if min1 <c:
        return(min1)
    else:
        min1 = c
        return(min1)
def f2(a, b, c):
    max1 = 0
    if a > b:
        max1 = a
    else:
        max1 = b

    if max1 > c:
        return(max1)
    else:
        max1 = c
        return(max1)
def f3(a,b,c):
    num = a + b + c
def f4(a,b,c):
    num = a + b + c
    numedit = num%10
    return numedit
    
        
        
        
exec(input().strip()) # DON'T remove this line





# 1640440, 2022-09-24 09:57:54, compilation error (0%)

def f1(a, b, c):
    min1 = 0
    if a < b:
        min1 = a
    else:
        min1 = b

    if min1 <c:
        return(min1)
    else:
        min1 = c
        return(min1)
def f2(a, b, c):
    max1 = 0
    if a > b:
        max1 = a
    else:
        max1 = b

    if max1 > c:
        return(max1)
    else:
        max1 = c
        return(max1)
def f3(a,b,c):
    num = a + b + c
def f4(a,b,c):
    num = a + b + c
    numedit = num%10
    return numedit
def main():
    
        
        
        
exec(input().strip()) # DON'T remove this line
# 1640501, 2022-09-24 09:59:20, compilation error (0%)

def f1(a, b, c):
    min1 = 0
    if a < b:
        min1 = a
    else:
        min1 = b

    if min1 <c:
        return(min1)
    else:
        min1 = c
        return(min1)
def f2(a, b, c):
    max1 = 0
    if a > b:
        max1 = a
    else:
        max1 = b

    if max1 > c:
        return(max1)
    else:
        max1 = c
        return(max1)
def f3(a,b,c):
    num = a + b + c
def f4(a,b,c):
    num = abs(a + b + c)
    numedit = num%10
    return numedit
def main():
    
        
        
        
exec(input().strip()) # DON'T remove this line
# 1640552, 2022-09-24 10:00:48, xxxP[xx][xxxx] (17%)


def f4(a,b,c):
    num = abs(a + b + c)
    numedit = num%10
    return numedit

    
        
        
        
exec(input().strip()) # DON'T remove this line
# 1641533, 2022-09-24 10:24:22, compilation error (0%)

def f1(a,b,c):
  if a>0 and b>0:
        if a < b:
            min1 = a
        else:
            min1 = b
        if c > 0 :
            if min1 <c:
                print(min1)
            else:
                min1 = c
                print(min1)
else:
    a>0 and c>0 
    if a < c:
        min1 = a
        print(min1)
    else:
        min1 = c
        print(min1)


def f4(a,b,c):
    num = abs(a + b + c)
    numedit = num%10
    return numedit

    
      
        
exec(input().strip()) # DON'T remove this line
# 1641592, 2022-09-24 10:25:24, -xxP[xx][xxxx] (17%)

def f1(a,b,c):
  if a>0 and b>0:
        if a < b:
            min1 = a
        else:
            min1 = b
        if c > 0 :
            if min1 <c:
                return min1
            else:
                min1 = c
                return min1
  else:
    a>0 and c>0 
    if a < c:
        min1 = a
        return min1
    else:
        min1 = c
        return min1


def f4(a,b,c):
    num = abs(a + b + c)
    numedit = num%10
    return numedit

    
      
        
exec(input().strip()) # DON'T remove this line
# 1641649, 2022-09-24 10:26:21, -x-P[xx][xxxx] (17%)

def f1(a,b,c):
  if a>0 and b>0:
        if a < b:
            min1 = a
        else:
            min1 = b
        if c > 0 :
            if min1 <c:
                return min1
            else:
                min1 = c
                return min1
  else:
    a>0 and c>0 
    if a < c:
        min1 = a
        return min1
    else:
        min1 = c
        return min1
def f3(a,b,c):
    num = abs(a + b + c)
    numedit = num - num%10 - num%100
    return numedit

def f4(a,b,c):
    num = abs(a + b + c)
    numedit = num%10
    return numedit

    
      
        
exec(input().strip()) # DON'T remove this line
# 1642233, 2022-09-24 10:36:14, -x-P[xx][xxxx] (17%)

def f1(a,b,c):
  if a>0 and b>0:
        if a < b:
            min1 = a
        else:
            min1 = b
        if c > 0 :
            if min1 <c:
                return min1
            else:
                min1 = c
                return min1
  else:
    a>0 and c>0 
    if a < c:
        min1 = a
        return min1
    else:
        min1 = c
        return min1
def f3(a,b,c):
    num = abs(a + b + c)
    numedit = num-num%100-(num%100-10)
    return numedit

def f4(a,b,c):
    num = abs(a + b + c)
    numedit = num%10
    return numedit

    
      
        
exec(input().strip()) # DON'T remove this line
# 1642310, 2022-09-24 10:37:16, -x-P[xx][xxxx] (17%)

def f1(a,b,c):
  if a>0 and b>0:
        if a < b:
            min1 = a
        else:
            min1 = b
        if c > 0 :
            if min1 <c:
                return min1
            else:
                min1 = c
                return min1
  else:
    a>0 and c>0 
    if a < c:
        min1 = a
        return min1
    else:
        min1 = c
        return min1
def f3(a,b,c):
    num = abs(a + b + c)
    numedit = num-num%100-(num%100-10)
    return numedit

def f4(a,b,c):
    num = abs(a + b + c)
    numedit = num%10
    return numedit
def main():
  print(f4(a,b,c))

    
      
        
exec(input().strip()) # DON'T remove this line
# 1642373, 2022-09-24 10:37:56, compilation error (0%)

def f1(a,b,c):
  if a>0 and b>0:
        if a < b:
            min1 = a
        else:
            min1 = b
        if c > 0 :
            if min1 <c:
                return min1
            else:
                min1 = c
                return min1
  else:
    a>0 and c>0 
    if a < c:
        min1 = a
        return min1
    else:
        min1 = c
        return min1
def f3(a,b,c):
    num = abs(a + b + c)
    numedit = num-num%100-(num%100-10)
    return numedit

def f4(a,b,c):
    num = abs(a + b + c)
    numedit = num%10
    return numedit
def main():
  if f1 = f2 = 1:
    print(f4(a,b,c))

    
      
        
exec(input().strip()) # DON'T remove this line
# 1642436, 2022-09-24 10:38:41, -x-P[xx][xxxx] (17%)

def f1(a,b,c):
  if a>0 and b>0:
        if a < b:
            min1 = a
        else:
            min1 = b
        if c > 0 :
            if min1 <c:
                return min1
            else:
                min1 = c
                return min1
  else:
    a>0 and c>0 
    if a < c:
        min1 = a
        return min1
    else:
        min1 = c
        return min1
def f3(a,b,c):
    num = abs(a + b + c)
    numedit = num-num%100-(num%100-10)
    return numedit

def f4(a,b,c):
    num = abs(a + b + c)
    numedit = num%10
    return numedit


    
      
        
exec(input().strip()) # DON'T remove this line

6230148621
# 1640460, 2022-09-24 09:58:35, xxP-[--][P-P-] (17%)

def f1(a,b,c):
    x = [a,b,c]
    i = 0
    y = []
    if x[i] <= 0:
        pass
    else :
        y += str(x[i])
    z = min(y)
    return int(z)

def f2(a, b, c):
    x = [a,b,c]
    i = 0
    w = []
    if x[i] >= 0:
        pass
    else :
        w += str(x[i])
        u = max(w)
    return int(u)

def f3(a, b, c):

    x = [a,b,c]
    sum_ = int(a)+int(b)+int(c)
    s = list(str(sum_))
    first = []
    i = 0
    if s[i] == '-' :
        first += s[i+1]
    else :
        first += s[i]
    a = int(first[0])
    return a
    
def f4(a, b, c):
    x = [a,b,c]
    sum_ = int(a)+int(b)+int(c)
    s = list(str(sum_))
    return s[-1]
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else :
        print('Error')
    
exec(input().strip()) # DON'T remove this line

# 1641173, 2022-09-24 10:17:01, xxP-[--][P-P-] (17%)

def f1(a,b,c):
    x = [a,b,c]
    i = 0
    y = []
    if x[i] <= 0:
        pass
    else :
        y += str(x[i])
    z = min(y)
    return int(z)

def f2(a, b, c):
    x = [a,b,c]
    i = 0
    w = []
    for i in range(len(x)-1):
        if x[i] >= 0 :
            pass
        else :
            w.append(x[i])
    ans = max(w)
    return ans

def f3(a, b, c):

    x = [a,b,c]
    sum_ = int(a)+int(b)+int(c)
    s = list(str(sum_))
    first = []
    i = 0
    if s[i] == '-' :
        first += s[i+1]
    else :
        first += s[i]
    a = int(first[0])
    return a
    
def f4(a, b, c):
    x = [a,b,c]
    sum_ = int(a)+int(b)+int(c)
    s = list(str(sum_))
    return s[-1]
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else :
        print('Error')
    
exec(input().strip()) # DON'T remove this line
# 1641192, 2022-09-24 10:17:24, xxP-[--][P-P-] (17%)

def f1(a,b,c):
    x = [a,b,c]
    i = 0
    y = []
    if x[i] <= 0:
        pass
    else :
        y += str(x[i])
    z = min(y)
    return int(z)

def f2(a, b, c):
    x = [a,b,c]
    i = 0
    w = []
    for i in range(len(x)-1):
        if x[i] >= 0 :
            pass
        else :
            w.append(x[i])
    ans = max(w)
    return ans

def f3(a, b, c):

    x = [a,b,c]
    sum_ = int(a)+int(b)+int(c)
    s = list(str(sum_))
    first = []
    i = 0
    if s[i] == '-' :
        first += s[i+1]
    else :
        first += s[i]
    a = int(first[0])
    return a
    
def f4(a, b, c):
    x = [a,b,c]
    sum_ = int(a)+int(b)+int(c)
    s = list(str(sum_))
    return s[-1]
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else :
        print('Error')
    
exec(input().strip()) # DON'T remove this line
# 1641257, 2022-09-24 10:18:47, xxP-[--][P-P-] (17%)

def f1(a,b,c):
    x = [a,b,c]
    i = 0
    y = []
    if x[i] <= 0:
        pass
    else :
        y += str(x[i])
    z = min(y)
    return int(z)

def f2(a, b, c):
    x = [a,b,c]
    i = 0
    w = []
    for i in range(len(x)-1):
        if x[i] >= 0 :
            pass
        else :
            w.append(x[i])
    ans = max(w)
    return ans

def f3(a, b, c):

    x = [a,b,c]
    sum_ = int(a)+int(b)+int(c)
    s = list(str(sum_))
    first = []
    i = 0
    if s[i] == '-' :
        first += s[i+1]
    else :
        first += s[i]
    a = int(first[0])
    return a
    
def f4(a, b, c):
    x = [a,b,c]
    sum_ = int(a)+int(b)+int(c)
    s = list(str(sum_))
    return s[-1]
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else :
        print('Error')
    
exec(input().strip()) # DON'T remove this line
# 1641385, 2022-09-24 10:21:04, xxP-[--][P-P-] (17%)

def f1(a,b,c):
    x = [a,b,c]
    i = 0
    y = []
    for i in range(len(x)-1):
        if x[i] < 0 :
            pass
        else :
            y.append(x[i])
    ans = max(y)
    return ans

def f2(a, b, c):
    x = [a,b,c]
    i = 0
    w = []
    for i in range(len(x)-1):
        if x[i] >= 0 :
            pass
        else :
            w.append(x[i])
    ans = max(w)
    return ans

def f3(a, b, c):

    x = [a,b,c]
    sum_ = int(a)+int(b)+int(c)
    s = list(str(sum_))
    first = []
    i = 0
    if s[i] == '-' :
        first += s[i+1]
    else :
        first += s[i]
    a = int(first[0])
    return a
    
def f4(a, b, c):
    x = [a,b,c]
    sum_ = int(a)+int(b)+int(c)
    s = list(str(sum_))
    return s[-1]
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else :
        print('Error')
    
exec(input().strip()) # DON'T remove this line
# 1641438, 2022-09-24 10:22:18, xxP-[--][P-P-] (17%)

def f1(a,b,c):
    x = [a,b,c]
    i = 0
    y = []
    for i in range(len(x)-1):
        if x[i] < 0 :
            pass
        else :
            y.append(x[i])
    ans = max(y)
    return ans

def f2(a, b, c):
    x = [a,b,c]
    i = 0
    w = []
    for i in range(len(x)-1):
        if x[i] >= 0 :
            pass
        else :
            w.append(x[i])
    ans = max(w)
    return ans

def f3(a, b, c):

    x = [a,b,c]
    sum_ = int(a)+int(b)+int(c)
    s = list(str(sum_))
    first = []
    i = 0
    if s[i] == '-' :
        first += s[i+1]
    else :
        first += s[i]
    a = int(first[0])
    return a
    
def f4(a, b, c):
    x = [a,b,c]
    sum_ = int(a)+int(b)+int(c)
    s = list(str(sum_))
    return s[:-1]
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else :
        print('Error')
    
exec(input().strip()) # DON'T remove this line
# 1641581, 2022-09-24 10:25:07, xxx-[--][P-P-] (0%)

def f1(a,b,c):
    x = [a,b,c]
    i = 0
    y = []
    for i in range(len(x)-1):
        if x[i] < 0 :
            pass
        else :
            y.append(x[i])
    ans = max(y)
    return ans

def f2(a, b, c):
    x = [a,b,c]
    i = 0
    w = []
    for i in range(len(x)-1):
        if x[i] >= 0 :
            pass
        else :
            w.append(x[i])
    ans = max(w)
    return ans

def f3(a, b, c):

    x = [a,b,c]
    sum_ = int(a)+int(b)+int(c)
    s = list(str(sum_))
    first = []
    i = 0
    for i in range(len(x)-1):
        if s[i] == '-' :
            first += s[i+1]
        else :
            first += s[i]
    a = int(first[0])
    return a
    
def f4(a, b, c):
    x = [a,b,c]
    sum_ = int(a)+int(b)+int(c)
    s = list(str(sum_))
    return s[:-1]
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else :
        print('Error')
    
exec(input().strip()) # DON'T remove this line
# 1641617, 2022-09-24 10:25:47, xxP-[--][P-P-] (17%)

def f1(a,b,c):
    x = [a,b,c]
    i = 0
    y = []
    for i in range(len(x)-1):
        if x[i] < 0 :
            pass
        else :
            y.append(x[i])
    ans = max(y)
    return ans

def f2(a, b, c):
    x = [a,b,c]
    i = 0
    w = []
    for i in range(len(x)-1):
        if x[i] >= 0 :
            pass
        else :
            w.append(x[i])
    ans = max(w)
    return ans

def f3(a, b, c):

    x = [a,b,c]
    sum_ = int(a)+int(b)+int(c)
    s = list(str(sum_))
    first = []
    i = 0
    if s[i] == '-' :
        first += s[i+1]
    else :
        first += s[i]
    a = int(first[0])
    return a
    
def f4(a, b, c):
    x = [a,b,c]
    sum_ = int(a)+int(b)+int(c)
    s = list(str(sum_))
    return s[:-1]
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else :
        print('Error')
    
exec(input().strip()) # DON'T remove this line
# 1641908, 2022-09-24 10:30:52, xxx-[--][P-P-] (0%)

def f1(a,b,c):
    x = [a,b,c]
    i = 0
    y = []
    for i in range(len(x)-1):
        if x[i] < 0 :
            pass
        else :
            y.append(x[i])
    ans = max(y)
    return ans

def f2(a, b, c):
    x = [a,b,c]
    i = 0
    w = []
    for i in range(len(x)-1):
        if x[i] >= 0 :
            pass
        else :
            w.append(x[i])
    ans = max(w)
    return ans

def f3(a, b, c):

    x = [a,b,c]
    sum_ = int(a)+int(b)+int(c)
    s = list(str(sum_))
    first = []
    i = 0
    for i in range(len(x)-1):
        if s[i] == '-' :
            first += s[i+1]
        else :
            first += s[i]
    a = int(first[0])
    return a
    
def f4(a, b, c):
    x = [a,b,c]
    sum_ = str(int(a)+int(b)+int(c))
    return sum_[-1]
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else :
        print('Error')
    
exec(input().strip()) # DON'T remove this line
# 1641937, 2022-09-24 10:31:27, xxx-[--][P-P-] (0%)

def f1(a,b,c):
    x = [a,b,c]
    i = 0
    y = []
    for i in range(len(x)-1):
        if x[i] < 0 :
            pass
        else :
            y.append(x[i])
    ans = max(y)
    return ans

def f2(a, b, c):
    x = [a,b,c]
    i = 0
    w = []
    for i in range(len(x)-1):
        if x[i] >= 0 :
            pass
        else :
            w.append(x[i])
    ans = max(w)
    return ans

def f3(a, b, c):

    x = [a,b,c]
    sum_ = int(a)+int(b)+int(c)
    s = list(str(sum_))
    first = []
    i = 0
    for i in range(len(x)-1):
        if s[i] == '-' :
            first += s[i+1]
        else :
            first += s[i]
    a = int(first[0])
    return a
    
def f4(a, b, c):
    x = [a,b,c]
    sum_ = int(a)+int(b)+int(c)
    s = list(str(sum_))
    return s[-1]
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else :
        print('Error')
    
exec(input().strip()) # DON'T remove this line
# 1641964, 2022-09-24 10:31:56, xxP-[--][P-P-] (17%)

def f1(a,b,c):
    x = [a,b,c]
    i = 0
    y = []
    for i in range(len(x)-1):
        if x[i] < 0 :
            pass
        else :
            y.append(x[i])
    ans = max(y)
    return ans

def f2(a, b, c):
    x = [a,b,c]
    i = 0
    w = []
    for i in range(len(x)-1):
        if x[i] >= 0 :
            pass
        else :
            w.append(x[i])
    ans = max(w)
    return ans

def f3(a, b, c):

    x = [a,b,c]
    sum_ = int(a)+int(b)+int(c)
    s = list(str(sum_))
    first = []
    i = 0
    if s[i] == '-' :
        first += s[i+1]
    else :
        first += s[i]
    a = int(first[0])
    return a
    
def f4(a, b, c):
    x = [a,b,c]
    sum_ = int(a)+int(b)+int(c)
    s = list(str(sum_))
    return s[:-1]
    
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else :
        print('Error')
    
exec(input().strip()) # DON'T remove this line

6531522021
# 1639460, 2022-09-24 09:30:56, xxxx[xx][xxxx] (0%)

f1,f2,f3,f4 = input().split()
a = int(a)
b = int(b)
c = int(c)
-1000 <= (a,b,c) <= 1000
a or b or c > 0
a or b or c < 0

def f1(a,b,c):
    while a and b and c > 0:
        print(min(f1))

def f2(a,b,c):
    while a and b and c < 0:
      print(max(f2))
# 1641000, 2022-09-24 10:12:38, xxxx[xx][xxxx] (0%)

s1,s2,a,b,c = input().split()
s1 = int(s1)
s2 = int(s2)
a = int(a)
b = int(b)
c = int(c)
-1000 <= a,b,c <= 1000
a or b or c > 0
a or b or c < 0

def f1(a,b,c):
 list = [a,b,c]
 list.sort()
 min = list[0]
 if min<=0:
  min = list[1]
 if min<=0:
  min = list[2]
 return min

def f2(a,b,c):
 list = [a,b,c]
 list.sort(reverse = True)
 max = list[0]
 if max>=0:
  min = list[1]
 if max>=0:
  max = list[2]
 return max

def f3(a,b,c):
 sum = a+b+c
 sum = sum*(-1)
 sum = str(sum)
 ans = sum[0]
 return ans

def fa(a,b,c):
 sum = a+b+c
 sum = sum*(-1)
 sum = str(sum)
 ans = sum[2]
 return ans


def main():
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print("Error")

    
exec(input().strip())
# 1641479, 2022-09-24 10:23:19, xxxx[xx][xxxx] (0%)

s1,s2,a,b,c = input().split()
s1 = int(s1)
s2 = int(s2)
a = int(a)
b = int(b)
c = int(c)
-1000 <= a,b,c <= 1000
a or b or c > 0
a or b or c < 0

def f1(a,b,c):
 list = [a,b,c]
 list.sort()
 min = list[0]
 if min<=0:
  min = list[1]
 if min<=0:
  min = list[2]
 return min

def f2(a,b,c):
 list = [a,b,c]
 list.sort(reverse = True)
 max = list[0]
 if max>=0:
  min = list[1]
 if max>=0:
  max = list[2]
 return max

def f3(a,b,c):
 sum = a+b+c
 sum = sum*(-1)
 sum = str(sum)
 ans = sum[0]
 return ans

def fa(a,b,c):
 sum = a+b+c
 sum = sum*(-1)
 sum = str(sum)
 ans = sum[2]
 return ans


def main():
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print("Error")

    
exec(input().strip())
# 1642041, 2022-09-24 10:33:27, P---[P-][P-PP] (17%)

def f1(a,b,c):
 list = [a,b,c]
 list.sort()
 min = list[0]
 if min<=0:
  min = list[1]
 if min<=0:
  min = list[2]
 return min

def f2(a,b,c):
 list = [a,b,c]
 list.sort(reverse = True)
 max = list[0]
 if max>=0:
  min = list[1]
 if max>=0:
  max = list[2]
 return max

def f3(a,b,c):
 sum = a+b+c
 sum = sum*(-1)
 sum = str(sum)
 ans = sum[0]
 return ans

def f4(a,b,c):
 sum = a+b+c
 sum = sum*(-1)
 sum = str(sum)
 ans = sum[2]
 return ans

def main():
 s1,s2,a,b,c = input().split()
 s1 = int(s1)
 s2 = int(s2)
 a = int(a)
 b = int(b)
 c = int(c)
 if s1==0 and s2==0:
  print(f1(a,b,c))
 elif s1==0 and s2==1:
  print(f2(a,b,c))
 elif s1==1 and s2==0:
  print(f3(a,b,c))
 elif s1==1 and s2==1:
  print(f4(a,b,c))
 else:
  print("Error")

exec(input().strip())    
# 1642089, 2022-09-24 10:34:15, xxxx[xx][xxxx] (0%)

s1 = int(s1)
s2 = int(s2)
a = int(a)
b = int(b)
c = int(c)
-1000 <= a,b,c <= 1000
a or b or c > 0
a or b or c < 0
def f1(a,b,c):
 list = [a,b,c]
 list.sort()
 min = list[0]
 if min<=0:
  min = list[1]
 if min<=0:
  min = list[2]
 return min

def f2(a,b,c):
 list = [a,b,c]
 list.sort(reverse = True)
 max = list[0]
 if max>=0:
  min = list[1]
 if max>=0:
  max = list[2]
 return max

def f3(a,b,c):
 sum = a+b+c
 sum = sum*(-1)
 sum = str(sum)
 ans = sum[0]
 return ans

def f4(a,b,c):
 sum = a+b+c
 sum = sum*(-1)
 sum = str(sum)
 ans = sum[2]
 return ans

def main():
 s1,s2,a,b,c = input().split()
 s1 = int(s1)
 s2 = int(s2)
 a = int(a)
 b = int(b)
 c = int(c)
 if s1==0 and s2==0:
  print(f1(a,b,c))
 elif s1==0 and s2==1:
  print(f2(a,b,c))
 elif s1==1 and s2==0:
  print(f3(a,b,c))
 elif s1==1 and s2==1:
  print(f4(a,b,c))
 else:
  print("Error")

exec(input().strip())
# 1642144, 2022-09-24 10:35:01, P---[P-][P-PP] (17%)

def f1(a,b,c):
 list = [a,b,c]
 list.sort()
 min = list[0]
 if min<=0:
  min = list[1]
 if min<=0:
  min = list[2]
 return min

def f2(a,b,c):
 list = [a,b,c]
 list.sort(reverse = True)
 max = list[0]
 if max>=0:
  min = list[1]
 if max>=0:
  max = list[2]
 return max

def f3(a,b,c):
 sum = a+b+c
 sum = sum*(-1)
 sum = str(sum)
 ans = sum[0]
 return ans

def f4(a,b,c):
 sum = a+b+c
 sum = sum*(-1)
 sum = str(sum)
 ans = sum[2]
 return ans

def main():
 s1,s2,a,b,c = input().split()
 s1 = int(s1)
 s2 = int(s2)
 a = int(a)
 b = int(b)
 c = int(c)
 if s1==0 and s2==0:
  print(f1(a,b,c))
 elif s1==0 and s2==1:
  print(f2(a,b,c))
 elif s1==1 and s2==0:
  print(f3(a,b,c))
 elif s1==1 and s2==1:
  print(f4(a,b,c))
 else:
  print("Error")

exec(input().strip())
# 1642198, 2022-09-24 10:35:44, P---[P-][P-PP] (17%)

def f1(a,b,c):
 list = [a,b,c]
 list.sort()
 min = list[0]
 if min<=0:
  min = list[1]
 if min<=0:
  min = list[2]
 return min

def f2(a,b,c):
 list = [a,b,c]
 list.sort(reverse = True)
 max = list[0]
 if max>=0:
  min = list[1]
 if max>=0:
  max = list[2]
 return max

def f3(a,b,c):
 sum = a+b+c
 sum = sum*(-1)
 sum = str(sum)
 ans = sum[0]
 return ans

def f4(a,b,c):
 sum = a+b+c
 sum = sum*(-1)
 sum = str(sum)
 ans = sum[2]
 return ans

def main():
 s1,s2,a,b,c = input().split()
 s1 = int(s1)
 s2 = int(s2)
 a = int(a)
 b = int(b)
 c = int(c)
 if s1==0 and s2==0:
  print(f1(a,b,c))
 elif s1==0 and s2==1:
  print(f2(a,b,c))
 elif s1==1 and s2==0:
  print(f3(a,b,c))
 elif s1==1 and s2==1:
  print(f4(a,b,c))
 else:
  print("Error")

exec(input().strip())
# 1642334, 2022-09-24 10:37:28, compilation error (0%)

s1 = int(s1)
s2 = int(s2)
a = int(a)
b = int(b)
c = int(c)

-1000 =< a,b,c <= 1000
a or b or c > 0
a or b or c < 0

def f1(a,b,c):
 list = [a,b,c]
 list.sort()
 min = list[0]
 if min<=0:
  min = list[1]
 if min<=0:
  min = list[2]
 return min

def f2(a,b,c):
 list = [a,b,c]
 list.sort(reverse = True)
 max = list[0]
 if max>=0:
  min = list[1]
 if max>=0:
  max = list[2]
 return max

def f3(a,b,c):
 sum = a+b+c
 sum = sum*(-1)
 sum = str(sum)
 ans = sum[0]
 return ans

def f4(a,b,c):
 sum = a+b+c
 sum = sum*(-1)
 sum = str(sum)
 ans = sum[2]
 return ans

def main():
 s1,s2,a,b,c = input().split()
 s1 = int(s1)
 s2 = int(s2)
 a = int(a)
 b = int(b)
 c = int(c)
 if s1==0 and s2==0:
  print(f1(a,b,c))
 elif s1==0 and s2==1:
  print(f2(a,b,c))
 elif s1==1 and s2==0:
  print(f3(a,b,c))
 elif s1==1 and s2==1:
  print(f4(a,b,c))
 else:
  print("Error")

exec(input().strip())
# 1642371, 2022-09-24 10:37:55, P---[P-][P-PP] (17%)

def f1(a,b,c):
 list = [a,b,c]
 list.sort()
 min = list[0]
 if min<=0:
  min = list[1]
 if min<=0:
  min = list[2]
 return min

def f2(a,b,c):
 list = [a,b,c]
 list.sort(reverse = True)
 max = list[0]
 if max>=0:
  min = list[1]
 if max>=0:
  max = list[2]
 return max

def f3(a,b,c):
 sum = a+b+c
 sum = sum*(-1)
 sum = str(sum)
 ans = sum[0]
 return ans

def f4(a,b,c):
 sum = a+b+c
 sum = sum*(-1)
 sum = str(sum)
 ans = sum[2]
 return ans

def main():
 s1,s2,a,b,c = input().split()
 s1 = int(s1)
 s2 = int(s2)
 a = int(a)
 b = int(b)
 c = int(c)
 if s1==0 and s2==0:
  print(f1(a,b,c))
 elif s1==0 and s2==1:
  print(f2(a,b,c))
 elif s1==1 and s2==0:
  print(f3(a,b,c))
 elif s1==1 and s2==1:
  print(f4(a,b,c))
 else:
  print("Error")

exec(input().strip())
# 1642407, 2022-09-24 10:38:20, P---[P-][P-PP] (17%)

def f1(a,b,c):
 list = [a,b,c]
 list.sort()
 min = list[0]
 if min<=0:
  min = list[1]
 if min<=0:
  min = list[2]
 return min

def f2(a,b,c):
 list = [a,b,c]
 list.sort(reverse = True)
 max = list[0]
 if max>=0:
  min = list[1]
 if max>=0:
  max = list[2]
 return max

def f3(a,b,c):
 sum = a+b+c
 sum = sum*(-1)
 sum = str(sum)
 ans = sum[0]
 return ans

def f4(a,b,c):
 sum = a+b+c
 sum = sum*(-1)
 sum = str(sum)
 ans = sum[len(sum)-1]
 return ans

def main():
 s1,s2,a,b,c = input().split()
 s1 = int(s1)
 s2 = int(s2)
 a = int(a)
 b = int(b)
 c = int(c)
 if s1==0 and s2==0:
  print(f1(a,b,c))
 elif s1==0 and s2==1:
  print(f2(a,b,c))
 elif s1==1 and s2==0:
  print(f3(a,b,c))
 elif s1==1 and s2==1:
  print(f4(a,b,c))
 else:
  print("Error")

exec(input().strip())
# 1642472, 2022-09-24 10:39:08, P---[P-][P-PP] (17%)

def f1(a,b,c):
 list = [a,b,c]
 list.sort()
 min = list[0]
 if min<=0:
  min = list[1]
 if min<=0:
  min = list[2]
 return min

def f2(a,b,c):
 list = [a,b,c]
 list.sort(reverse = True)
 max = list[0]
 if max>=0:
  min = list[1]
 if max>=0:
  max = list[2]
 return max

def f3(a,b,c):
 sum = a+b+c
 sum = sum*(-1)
 sum = str(sum)
 ans = sum[0]
 return ans

def f4(a,b,c):
 sum = a+b+c
 sum = sum*(-1)
 sum = str(sum)
 ans = sum[len(sum)-1]
 return ans

def main():
 s1,s2,a,b,c = input().split()
 s1 = int(s1)
 s2 = int(s2)
 a = int(a)
 b = int(b)
 c = int(c)
 if s1==0 and s2==0:
  print(f1(a,b,c))
 elif s1==0 and s2==1:
  print(f2(a,b,c))
 elif s1==1 and s2==0:
  print(f3(a,b,c))
 elif s1==1 and s2==1:
  print(f4(a,b,c))
 else:
  print("Error")

exec(input().strip())

6530073421
# 1639598, 2022-09-24 09:34:24, ----[--][----] (0%)

def f1(a,b,c):
    if a>0:
        min_f1 = a            
    elif b>0 and b < min_f1 :
        min_f1 = b
    elif c>0 and c < min_f1:
        min_f1 = c
    return (min_f1)

def f2(a,b,c):
    if a<0:
        max_f1 = a            
    elif b<0 and b > max_f1 :
        max_f1 = b
    elif c<0 and c > max_f1:
        max_f1 = c
    return (max_f1)

def f3(a,b,c):
    d = a+b+c
    d1= str(d)
    d2 = d1[0]
    return (d2)

def f4(a,b,c):
    d = a+b+c
    d1= str(d)
    d2 = d1[-1]
    return (d2)

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0 :
        print(f1(a,b,c))
    elif s1==0 and s2==1 :
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else :
        print("Error")
    
    
# 1639637, 2022-09-24 09:35:20, xx--[--][PPP-] (0%)

def f1(a,b,c):
    if a>0:
        min_f1 = a            
    elif b>0 and b < min_f1 :
        min_f1 = b
    elif c>0 and c < min_f1:
        min_f1 = c
    return (min_f1)

def f2(a,b,c):
    if a<0:
        max_f1 = a            
    elif b<0 and b > max_f1 :
        max_f1 = b
    elif c<0 and c > max_f1:
        max_f1 = c
    return (max_f1)

def f3(a,b,c):
    d = a+b+c
    d1= str(d)
    d2 = d1[0]
    return (d2)

def f4(a,b,c):
    d = a+b+c
    d1= str(d)
    d2 = d1[-1]
    return (d2)

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0 :
        print(f1(a,b,c))
    elif s1==0 and s2==1 :
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else :
        print("Error")
    
exec(input().strip())
    
# 1639672, 2022-09-24 09:36:16, xx--[--][PPP-] (0%)

def f1(a,b,c):
    if a>0:
        min_f1 = a            
    elif b>0 and b < min_f1 :
        min_f1 = b
    elif c>0 and c < min_f1:
        min_f1 = c
    return (min_f1)

def f2(a,b,c):
    if a<0:
        max_f1 = a            
    elif b<0 and b > max_f1 :
        max_f1 = b
    elif c<0 and c > max_f1:
        max_f1 = c
    return (max_f1)

def f3(a,b,c):
    d = a+b+c
    d1= str(d)
    d2 = d1[0]
    return (d2)

def f4(a,b,c):
    d = a+b+c
    d1= str(d)
    d2 = d1[-1]
    return (d2)

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0 :
        print(f1(a,b,c))
    elif s1==0 and s2==1 :
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else :
        print("Error")
exec(input().strip()) 
# 1640662, 2022-09-24 10:03:52, xx--[--][PPP-] (0%)

def f1(a,b,c):
    if a>0:
        min_f1 = a            
    elif b>0 and b < min_f1 :
        min_f1 = b
    elif c>0 and c < min_f1:
        min_f1 = c
    return (min_f1)

def f2(a,b,c):
    if a<0:
        max_f2 = a
    elif b<0 and b > max_f2:
        max_f2 = b
    elif c<0 and c > max_f2:
        max_f2 = c
    return (max_f2)

def f3(a,b,c):
    d = a+b+c
    d1= str(d)
    d2 = d1[0]
    return (d2)

def f4(a,b,c):
    d = a+b+c
    d1= str(d)
    d2 = d1[-1]
    return (d2)

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0 :
        print(f1(a,b,c))
    elif s1==0 and s2==1 :
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else :
        print("Error")

exec(input().strip())   
    
# 1641159, 2022-09-24 10:16:43, xx--[-P][PPP-] (0%)

def f1(a,b,c):
    if a>0:
        min_f1 = a            
        if b>0 and b < min_f1 :
            min_f1 = b
            if c>0 and c < min_f1:
                min_f1 = c
    return (min_f1)

def f2(a,b,c):
    if a<0:
        max_f2 = a
        if b<0 and b>max_f2 :
            max_f2 = b
            if c<0 and c>max_f2 :
                max_f2 = c
    return (max_f2)

def f3(a,b,c):
    d = a+b+c
    d1= str(d)
    d2 = d1[0]
    return (d2)

def f4(a,b,c):
    d = a+b+c
    d1= str(d)
    d2 = d1[-1]
    return (d2)

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0 :
        print(f1(a,b,c))
    elif s1==0 and s2==1 :
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else :
        print("Error")

exec(input().strip())   
# 1641356, 2022-09-24 10:20:36, xx--[-P][PPPP] (17%)

def f1(a,b,c):
    if a>0:
        min_f1 = a            
        if b>0 and b < min_f1 :
            min_f1 = b
            if c>0 and c < min_f1:
                min_f1 = c
    return (min_f1)

def f2(a,b,c):
    if a<0:
        max_f2 = a
        if b<0 and b>max_f2 :
            max_f2 = b
            if c<0 and c>max_f2 :
                max_f2 = c
    return (max_f2)

def f3(a,b,c):
    d = a+b+c
    d1= str(d)
    if d1[0] == "-":
        d2=d1[1]
    else :
        d2=d1[0]
    return (d2)

def f4(a,b,c):
    d = a+b+c
    d1= str(d)
    d2 = d1[-1]
    return (d2)

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0 :
        print(f1(a,b,c))
    elif s1==0 and s2==1 :
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else :
        print("Error")

exec(input().strip())   
    

# 1642199, 2022-09-24 10:35:46, compilation error (0%)

def f1(a,b,c):
    if a>0:
        min_f1 = a            
        if b>0 and b < min_f1 :
            min_f1 = b
            if c>0 and c < min_f1:
                min_f1 = c
    return (min_f1)

def f2(a,b,c):
    if a<0:
        max_f2 = a
        if b<0 and b>max_f2 :
            max_f2 = b
            if c<0 and c>max_f2 :
                max_f2 = c
    return (max_f2)

def f3(a,b,c):
    d = a+b+c
    d1= str(d)
    if d1[0] == "-":
        d2=d1[1]
    else :
        d2=d1[0]
    return (d2)

def f4(a,b,c):
    d = a+b+c
    d1= str(d)
    if d1=="0"
      print("0")
    else :
      d2 = d1[-1]
    return (d2)

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0 :
        print(f1(a,b,c))
    elif s1==0 and s2==1 :
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else :
        print("Error")

exec(input().strip())
# 1642240, 2022-09-24 10:36:20, xx--[-P][PPPP] (17%)

def f1(a,b,c):
    if a>0:
        min_f1 = a            
        if b>0 and b < min_f1 :
            min_f1 = b
            if c>0 and c < min_f1:
                min_f1 = c
    return (min_f1)

def f2(a,b,c):
    if a<0:
        max_f2 = a
        if b<0 and b>max_f2 :
            max_f2 = b
            if c<0 and c>max_f2 :
                max_f2 = c
    return (max_f2)

def f3(a,b,c):
    d = a+b+c
    d1= str(d)
    if d1[0] == "-":
        d2=d1[1]
    else :
        d2=d1[0]
    return (d2)

def f4(a,b,c):
    d = a+b+c
    d1= str(d)
    d2 = d1[-1]
    return (d2)

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0 :
        print(f1(a,b,c))
    elif s1==0 and s2==1 :
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else :
        print("Error")

exec(input().strip())   
    
# 1642341, 2022-09-24 10:37:30, compilation error (0%)

def f1(a,b,c):
    if a>0:
        min_f1 = a            
        if b>0 and b < min_f1 :
            min_f1 = b
            if c>0 and c < min_f1:
                min_f1 = c
    return (min_f1)

def f2(a,b,c):
    if a<0:
        max_f2 = a
        if b<0 and b>max_f2 :
            max_f2 = b
            if c<0 and c>max_f2 :
                max_f2 = c
    return (max_f2)

def f3(a,b,c):
    d = a+b+c
    d1= str(d)
    if d1[0] == "-":
        d2=d1[1]
    else :
        d2=d1[0]
    return (d2)

def f4(a,b,c):
    d = a+b+c
    d1= str(d)
       if d1=="0":
        return 0
    else :
        d2 = d1[-1]
        return (d2)

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0 :
        print(f1(a,b,c))
    elif s1==0 and s2==1 :
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else :
        print("Error")

exec(input().strip())
# 1642355, 2022-09-24 10:37:42, compilation error (0%)

def f1(a,b,c):
    if a>0:
        min_f1 = a            
        if b>0 and b < min_f1 :
            min_f1 = b
            if c>0 and c < min_f1:
                min_f1 = c
    return (min_f1)

def f2(a,b,c):
    if a<0:
        max_f2 = a
        if b<0 and b>max_f2 :
            max_f2 = b
            if c<0 and c>max_f2 :
                max_f2 = c
    return (max_f2)

def f3(a,b,c):
    d = a+b+c
    d1= str(d)
    if d1[0] == "-":
        d2=d1[1]
    else :
        d2=d1[0]
    return (d2)

def f4(a,b,c):
    d = a+b+c
    d1= str(d)
       if d1=="0":
        return 0
    else :
        d2 = d1[-1]
        return (d2)

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0 :
        print(f1(a,b,c))
    elif s1==0 and s2==1 :
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else :
        print("Error")

exec(input().strip())
# 1642381, 2022-09-24 10:38:02, xx--[-P][PPPP] (17%)

def f1(a,b,c):
    if a>0:
        min_f1 = a            
        if b>0 and b < min_f1 :
            min_f1 = b
            if c>0 and c < min_f1:
                min_f1 = c
    return (min_f1)

def f2(a,b,c):
    if a<0:
        max_f2 = a
        if b<0 and b>max_f2 :
            max_f2 = b
            if c<0 and c>max_f2 :
                max_f2 = c
    return (max_f2)

def f3(a,b,c):
    d = a+b+c
    d1= str(d)
    if d1[0] == "-":
        d2=d1[1]
    else :
        d2=d1[0]
    return (d2)

def f4(a,b,c):
    d = a+b+c
    d1= str(d)
    d2 = d1[-1]
    return (d2)

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0 :
        print(f1(a,b,c))
    elif s1==0 and s2==1 :
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else :
        print("Error")

exec(input().strip())   

6530199921
# 1639618, 2022-09-24 09:34:50, --xx[xx][xxxx] (0%)

def f1(a, b, c) :
    if -1000 <=a <= 1000 and -1000 <=b <= 1000 and -1000 <=c <= 1000 and (a > 0 or b > 0 or c > 0) and (a < 0 or b < 0 or c < 0) :
        d = []
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        for e in d :
            if e <= 0 :
                d.remove(e)
        return min(d)
        
def f2(a, b, c) :
    if -1000 <=a <= 1000 and -1000 <=b <= 1000 and -1000 <=c <= 1000 and (a > 0 or b > 0 or c > 0) and (a < 0 or b < 0 or c < 0) :
        d = []
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        for e in d :
            if e >= 0 :
                d.remove(e)
        return max(d)

        
        
exec(input().strip())
# 1640012, 2022-09-24 09:45:46, ----[xx][xxxx] (0%)

def f1(a, b, c) :
    if -1000 <=a <= 1000 and -1000 <=b <= 1000 and -1000 <=c <= 1000 and (a > 0 or b > 0 or c > 0) and (a < 0 or b < 0 or c < 0) :
        d = []
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        for e in d :
            if e <= 0 :
                d.remove(e)
        return min(d)
        
def f2(a, b, c) :
    if -1000 <=a <= 1000 and -1000 <=b <= 1000 and -1000 <=c <= 1000 and (a > 0 or b > 0 or c > 0) and (a < 0 or b < 0 or c < 0) :
        d = []
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        for e in d :
            if e >= 0 :
                d.remove(e)
        return max(d)

def f3(a, b, c) :
    if -1000 <=a <= 1000 and -1000 <=b <= 1000 and -1000 <=c <= 1000 and (a > 0 or b > 0 or c > 0) and (a < 0 or b < 0 or c < 0) :
        d = []
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        ans = sum(d)
        if ans < 0 :
            ans = abs(ans)
        a = str(ans)
        return a[0]
    
def f4(a, b, c) :
    if -1000 <=a <= 1000 and -1000 <=b <= 1000 and -1000 <=c <= 1000 and (a > 0 or b > 0 or c > 0) and (a < 0 or b < 0 or c < 0) :
        d = []
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        ans = sum(d)
        if ans < 0 :
            ans = abs(ans)
        a = str(ans)
        return a[-1]
    
def main() :
    s1, s2, a, b, c = [e for e in input().split()]
    if -1000 <=a <= 1000 and -1000 <=b <= 1000 and -1000 <=c <= 1000 and (a > 0 or b > 0 or c > 0) and (a < 0 or b < 0 or c < 0) :
        if s1 == '0' and s2 == '0' :
            print(f1(a, b, c))
        elif s1 == '0' and s2 == '1' :
            print(f2(a, b, c))
        elif s1 == '1' and s2 == '0' :
            print(f3(a, b, c))
        elif s1 == '1' and s2 == '0' :
            print(f4(a, b, c))
        else :
            print('Error')
            
exec(input().strip())
# 1640196, 2022-09-24 09:50:44, x---[xP][----] (0%)

def f1(a, b, c) :
    if -1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000 and (int(a) > 0 or (int(b) > 0 or int(c) > 0) and int(a) < 0 or int(b) < 0 or int(c) < 0) :        
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        for e in d :
            if e <= 0 :
                d.remove(e)
        return min(d)
        
def f2(a, b, c) :
    if -1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000 and (int(a) > 0 or (int(b) > 0 or int(c) > 0) and int(a) < 0 or int(b) < 0 or int(c) < 0) :
        d = []
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        for e in d :
            if e >= 0 :
                d.remove(e)
        return max(d)

def f3(a, b, c) :
    if -1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000 and (int(a) > 0 or (int(b) > 0 or int(c) > 0) and int(a) < 0 or int(b) < 0 or int(c) < 0) :
        d = []
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        ans = sum(d)
        if ans < 0 :
            ans = abs(ans)
        a = str(ans)
        return a[0]
    
def f4(a, b, c) :
    if -1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000 and (int(a) > 0 or (int(b) > 0 or int(c) > 0) and int(a) < 0 or int(b) < 0 or int(c) < 0) :
        d = []
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        ans = sum(d)
        if ans < 0 :
            ans = abs(ans)
        a = str(ans)
        return a[-1]
    
def main() :
    s1, s2, a, b, c = [e for e in input().split()]
    if -1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000 and (int(a) > 0 or (int(b) > 0 or int(c) > 0) and int(a) < 0 or int(b) < 0 or int(c) < 0) :
        if s1 == '0' and s2 == '0' :
            print(f1(a, b, c))
        elif s1 == '0' and s2 == '1' :
            print(f2(a, b, c))
        elif s1 == '1' and s2 == '0' :
            print(f3(a, b, c))
        elif s1 == '1' and s2 == '1' :
            print(f4(a, b, c))
        else :
            print('Error')
            
exec(input().strip())
# 1640287, 2022-09-24 09:53:19, ----[PP][----] (17%)

def f1(a, b, c) :
    if -1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000 and (int(a) > 0 or (int(b) > 0 or int(c) > 0) and int(a) < 0 or int(b) < 0 or int(c) < 0) :
        d = []
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        for e in d :
            if e <= 0 :
                d.remove(e)
        return min(d)
        
def f2(a, b, c) :
    if -1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000 and (int(a) > 0 or (int(b) > 0 or int(c) > 0) and int(a) < 0 or int(b) < 0 or int(c) < 0) :
        d = []
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        for e in d :
            if e >= 0 :
                d.remove(e)
        return max(d)

def f3(a, b, c) :
    if -1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000 and (int(a) > 0 or (int(b) > 0 or int(c) > 0) and int(a) < 0 or int(b) < 0 or int(c) < 0) :
        d = []
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        ans = sum(d)
        if ans < 0 :
            ans = abs(ans)
        a = str(ans)
        return a[0]
    
def f4(a, b, c) :
    if -1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000 and (int(a) > 0 or (int(b) > 0 or int(c) > 0) and int(a) < 0 or int(b) < 0 or int(c) < 0) :
        d = []
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        ans = sum(d)
        if ans < 0 :
            ans = abs(ans)
        a = str(ans)
        return a[-1]
    
def main() :
    s1, s2, a, b, c = [e for e in input().split()]
    if -1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000 and (int(a) > 0 or (int(b) > 0 or int(c) > 0) and int(a) < 0 or int(b) < 0 or int(c) < 0) :
        if s1 == '0' and s2 == '0' :
            print(f1(a, b, c))
        elif s1 == '0' and s2 == '1' :
            print(f2(a, b, c))
        elif s1 == '1' and s2 == '0' :
            print(f3(a, b, c))
        elif s1 == '1' and s2 == '1' :
            print(f4(a, b, c))
        else :
            print('Error')
            
exec(input().strip())
# 1641389, 2022-09-24 10:21:13, --xx[PP][----] (17%)

def f1(a, b, c) :
    if -1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000 and (int(a) > 0 or (int(b) > 0 or int(c) > 0) and int(a) < 0 or int(b) < 0 or int(c) < 0) :
        d = []
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        for e in d :
            if e <= 0 :
                d.remove(e)
    return min(d)
        
def f2(a, b, c) :
    if -1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000 and (int(a) > 0 or (int(b) > 0 or int(c) > 0) and int(a) < 0 or int(b) < 0 or int(c) < 0) :
        d = []
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        for e in d :
            if e >= 0 :
                d.remove(e)
    return max(d)

def f3(a, b, c) :
    if -1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000 and (int(a) > 0 or (int(b) > 0 or int(c) > 0) and int(a) < 0 or int(b) < 0 or int(c) < 0) :
        d = []
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        ans = sum(d)
        if ans < 0 :
            ans = abs(ans)
        a = str(ans)
    return a[0]
    
def f4(a, b, c) :
    if -1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000 and (int(a) > 0 or (int(b) > 0 or int(c) > 0) and int(a) < 0 or int(b) < 0 or int(c) < 0) :
        d = []
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        ans = sum(d)
        if ans < 0 :
            ans = abs(ans)
        a = str(ans)
    return a[-1]
    
def main() :
    s1, s2, a, b, c = [e for e in input().split()]
    if -1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000 and (int(a) > 0 or (int(b) > 0 or int(c) > 0) and int(a) < 0 or int(b) < 0 or int(c) < 0) :
        if s1 == '0' and s2 == '0' :
            print(f1(a, b, c))
        elif s1 == '0' and s2 == '1' :
            print(f2(a, b, c))
        elif s1 == '1' and s2 == '0' :
            print(f3(a, b, c))
        elif s1 == '1' and s2 == '1' :
            print(f4(a, b, c))
        else :
            print('Error')
            
exec(input().strip())
# 1641611, 2022-09-24 10:25:40, -xxx[-P][P-P-] (0%)

def f1(a, b, c) :
    if (-1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000) and (int(a) > 0 and (int(b) > 0 or int(c) > 0) and int(a) < 0 or int(b) < 0 or int(c) < 0) :
        d = []
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        for e in d :
            if e <= 0 :
                d.remove(e)
        
def f2(a, b, c) :
    if (-1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000) and (int(a) > 0 and (int(b) > 0 or int(c) > 0) and int(a) < 0 or int(b) < 0 or int(c) < 0) :
        d = []
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        for e in d :
            if e >= 0 :
                d.remove(e)
    return max(d)

def f3(a, b, c) :
    if (-1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000) and (int(a) > 0 and (int(b) > 0 or int(c) > 0) and int(a) < 0 or int(b) < 0 or int(c) < 0) :
        d = []
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        ans = sum(d)
        if ans < 0 :
            ans = abs(ans)
        a = str(ans)
    return a[0]
    
def f4(a, b, c) :
    if (-1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000) and (int(a) > 0 and (int(b) > 0 or int(c) > 0) and int(a) < 0 or int(b) < 0 or int(c) < 0) :
        d = []
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        ans = sum(d)
        if ans < 0 :
            ans = abs(ans)
        a = str(ans)
    return a[-1]
    
def main() :
    s1, s2, a, b, c = [e for e in input().split()]
    if (-1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000 and (int(a) > 0) and (int(b) > 0 or int(c) > 0) and int(a) < 0 or int(b) < 0 or int(c) < 0) :
        if s1 == '0' and s2 == '0' :
            print(f1(a, b, c))
        elif s1 == '0' and s2 == '1' :
            print(f2(a, b, c))
        elif s1 == '1' and s2 == '0' :
            print(f3(a, b, c))
        elif s1 == '1' and s2 == '1' :
            print(f4(a, b, c))
        else :
            print('Error')
            
exec(input().strip())
# 1641699, 2022-09-24 10:27:14, ----[--][xxxx] (0%)

def f1(a, b, c) :
    if -1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000 and (int(a) > 0 or (int(b) > 0 or int(c) > 0) and int(a) < 0 or int(b) < 0 or int(c) < 0) :
        d = []
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        for e in d :
            if e <= 0 :
                d.remove(e)
        return min(d)
        
def f2(a, b, c) :
    if -1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000 and (int(a) > 0 or (int(b) > 0 or int(c) > 0) and int(a) < 0 or int(b) < 0 or int(c) < 0) :
        d = []
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        for e in d :
            if e >= 0 :
                d.remove(e)
        return max(d)

def f3(a, b, c) :
    if -1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000 and (int(a) > 0 or (int(b) > 0 or int(c) > 0) and int(a) < 0 or int(b) < 0 or int(c) < 0) :
        d = []
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        ans = sum(d)
        if ans < 0 :
            ans = abs(ans)
        a = str(ans)
        return a[0]
    
def f4(a, b, c) :
    if -1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000 and (int(a) > 0 or (int(b) > 0 or int(c) > 0) and int(a) < 0 or int(b) < 0 or int(c) < 0) :
        d = []
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        ans = sum(d)
        if ans < 0 :
            ans = abs(ans)
        a = str(ans)
        return a[-1]
    
def main() :
    s1, s2, a, b, c = [e for e in input().split()]
    if -1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000 and (int(a) > 0 or (int(b) > 0 or int(c) > 0) and int(a) < 0 or int(b) < 0 or int(c) < 0) :
        if s1 == '0' and s2 == '0' :
            ans = f1(a, b, c)
        elif s1 == '0' and s2 == '1' :
            ans = f2(a, b, c)
        elif s1 == '1' and s2 == '0' :
            ans = f3(a, b, c)
        elif s1 == '1' and s2 == '1' :
            ans = f4(a, b, c)
        else :
            ans ='Error'
    return ans
            
exec(input().strip())
# 1641946, 2022-09-24 10:31:34, ----[PP][----] (17%)

def f1(a, b, c) :
    if (-1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000) and (int(a) > 0 or (int(b) > 0 or int(c) > 0) and int(a) < 0 or int(b) < 0 or int(c) < 0) :
        d = []
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        for e in d :
            if e <= 0 :
                d.remove(e)
        return min(d)
    else :
        return 'Error'
        
def f2(a, b, c) :
    if -1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000 and (int(a) > 0 or (int(b) > 0 or int(c) > 0) and int(a) < 0 or int(b) < 0 or int(c) < 0) :
        d = []
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        for e in d :
            if e >= 0 :
                d.remove(e)
        return max(d)
    else :
        return 'Error'

def f3(a, b, c) :
    if -1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000 and (int(a) > 0 or (int(b) > 0 or int(c) > 0) and int(a) < 0 or int(b) < 0 or int(c) < 0) :
        d = []
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        ans = sum(d)
        if ans < 0 :
            ans = abs(ans)
        a = str(ans)
        return a[0]
    else :
        return 'Error'
    
def f4(a, b, c) :
    if -1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000 and (int(a) > 0 or (int(b) > 0 or int(c) > 0) and int(a) < 0 or int(b) < 0 or int(c) < 0) :
        d = []
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        ans = sum(d)
        if ans < 0 :
            ans = abs(ans)
        a = str(ans)
        return a[-1]
    else :
        return 'Error'
    
def main() :
    s1, s2, a, b, c = [e for e in input().split()]
    if -1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000 and (int(a) > 0 or (int(b) > 0 or int(c) > 0) and int(a) < 0 or int(b) < 0 or int(c) < 0) :
        if s1 == '0' and s2 == '0' :
            print(f1(a, b, c))
        elif s1 == '0' and s2 == '1' :
            print(f2(a, b, c))
        elif s1 == '1' and s2 == '0' :
            print(f3(a, b, c))
        elif s1 == '1' and s2 == '1' :
            print(f4(a, b, c))
        else :
            print('Error')
            
exec(input().strip())
# 1642131, 2022-09-24 10:34:46, ----[PP][----] (17%)

def f1(a, b, c) :
    if (-1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000) and (int(a) > 0 or int(b) > 0 or int(c) > 0) and (int(a) < 0 or int(b) < 0 or int(c) < 0) :
        d = []
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        for e in d :
            if e <= 0 :
                d.remove(e)
        return min(d)
    else :
        return 'Error'
        
def f2(a, b, c) :
    if (-1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000) and (int(a) > 0 or int(b) > 0 or int(c) > 0) and (int(a) < 0 or int(b) < 0 or int(c) < 0) :
        d = []
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        for e in d :
            if e >= 0 :
                d.remove(e)
        return max(d)
    else :
        return 'Error'

def f3(a, b, c) :
    if (-1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000) and (int(a) > 0 or int(b) > 0 or int(c) > 0) and (int(a) < 0 or int(b) < 0 or int(c) < 0) :
        d = []
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        ans = sum(d)
        if ans < 0 :
            ans = abs(ans)
        a = str(ans)
        return a[0]
    else :
        return 'Error'
    
def f4(a, b, c) :
    if (-1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000) and (int(a) > 0 or int(b) > 0 or int(c) > 0) and (int(a) < 0 or int(b) < 0 or int(c) < 0) :
        d = []
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        ans = sum(d)
        if ans < 0 :
            ans = abs(ans)
        a = str(ans)
        return a[-1]
    else :
        return 'Error'
    
def main() :
    s1, s2, a, b, c = [e for e in input().split()]
    if (-1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000) and (int(a) > 0 or int(b) > 0 or int(c) > 0) and (int(a) < 0 or int(b) < 0 or int(c) < 0) :
        if s1 == '0' and s2 == '0' :
            print(f1(a, b, c))
        elif s1 == '0' and s2 == '1' :
            print(f2(a, b, c))
        elif s1 == '1' and s2 == '0' :
            print(f3(a, b, c))
        elif s1 == '1' and s2 == '1' :
            print(f4(a, b, c))
        else :
            print('Error')
            
exec(input().strip())
# 1642273, 2022-09-24 10:36:47, ----[PP][P-P-] (17%)

def f1(a, b, c) :
    if (-1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000) and (int(a) > 0 or int(b) > 0 or int(c) > 0) and (int(a) < 0 or int(b) < 0 or int(c) < 0) :
        d = []
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        for e in d :
            if e <= 0 :
                d.remove(e)
        return min(d)
    else :
        return 'Error'
        
def f2(a, b, c) :
    if (-1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000) and (int(a) > 0 or int(b) > 0 or int(c) > 0) and (int(a) < 0 or int(b) < 0 or int(c) < 0) :
        d = []
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        for e in d :
            if e >= 0 :
                d.remove(e)
        return max(d)
    else :
        return 'Error'

def f3(a, b, c) :
    if (-1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000) and (int(a) > 0 or int(b) > 0 or int(c) > 0) and (int(a) < 0 or int(b) < 0 or int(c) < 0) :
        d = []
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        ans = sum(d)
        if ans < 0 :
            ans = abs(ans)
        a = str(ans)
        return a[0]
    else :
        return 'Error'
    
def f4(a, b, c) :
    if (-1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000) and (int(a) > 0 or int(b) > 0 or int(c) > 0) and (int(a) < 0 or int(b) < 0 or int(c) < 0) :
        d = []
        d.append(int(a))
        d.append(int(b))
        d.append(int(c))
        ans = sum(d)
        if ans < 0 :
            ans = abs(ans)
        a = str(ans)
        return a[-1]
    else :
        return 'Error'
    
def main() :
    s1, s2, a, b, c = [e for e in input().split()]
    if (-1000 <= int(a) <= 1000 and -1000 <= int(b) <= 1000 and -1000 <= int(c) <= 1000) and (int(a) > 0 or int(b) > 0 or int(c) > 0) and (int(a) < 0 or int(b) < 0 or int(c) < 0) :
        if s1 == '0' and s2 == '0' :
            print(f1(a, b, c))
        elif s1 == '0' and s2 == '1' :
            print(f2(a, b, c))
        elif s1 == '1' and s2 == '0' :
            print(f3(a, b, c))
        elif s1 == '1' and s2 == '1' :
            print(f4(a, b, c))
        else :
            print('Error')
    else :
        print('Error')
            
exec(input().strip())

6430363321
# 1639847, 2022-09-24 09:40:54, --xx[xx][xxxx] (0%)

def f1(a, b, c):
    min = 0
    if a >= 0:
        min = a
        if b >= 0:
            if b <= min:
                min = b
                if c >= 0:
                    if c <= min:
                        min = c
    return min
    
def f2(a, b, c):
    max = 0
    if a <= 0:
        max = a
        if b <= 0:
            if b >= max:
                max = b
                if c <= 0:
                    if c >= max:
                        max = c
    return max

def f3(a, b, c):
    x = a + b + c
    y = x[0]
    return y

def f4(a, b, c):
    x = a + b + c
    y = x[-1]
    return y

def main():
    s1, s2, a, b, c = int(input()).split()
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
        
    
exec(input().strip()) # DON'T remove this line

# 1640446, 2022-09-24 09:58:08, --xx[xx][xxxx] (0%)

def f1(a, b, c):
    min = 0
    if a > 0:
        min = a
    if b > 0:
        if b <= min:
            min = b
    if c >= 0:
        if c <= min:
            min = c
    return min
    
def f2(a, b, c):
    max = 0
    if a <= 0:
        max = a
    if b <= 0:
        if b >= max:
            max = b
    if c <= 0:
        if c >= max:
            max = c
    return max

def f3(a, b, c):
    x = a + b + c
    y = x[0]
    return y

def f4(a, b, c):
    x = a + b + c
    y = x[-1]
    return y

def main():
    s1, s2, a, b, c = int(input()).split()
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
            
exec(input().strip()) # DON'T remove this line
# 1641447, 2022-09-24 10:22:27, --Px[xx][xxxx] (17%)

def f1(a, b, c):
    min = 0
    if a > 0:
        min = a
    if b > 0:
        if b <= min:
            min = b
    if c >= 0:
        if c <= min:
            min = c
    return min
    
def f2(a, b, c):
    max = 0
    if a <= 0:
        max = a
    if b <= 0:
        if b >= max:
            max = b
    if c <= 0:
        if c >= max:
            max = c
    return max

def f3(a, b, c):
    x = a + b + c
    x = str(x)
    if '-' not in x:
        return int(x[0])
    else:
        return int(x[1])

def f4(a, b, c):
    x = a + b + c
    y = x[-1]
    return y

def main():
    s1, s2, a, b, c = int(input()).split()
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
            
exec(input().strip()) # DON'T remove this line

# 1641717, 2022-09-24 10:27:40, --P-[xx][xxxx] (17%)

def f1(a, b, c):
    min = 0
    if a > 0:
        min = a
    if b > 0:
        if b <= min:
            min = b
    if c >= 0:
        if c <= min:
            min = c
    return min
    
def f2(a, b, c):
    max = 0
    if a <= 0:
        max = a
    if b <= 0:
        if b >= max:
            max = b
    if c <= 0:
        if c >= max:
            max = c
    return max

def f3(a, b, c):
    x = a + b + c
    x = str(x)
    if '-' not in x:
        return int(x[0])
    else:
        return int(x[1])

def f4(a, b, c):
    x = a + b + c
    x = str(x)
    return x[-1]

def main():
    s1, s2, a, b, c = int(input()).split()
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
            
exec(input().strip()) # DON'T remove this line
# 1641875, 2022-09-24 10:30:21, --P-[--][P-P-] (17%)

def f1(a, b, c):
    min = 0
    if a > 0:
        min = a
    if b > 0:
        if b <= min:
            min = b
    if c >= 0:
        if c <= min:
            min = c
    return min
    
def f2(a, b, c):
    max = 0
    if a <= 0:
        max = a
    if b <= 0:
        if b >= max:
            max = b
    if c <= 0:
        if c >= max:
            max = c
    return max

def f3(a, b, c):
    x = a + b + c
    x = str(x)
    if '-' not in x:
        return int(x[0])
    else:
        return int(x[1])

def f4(a, b, c):
    x = a + b + c
    x = str(x)
    return x[-1]

def main():
    s1, s2, a, b, c = input().split()
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
            
exec(input().strip()) # DON'T remove this line

# 1641981, 2022-09-24 10:32:16, --P-[--][P-P-] (17%)

def f1(a, b, c):
    min = 0
    if a > 0:
        min = a
    if b > 0:
        if b <= min:
            min = b
    if c >= 0:
        if c <= min:
            min = c
    return min
    
def f2(a, b, c):
    max = 0
    if a <= 0:
        max = a
    if b <= 0:
        if b >= max:
            max = b
    if c <= 0:
        if c >= max:
            max = c
    return max

def f3(a, b, c):
    x = a + b + c
    x = str(x)
    if '-' not in x:
        return int(x[0])
    else:
        return int(x[1])

def f4(a, b, c):
    x = a + b + c
    x = str(x)
    return x[-1]

def main():
    s1, s2, a, b, c = input().split()
    s1 = int(s1)
    s2 = int(s2)
    a = int(a)
    b = int(b)
    c = int(c)
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
            
exec(input().strip()) # DON'T remove this line


# 1642020, 2022-09-24 10:33:03, --P-[--][P-P-] (17%)

def f1(a, b, c):
    min = 0
    if a > 0:
        min = a
    if b > 0:
        if b <= min:
            min = b
    if c >= 0:
        if c <= min:
            min = c
    return min
    
def f2(a, b, c):
    max = 0
    if a <= 0:
        max = a
    if b <= 0:
        if b >= max:
            max = b
    if c <= 0:
        if c >= max:
            max = c
    return max

def f3(a, b, c):
    x = a + b + c
    x = str(x)
    if '-' not in x:
        return int(x[0])
    else:
        return int(x[1])

def f4(a, b, c):
    x = a + b + c
    x = str(x)
    return x[-1]

def main():
    s1, s2, a, b, c = input().split()
    s1 = int(s1)
    s2 = int(s2)
    a = int(a)
    b = int(b)
    c = int(c)
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
            
exec(input().strip()) # DON'T remove this line

# 1642166, 2022-09-24 10:35:21, --P-[--][P-P-] (17%)

def f1(a, b, c):
    min = 10000
    if a > 0:
        min = a
    if b > 0:
        if b <= min:
            min = b
    if c >= 0:
        if c <= min:
            min = c
    return min
    
def f2(a, b, c):
    max = -10000
    if a <= 0:
        max = a
    if b <= 0:
        if b >= max:
            max = b
    if c <= 0:
        if c >= max:
            max = c
    return max

def f3(a, b, c):
    x = a + b + c
    x = str(x)
    if '-' not in x:
        return int(x[0])
    else:
        return int(x[1])

def f4(a, b, c):
    x = a + b + c
    x = str(x)
    return x[-1]

def main():
    s1, s2, a, b, c = input().split()
    s1 = int(s1)
    s2 = int(s2)
    a = int(a)
    b = int(b)
    c = int(c)
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
            
exec(input().strip()) # DON'T remove this line

# 1642331, 2022-09-24 10:37:27, --P-[--][P-P-] (17%)

def f1(a, b, c):
    min = 10000
    if a > 0:
        min = a
    if b > 0:
        if b <= min:
            min = b
    if c >= 0:
        if c <= min:
            min = c
    return min
    
def f2(a, b, c):
    max = -10000
    if a <= 0:
        max = a
    if b <= 0:
        if b >= max:
            max = b
    if c <= 0:
        if c >= max:
            max = c
    return max

def f3(a, b, c):
    x = a + b + c
    x = str(x)
    if '-' not in x:
        return int(x[0])
    else:
        return int(x[1])

def f4(a, b, c):
    x = a + b + c
    x = str(x)
    return x[-1]

def main():
    s1, s2, a, b, c = input().split()
    s1 = int(s1)
    s2 = int(s2)
    a = int(a)
    b = int(b)
    c = int(c)
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
            
exec(input().strip()) # DON'T remove this line


6530191821
# 1640785, 2022-09-24 10:06:53, ----[--][P-P-] (0%)

def f1(a, b, c):
    if a<0:
        return min(b,c)
    if b<0:
        return min(a,c)
    if c<0:
        return min(a,b)
def f2(a, b, c):
    if a>0:
        return max(b,c)
    if b>0:
        return max(a,c)
    if c>0:
        return max(a,b)
def f3(a, b, c):
    x=a+b+c
    if x>0:
        x=str(x)
        return x[0]
    if x<0:
        x=str(x)
        return x[1]
def f4(a, b, c):
    x=a+b+c
    x=str(x)
    return x[-1]
def main():
    s1,s2,a,b,c=input().split( )
    if s1=='0' and s2=='0':
        print(f1)
    if s1=='0' and s2=='1':
        print(f2)
    if s1=='1' and s2=='0':
        print(f3)
    if s1=='1' and s2=='1':
        print(f4)
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line 
# 1640793, 2022-09-24 10:07:13, ----[xx][xxxx] (0%)

def f1(a, b, c):
    if a<0:
        return min(b,c)
    if b<0:
        return min(a,c)
    if c<0:
        return min(a,b)
def f2(a, b, c):
    if a>0:
        return max(b,c)
    if b>0:
        return max(a,c)
    if c>0:
        return max(a,b)
def f3(a, b, c):
    x=a+b+c
    if x>0:
        x=str(x)
        return x[0]
    if x<0:
        x=str(x)
        return x[1]
def f4(a, b, c):
    x=a+b+c
    x=str(x)
    return x[-1]

exec(input().strip()) # DON'T remove this line
# 1640889, 2022-09-24 10:09:32, ----[--][P-P-] (0%)

def f1(a, b, c):
    if a<0:
        return min(b,c)
    if b<0:
        return min(a,c)
    if c<0:
        return min(a,b)
def f2(a, b, c):
    if a>0:
        return max(b,c)
    if b>0:
        return max(a,c)
    if c>0:
        return max(a,b)
def f3(a, b, c):
    x=a+b+c
    if x>0:
        x=str(x)
        return x[0]
    if x<0:
        x=str(x)
        return x[1]
def f4(a, b, c):
    x=a+b+c
    x=str(x)
    return x[-1]
def main():
    s1,s2,a,b,c=input().split( )
    if s1=='0' and s2=='0':
        return f1
    if s1=='0' and s2=='1':
        return f2
    if s1=='1' and s2=='0':
        return f3
    if s1=='1' and s2=='1':
        return f4
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line   
# 1641014, 2022-09-24 10:12:57, ----[xx][PxPx] (0%)

def f1(a, b, c):
    if a<0:
        return min(b,c)
    if b<0:
        return min(a,c)
    if c<0:
        return min(a,b)
def f2(a, b, c):
    if a>0:
        return max(b,c)
    if b>0:
        return max(a,c)
    if c>0:
        return max(a,b)
def f3(a, b, c):
    x=a+b+c
    if x>0:
        x=str(x)
        return x[0]
    if x<0:
        x=str(x)
        return x[1]
def f4(a, b, c):
    x=a+b+c
    x=str(x)
    return x[-1]
def main():
    s1,s2,a,b,c=input().split(' ')
    if s1=='0' and s2=='0':
        print(f1(a,b,c))
    if s1=='0' and s2=='1':
        print(f2(a,b,c))
    if s1=='1' and s2=='0':
        print(f3(a,b,c))
    if s1=='1' and s2=='1':
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line 
# 1641212, 2022-09-24 10:17:50, ---P[xx][PxPx] (17%)

def f1(a, b, c):
    if a<0:
        return min(b,c)
    if b<0:
        return min(a,c)
    if c<0:
        return min(a,b)
def f2(a, b, c):
    if a>0:
        return max(b,c)
    if b>0:
        return max(a,c)
    if c>0:
        return max(a,b)
def f3(a, b, c):
    x=a+b+c
    if x>0:
        x=str(x)
        x=int(x)
        return x
    if x<0:
        x=str(x)
        x=int(x)
        return x
def f4(a, b, c):
    x=a+b+c
    x=str(x)
    x=int(x[-1])
    return x
def main():
    s1,s2,a,b,c=input().split(' ')
    if s1=='0' and s2=='0':
        print(f1(a,b,c))
    if s1=='0' and s2=='1':
        print(f2(a,b,c))
    if s1=='1' and s2=='0':
        print(f3(a,b,c))
    if s1=='1' and s2=='1':
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line 
# 1641287, 2022-09-24 10:19:17, ---P[xx][PxPx] (17%)

def f1(a, b, c):
    if a<0:
        return int(min(b,c))
    if b<0:
        return int(min(a,c))
    if c<0:
        return int(min(a,b))
def f2(a, b, c):
    if a>0:
        return int(max(b,c))
    if b>0:
        return int(max(a,c))
    if c>0:
        return int(max(a,b))
def f3(a, b, c):
    x=a+b+c
    if x>0:
        x=str(x)
        x=int(x)
        return x
    if x<0:
        x=str(x)
        x=int(x)
        return x
def f4(a, b, c):
    x=a+b+c
    x=str(x)
    x=int(x[-1])
    return x
def main():
    s1,s2,a,b,c=input().split(' ')
    if s1=='0' and s2=='0':
        print(f1(a,b,c))
    if s1=='0' and s2=='1':
        print(f2(a,b,c))
    if s1=='1' and s2=='0':
        print(f3(a,b,c))
    if s1=='1' and s2=='1':
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line 
# 1642064, 2022-09-24 10:33:51, ---P[xx][PxPx] (17%)

def f1(a, b, c):
    if a<0:
        return int(min(b,c))
    if b<0:
        return int(min(a,c))
    if c<0:
        return int(min(a,b))
def f2(a, b, c):
    if a>0:
        return int(max(b,c))
    if b>0:
        return int(max(a,c))
    if c>0:
        return int(max(a,b))
def f3(a, b, c):
    x=a+b+c
    if x>0:
        x=str(x)
        x=int(x)
        return int(x)
    if x<0:
        x=str(x)
        x=int(x)
        return int(x)
def f4(a, b, c):
    x=a+b+c
    x=str(x)
    x=int(x[-1])
    return int(x)
def main():
    s1,s2,a,b,c=input().split(' ')
    if s1=='0' and s2=='0':
        print(f1(a,b,c))
    if s1=='0' and s2=='1':
        print(f2(a,b,c))
    if s1=='1' and s2=='0':
        print(f3(a,b,c))
    if s1=='1' and s2=='1':
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line
# 1642352, 2022-09-24 10:37:38, ---P[xx][PxPx] (17%)

def f1(a, b, c):
    -1000<=a,b,c<=1000
    if a<0:
        return int(min(b,c))
    if b<0:
        return int(min(a,c))
    if c<0:
        return int(min(a,b))
def f2(a, b, c):
    if a>0:
        return int(max(b,c))
    if b>0:
        return int(max(a,c))
    if c>0:
        return int(max(a,b))
def f3(a, b, c):
    x=a+b+c
    if x>0:
        x=str(x)
        x=int(x)
        return int(x)
    if x<0:
        x=str(x)
        x=int(x)
        return int(x)
def f4(a, b, c):
    x=a+b+c
    x=str(x)
    x=int(x[-1])
    return int(x)
def main():
    s1,s2,a,b,c=input().split(' ')
    if s1=='0' and s2=='0':
        print(f1(a,b,c))
    if s1=='0' and s2=='1':
        print(f2(a,b,c))
    if s1=='1' and s2=='0':
        print(f3(a,b,c))
    if s1=='1' and s2=='1':
        print(f4(a,b,c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line  

6231405021
# 1639805, 2022-09-24 09:40:00, ----[--][----] (0%)

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 ==0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 ==1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
def f1(a,b,c) :
    if a <= 0 :
        return min(b,c)
    if b <= 0 :
        return min(a,c)
    if c <= 0 :
        return min(a,b)
def f2(a,b,c) :
    if a >= 0 :
        return max(b,c)
    if b >= 0 :
        return max(a,c)
    if c >= 0 :
        return max(a,b)
# 1639989, 2022-09-24 09:44:47, --xx[PP][PxPx] (17%)

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 ==0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 ==1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
def f1(a,b,c) :
    if a <= 0 :
        return min(b,c)
    if b <= 0 :
        return min(a,c)
    if c <= 0 :
        return min(a,b)
def f2(a,b,c) :
    if a >= 0 :
        return max(b,c)
    if b >= 0 :
        return max(a,c)
    if c >= 0 :
        return max(a,b)
exec(input().strip()) # DON'T remove this line
# 1640902, 2022-09-24 10:10:01, ---x[PP][P-P-] (17%)

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 ==0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 ==1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
def f1(a,b,c) :
    if a <= 0 :
        return min(b,c)
    if b <= 0 :
        return min(a,c)
    if c <= 0 :
        return min(a,b)
def f2(a,b,c) :
    if a >= 0 :
        return max(b,c)
    if b >= 0 :
        return max(a,c)
    if c >= 0 :
        return max(a,b)
def f3(a,b,c) :
    x = a + b + c
    x = abs(x)//10
    return x
exec(input().strip()) # DON'T remove this line
# 1641066, 2022-09-24 10:14:20, compilation error (0%)

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 ==0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 ==1 and s2 == 1 :
       print(f4(a,b,c))
    else :
        s1 != 1 or s2 != 1 or s1 != 0 or s2 != 0ma
        print('Error')
def f1(a,b,c) :
    if a <= 0 :
        return min(b,c)
    if b <= 0 :
        return min(a,c)
    if c <= 0 :
        return min(a,b)
def f2(a,b,c) :
    if a >= 0 :
        return max(b,c)
    if b >= 0 :
        return max(a,c)
    if c >= 0 :
        return max(a,b)
def f3(a,b,c) :
    x = a + b + c
    x = abs(x)//10
    return x
exec(input().strip()) # DON'T remove this line
# 1641086, 2022-09-24 10:15:02, ---x[PP][P-P-] (17%)

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 ==0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 ==1 and s2 == 1 :
       print(f4(a,b,c))
    else :
        s1 != 1 or s2 != 1 or s1 != 0 or s2 != 0
        print('Error')
def f1(a,b,c) :
    if a <= 0 :
        return min(b,c)
    if b <= 0 :
        return min(a,c)
    if c <= 0 :
        return min(a,b)
def f2(a,b,c) :
    if a >= 0 :
        return max(b,c)
    if b >= 0 :
        return max(a,c)
    if c >= 0 :
        return max(a,b)
def f3(a,b,c) :
    x = a + b + c
    x = abs(x)//10
    return x
exec(input().strip()) # DON'T remove this line
# 1641740, 2022-09-24 10:28:01, ----[PP][P-P-] (17%)

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 ==0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 ==1 and s2 == 1 :
       print(f4(a,b,c))
    else :
        s1 != 1 or s2 != 1 or s1 != 0 or s2 != 0
        print('Error')
def f1(a,b,c) :
    if a <= 0 :
        return min(b,c)
    if b <= 0 :
        return min(a,c)
    if c <= 0 :
        return min(a,b)
def f2(a,b,c) :
    if a >= 0 :
        return max(b,c)
    if b >= 0 :
        return max(a,c)
    if c >= 0 :
        return max(a,b)
def f3(a,b,c) :
    x = a + b + c
    x = abs(x)//10
    return x
def f4(a,b,c) :
    x = a + b + c
    x = abs(x)
    x = x%10 == 0
    return x
exec(input().strip()) # DON'T remove this line
# 1642216, 2022-09-24 10:36:03, ----[PP][P-P-] (17%)

def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 ==0 :
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    elif s1 ==1 and s2 == 1 :
       print(f4(a,b,c))
    else :
        s1 != 1 or s2 != 1 or s1 != 0 or s2 != 0
        print('Error')
def f1(a,b,c) :
    if a <= 0 :
        return min(b,c)
    if b <= 0 :
        return min(a,c)
    if c <= 0 :
        return min(a,b)
def f2(a,b,c) :
    if a >= 0 :
        return max(b,c)
    if b >= 0 :
        return max(a,c)
    if c >= 0 :
        return max(a,b)
def f3(a,b,c) :
    x = a + b + c
    x = abs(x)//10
    return x
def f4(a,b,c) :
    x = a + b + c
    x = abs(x)
    x = x%10 == 0
    return x
exec(input().strip()) # DON'T remove this line

6431526521
# 1640159, 2022-09-24 09:49:53, ----[--][----] (0%)

def f1(a, b, c):
    min = 0
    if a < b and a < b:
        min = a
    elif b < a and b < c:
        min = b
    elif c < a and c < b:
        min = c
    return min

def f2(a, b, c):
    max = 0
    if a > b and a > c:
        max = a
    elif b > a and b > c:
        max = b
    elif c > a and c > b:
        max = b
    return max
  
def f3(a, b, c):
  pass

def f4(a, b, c):
  pass

def main():
  pass

exec(input().strip())
# 1641316, 2022-09-24 10:19:47, ----[--][----] (0%)

def f1(a, b, c):
    min = 0
    if a < b and a < b:
        min = a
    elif b < a and b < c:
        min = b
    elif c < a and c < b:
        min = c
    return min

def f2(a, b, c):
    max = 0
    if a > b and a > c:
        max = a
    elif b > a and b > c:
        max = b
    elif c > a and c > b:
        max = b
    return max
  
def f3(a, b, c):
    sum = a+b+c
    l = []
    for i in str(sum):
        l.append(i)
    num = ['0','1','2','3','4','5','6','7','8','9']
    if l[0] in num:
        return l[0]
    else: return l[1]

def f4(a, b, c):
  pass

def main():
  pass

exec(input().strip())

# 1641340, 2022-09-24 10:20:15, ----[--][----] (0%)

def f1(a, b, c):
    min(a, b, c)
    return min

def f2(a, b, c):
    max = 0
    if a > b and a > c:
        max = a
    elif b > a and b > c:
        max = b
    elif c > a and c > b:
        max = b
    return max
  
def f3(a, b, c):
    sum = a+b+c
    l = []
    for i in str(sum):
        l.append(i)
    num = ['0','1','2','3','4','5','6','7','8','9']
    if l[0] in num:
        return l[0]
    else: return l[1]

def f4(a, b, c):
  pass

def main():
  pass

exec(input().strip())
# 1641350, 2022-09-24 10:20:28, ----[--][----] (0%)

def f1(a, b, c):
    min = 0
    if a < b and a < b:
        min = a
    elif b < a and b < c:
        min = b
    elif c < a and c < b:
        min = c
    return min

def f2(a, b, c):
    max = 0
    if a > b and a > c:
        max = a
    elif b > a and b > c:
        max = b
    elif c > a and c > b:
        max = b
    return max
  
def f3(a, b, c):
    sum = a+b+c
    l = []
    for i in str(sum):
        l.append(i)
    num = ['0','1','2','3','4','5','6','7','8','9']
    if l[0] in num:
        return l[0]
    else: return l[1]

def f4(a, b, c):
  pass

def main():
  pass

exec(input().strip())

# 1641603, 2022-09-24 10:25:35, ----[-P][PPPP] (17%)

def f1(a, b, c):
    min = 0
    if a < b and a < b:
        min = a
    elif b < a and b < c:
        min = b
    elif c < a and c < b:
        min = c
    return min

def f2(a, b, c):
    max = 0
    if a > b and a > c:
        max = a
    elif b > a and b > c:
        max = b
    elif c > a and c > b:
        max = b
    return max
  
def f3(a, b, c):
    sum = a+b+c
    l = []
    for i in str(sum):
        l.append(i)
    num = ['0','1','2','3','4','5','6','7','8','9']
    if l[0] in num:
        return l[0]
    else: return l[1]

def f4(a, b, c):
    sum = a+b+c
    l = []
    for i in str(sum):
        l.append(i)
    return l[-1]

def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else: print("Error")
exec(input().strip())

# 1641621, 2022-09-24 10:25:53, ----[-P][PPPP] (17%)

def f1(a, b, c):
    min = 0
    if a < b and a < b:
        min = a
    elif b < a and b < c:
        min = b
    elif c < a and c < b:
        min = c
    return min

def f2(a, b, c):
    max = 0
    if a > b and a > c:
        max = a
    elif b > a and b > c:
        max = b
    elif c > a and c > b:
        max = b
    return max
  
def f3(a, b, c):
    sum = a+b+c
    l = []
    for i in str(sum):
        l.append(i)
    num = ['0','1','2','3','4','5','6','7','8','9']
    if l[0] in num:
        return l[0]
    else: return l[1]

def f4(a, b, c):
    sum = a+b+c
    l = []
    for i in str(sum):
        l.append(i)
    return l[-1]

def main():
    s1,s2,a,b,c = [int(i) for i in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else: print("Error")
    
exec(input().strip())

6531204521
# 1640393, 2022-09-24 09:56:40, compilation error (0%)

def f1(a, b, c) :
    if -1000 < a < 1000 and -1000 < b < 1000 and -1000 < c < 1000 \
       and a > 0 or b > 0 or c > 0 and  a < 0 or b < 0 or c < 0 :
        if a <= b and a <= c and a > 0 :
            return a
        elif b <= a and b <= c and b > 0  :
            return b
        elif c <= b and c <= a and c > 0 :
            return c

def f2(a, b, c) :
    if -1000 < a < 1000 and -1000 < b < 1000 and -1000 < c < 1000 \
       and a > 0 or b > 0 or c > 0 and  a < 0 or b < 0 or c < 0 :
        if a >= b and a >= c and a < 0 : :
            return a
        elif b >= a and b >= c and b < 0 :
            return b
        elif c >= b and c >= a and c < 0 :
            return c

def f3(a, b, c) :
    if -1000 < a < 1000 and -1000 < b < 1000 and -1000 < c < 1000 \
       and a > 0 or b > 0 or c > 0 and  a < 0 or b < 0 or c < 0 :
            x = a+b+c
            if x >= 0 :
                x = str(x)
                las = x[0]
            else :
                x = str(x)
                las = x[1]
    return las

def f4(a, b, c) :
    if -1000 < a < 1000 and -1000 < b < 1000 and -1000 < c < 1000 \
       and a > 0 or b > 0 or c > 0 and a < 0 or b < 0 or c < 0  :
            x = a+b+c
            if x >= 0 :
                x = str(x)
                las = x[-1]
            else :
                x = str(x)
                las = x[-1]
    return las

def main() :
    s1,s2,a,b,c = [int(x) for x in input().split()]
    if -1000 < a < 1000 and -1000 < a < 1000 and -1000 < a < 1000 \
       and a > 0 or b > 0 or c > 0 and  a < 0 or b < 0 or c < 0 :
        if s1 == 0 and s2 == 0 :
            print(f1(a, b, c))
        elif s1 == 0 and s2 == 1 :
            print(f2(a, b, c))    
        elif s1 == 1 and s2 == 0 :
            print(f3(a, b, c))
        elif s1 == 1 and s2 == 1 :
            print(f4(a, b, c))
        else :
            print('Error')

exec(input().strip())
# 1640417, 2022-09-24 09:57:19, ----[--][PPPP] (17%)

def f1(a, b, c) :
    if -1000 < a < 1000 and -1000 < b < 1000 and -1000 < c < 1000 \
       and a > 0 or b > 0 or c > 0 and  a < 0 or b < 0 or c < 0 :
        if a <= b and a <= c and a > 0 :
            return a
        elif b <= a and b <= c and b > 0  :
            return b
        elif c <= b and c <= a and c > 0 :
            return c

def f2(a, b, c) :
    if -1000 < a < 1000 and -1000 < b < 1000 and -1000 < c < 1000 \
       and a > 0 or b > 0 or c > 0 and  a < 0 or b < 0 or c < 0 :
        if a >= b and a >= c and a < 0 : 
            return a
        elif b >= a and b >= c and b < 0 :
            return b
        elif c >= b and c >= a and c < 0 :
            return c

def f3(a, b, c) :
    if -1000 < a < 1000 and -1000 < b < 1000 and -1000 < c < 1000 \
       and a > 0 or b > 0 or c > 0 and  a < 0 or b < 0 or c < 0 :
            x = a+b+c
            if x >= 0 :
                x = str(x)
                las = x[0]
            else :
                x = str(x)
                las = x[1]
    return las

def f4(a, b, c) :
    if -1000 < a < 1000 and -1000 < b < 1000 and -1000 < c < 1000 \
       and a > 0 or b > 0 or c > 0 and a < 0 or b < 0 or c < 0  :
            x = a+b+c
            if x >= 0 :
                x = str(x)
                las = x[-1]
            else :
                x = str(x)
                las = x[-1]
    return las

def main() :
    s1,s2,a,b,c = [int(x) for x in input().split()]
    if -1000 < a < 1000 and -1000 < a < 1000 and -1000 < a < 1000 \
       and a > 0 or b > 0 or c > 0 and  a < 0 or b < 0 or c < 0 :
        if s1 == 0 and s2 == 0 :
            print(f1(a, b, c))
        elif s1 == 0 and s2 == 1 :
            print(f2(a, b, c))    
        elif s1 == 1 and s2 == 0 :
            print(f3(a, b, c))
        elif s1 == 1 and s2 == 1 :
            print(f4(a, b, c))
        else :
            print('Error')

exec(input().strip())
# 1642008, 2022-09-24 10:32:54, ----[P-][PPPP] (17%)

def f1(a, b, c) :
    if -1000 < a < 1000 and -1000 < b < 1000 and -1000 < c < 1000 \
       and a > 0 or b > 0 or c > 0 and  a < 0 or b < 0 or c < 0 :
        if a <= b and a <= c :
            if a > 0 :
                return a
            elif  a < b < c :
                return b
            else :
                return c
        elif b <= a and b <= c   :
            if b > 0 :
                return b
            elif  b < a < c :
                return a
            else :
                return c
        elif c <= b and c <= a  :
            if c > 0 :
                return a
            elif  c < b < a :
                return b
            else :
                return a

def f2(a, b, c) :
    if -1000 < a < 1000 and -1000 < b < 1000 and -1000 < c < 1000 \
       and a > 0 or b > 0 or c > 0 and  a < 0 or b < 0 or c < 0 :
        if a >= b and a >= c  : 
            if a < 0 :
                return a
            elif  a < b < c :
                return b
            else :
                return c
        elif b >= a and b >= c  :
            if b < 0 :
                return b
            elif  b < a < c :
                return a
            else :
                return c
        elif c >= b and c >= a  :
            if c < 0 :
                return a
            elif  c < b < a :
                return b
            else :
                return a

def f3(a, b, c) :
    if -1000 < a < 1000 and -1000 < b < 1000 and -1000 < c < 1000 \
       and a > 0 or b > 0 or c > 0 and  a < 0 or b < 0 or c < 0 :
            x = a+b+c
            if x >= 0 :
                x = str(x)
                las = x[0]
            else :
                x = str(x)
                las = x[1]
    return las

def f4(a, b, c) :
    if -1000 < a < 1000 and -1000 < b < 1000 and -1000 < c < 1000 \
       and a > 0 or b > 0 or c > 0 and a < 0 or b < 0 or c < 0  :
            x = a+b+c
            if x >= 0 :
                x = str(x)
                las = x[-1]
            else :
                x = str(x)
                las = x[-1]
    return las

def main() :
    s1,s2,a,b,c = [int(x) for x in input().split()]
    if -1000 < a < 1000 and -1000 < a < 1000 and -1000 < a < 1000 \
       and a > 0 or b > 0 or c > 0 and  a < 0 or b < 0 or c < 0 :
        if s1 == 0 and s2 == 0 :
            print(f1(a, b, c))
        elif s1 == 0 and s2 == 1 :
            print(f2(a, b, c))    
        elif s1 == 1 and s2 == 0 :
            print(f3(a, b, c))
        elif s1 == 1 and s2 == 1 :
            print(f4(a, b, c))
        else :
            print('Error')

exec(input().strip())
# 1642060, 2022-09-24 10:33:47, ----[P-][PPPP] (17%)

def f1(a, b, c) :
    if -1000 < a < 1000 and -1000 < b < 1000 and -1000 < c < 1000 \
       and a > 0 or b > 0 or c > 0 \
       and  a < 0 or b < 0 or c < 0 :
        if a <= b and a <= c :
            if a > 0 :
                return a
            elif  a < b < c :
                return b
            else :
                return c
        elif b <= a and b <= c   :
            if b > 0 :
                return b
            elif  b < a < c :
                return a
            else :
                return c
        elif c <= b and c <= a  :
            if c > 0 :
                return a
            elif  c < b < a :
                return b
            else :
                return a

def f2(a, b, c) :
    if -1000 < a < 1000 and -1000 < b < 1000 and -1000 < c < 1000 \
       and a > 0 or b > 0 or c > 0 and  a < 0 or b < 0 or c < 0 :
        if a >= b and a >= c  : 
            if a < 0 :
                return a
            elif  a < b < c :
                return b
            else :
                return c
        elif b >= a and b >= c  :
            if b < 0 :
                return b
            elif  b < a < c :
                return a
            else :
                return c
        elif c >= b and c >= a  :
            if c < 0 :
                return a
            elif  c < b < a :
                return b
            else :
                return a

def f3(a, b, c) :
    if -1000 < a < 1000 and -1000 < b < 1000 and -1000 < c < 1000 \
       and a > 0 or b > 0 or c > 0 and  a < 0 or b < 0 or c < 0 :
            x = a+b+c
            if x >= 0 :
                x = str(x)
                las = x[0]
            else :
                x = str(x)
                las = x[1]
    return las

def f4(a, b, c) :
    if -1000 < a < 1000 and -1000 < b < 1000 and -1000 < c < 1000 \
       and a > 0 or b > 0 or c > 0 and a < 0 or b < 0 or c < 0  :
            x = a+b+c
            if x >= 0 :
                x = str(x)
                las = x[-1]
            else :
                x = str(x)
                las = x[-1]
    return las

def main() :
    s1,s2,a,b,c = [int(x) for x in input().split()]
    if -1000 < a < 1000 and -1000 < a < 1000 and -1000 < a < 1000 \
       and a > 0 or b > 0 or c > 0 and  a < 0 or b < 0 or c < 0 :
        if s1 == 0 and s2 == 0 :
            print(f1(a, b, c))
        elif s1 == 0 and s2 == 1 :
            print(f2(a, b, c))    
        elif s1 == 1 and s2 == 0 :
            print(f3(a, b, c))
        elif s1 == 1 and s2 == 1 :
            print(f4(a, b, c))
        else :
            print('Error')

exec(input().strip())
# 1642266, 2022-09-24 10:36:39, ----[P-][PPPP] (17%)

def f1(a, b, c) :
    if -1000 <= a <= 1000 and -1000 <= b <= 1000 and -1000 <= c <= 1000 \
       and a > 0 or b > 0 or c > 0 \
       and  a < 0 or b < 0 or c < 0 :
        if a <= b and a <= c :
            if a > 0 :
                return a
            elif  a < b < c :
                return b
            else :
                return c
        elif b <= a and b <= c   :
            if b > 0 :
                return b
            elif  b < a < c :
                return a
            else :
                return c
        elif c <= b and c <= a  :
            if c > 0 :
                return a
            elif  c < b < a :
                return b
            else :
                return a

def f2(a, b, c) :
    if -1000 <= a <= 1000 and -1000 <= b <= 1000 and -1000 <= c <= 1000 \
       and a > 0 or b > 0 or c > 0 and  a < 0 or b < 0 or c < 0 :
        if a >= b and a >= c  : 
            if a < 0 :
                return a
            elif  a < b < c :
                return b
            else :
                return c
        elif b >= a and b >= c  :
            if b < 0 :
                return b
            elif  b < a < c :
                return a
            else :
                return c
        elif c >= b and c >= a  :
            if c < 0 :
                return a
            elif  c < b < a :
                return b
            else :
                return a

def f3(a, b, c) :
    if -1000 <= a <= 1000 and -1000 <= b <= 1000 and -1000 <= c <= 1000 \
       and a > 0 or b > 0 or c > 0 and  a < 0 or b < 0 or c < 0 :
            x = a+b+c
            if x >= 0 :
                x = str(x)
                las = x[0]
            else :
                x = str(x)
                las = x[1]
    return las

def f4(a, b, c) :
    if -1000 <= a <= 1000 and -1000 <= b <= 1000 and -1000 <= c <= 1000 \
       and a > 0 or b > 0 or c > 0 and a < 0 or b < 0 or c < 0  :
            x = a+b+c
            if x >= 0 :
                x = str(x)
                las = x[-1]
            else :
                x = str(x)
                las = x[-1]
    return las

def main() :
    s1,s2,a,b,c = [int(x) for x in input().split()]
    if -1000 <= a <= 1000 and -1000 <= b <= 1000 and -1000 <= c <= 1000 \
       and a > 0 or b > 0 or c > 0 and  a < 0 or b < 0 or c < 0 :
        if s1 == 0 and s2 == 0 :
            print(f1(a, b, c))
        elif s1 == 0 and s2 == 1 :
            print(f2(a, b, c))    
        elif s1 == 1 and s2 == 0 :
            print(f3(a, b, c))
        elif s1 == 1 and s2 == 1 :
            print(f4(a, b, c))
        else :
            print('Error')

exec(input().strip())

# 1642280, 2022-09-24 10:36:50, ----[P-][PPPP] (17%)

def f1(a, b, c) :
    if -1000 <= a <= 1000 and -1000 <= b <= 1000 and -1000 <= c <= 1000 \
       and a > 0 or b > 0 or c > 0 \
       and  a < 0 or b < 0 or c < 0 :
        if a <= b and a <= c :
            if a > 0 :
                return a
            elif  a < b < c :
                return b
            else :
                return c
        elif b <= a and b <= c   :
            if b > 0 :
                return b
            elif  b < a < c :
                return a
            else :
                return c
        elif c <= b and c <= a  :
            if c > 0 :
                return a
            elif  c < b < a :
                return b
            else :
                return a

def f2(a, b, c) :
    if -1000 <= a <= 1000 and -1000 <= b <= 1000 and -1000 <= c <= 1000 \
       and a > 0 or b > 0 or c > 0 and  a < 0 or b < 0 or c < 0 :
        if a >= b and a >= c  : 
            if a < 0 :
                return a
            elif  a < b < c :
                return b
            else :
                return c
        elif b >= a and b >= c  :
            if b < 0 :
                return b
            elif  b < a < c :
                return a
            else :
                return c
        elif c >= b and c >= a  :
            if c < 0 :
                return a
            elif  c < b < a :
                return b
            else :
                return a

def f3(a, b, c) :
    if -1000 <= a <= 1000 and -1000 <= b <= 1000 and -1000 <= c <= 1000 \
       and a > 0 or b > 0 or c > 0 and  a < 0 or b < 0 or c < 0 :
            x = a+b+c
            if x >= 0 :
                x = str(x)
                las = x[0]
            else :
                x = str(x)
                las = x[1]
    return las

def f4(a, b, c) :
    if -1000 <= a <= 1000 and -1000 <= b <= 1000 and -1000 <= c <= 1000 \
       and a > 0 or b > 0 or c > 0 and a < 0 or b < 0 or c < 0  :
            x = a+b+c
            if x >= 0 :
                x = str(x)
                las = x[-1]
            else :
                x = str(x)
                las = x[-1]
    return las

def main() :
    s1,s2,a,b,c = [int(x) for x in input().split()]
    if -1000 <= a <= 1000 and -1000 <= b <= 1000 and -1000 <= c <= 1000 \
       and a > 0 or b > 0 or c > 0 and  a < 0 or b < 0 or c < 0 :
        if s1 == 0 and s2 == 0 :
            print(f1(a, b, c))
        elif s1 == 0 and s2 == 1 :
            print(f2(a, b, c))    
        elif s1 == 1 and s2 == 0 :
            print(f3(a, b, c))
        elif s1 == 1 and s2 == 1 :
            print(f4(a, b, c))
        else :
            print('Error')

exec(input().strip())

6531405321
# 1639718, 2022-09-24 09:37:32, xx--[x-][PPPP] (17%)

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    d = min[int(a),int(b),int(c)]
    return d
    
def f2(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    d = max[a,b,c]
    return d

def f3(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
    d = abs(a) + abs(b) + abs(c)
    e = str(d)
    return int(e[0])

def f4(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน

    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    d = abs(a) + abs(b) + abs(c)
    e = str(d)
    return int(e[-1])

def main():
    # รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
    s1,s2,a,b,c = [int(e) for e in input().split()]
    # ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
    
    # ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
              
    # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
    elif s2 == 0 and s2 == 1 :
        f2(a, b, c)
    
    # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    # ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error
    else :
        print('Error')
        
exec(input().strip()) # DON'T remove this line

# 1639855, 2022-09-24 09:41:05, compilation error (0%)

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
   
    d = min[in(a),int(b),int(c)]
        
    
    return d
    
def f2(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    d = max[a,b,c]
    return d

def f3(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
    d = abs(int(a)) + abs(int(b)) + abs(int(c))
    e = str(d)
    return int(e[0])

def f4(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน

    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    d = abs(int(a)) + abs(int(b)) + abs(int(c))
    e = str(d)
    return int(e[-1])

def main():
    # รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
    s1,s2,a,b,c = [int(e) for e in input().split()]
    # ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
    
    # ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
              
    # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
    elif s2 == 0 and s2 == 1 :
        f2(a, b, c)
    
    # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    # ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error
    else :
        print('Error')
        
exec(input().strip()) # DON'T remove this line

# 1639959, 2022-09-24 09:44:07, xx--[x-][PPPP] (17%)

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
   
    d = min[int(a),int(b),int(c)]
        
    
    return d
    
def f2(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    d = max[a,b,c]
    return d

def f3(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
    d = abs(int(a)) + abs(int(b)) + abs(int(c))
    e = str(d)
    return int(e[0])

def f4(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน

    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    d = abs(int(a)) + abs(int(b)) + abs(int(c))
    e = str(d)
    return int(e[-1])

def main():
    # รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
    s1,s2,a,b,c = [int(e) for e in input().split()]
    # ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
    
    # ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
              
    # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
    elif s2 == 0 and s2 == 1 :
        f2(a, b, c)
    
    # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    # ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error
    else :
        print('Error')
        
exec(input().strip()) # DON'T remove this line

# 1639986, 2022-09-24 09:44:42, xx--[x-][PPPP] (17%)

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
   
    d = min[int(a),int(b),int(c)]
        
    
    return d
    
def f2(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    d = max[int(a),int(b),int(c)]
    return d

def f3(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
    d = abs(int(a)) + abs(int(b)) + abs(int(c))
    e = str(d)
    return int(e[0])

def f4(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน

    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    d = abs(int(a)) + abs(int(b)) + abs(int(c))
    e = str(d)
    return int(e[-1])

def main():
    # รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
    s1,s2,a,b,c = [int(e) for e in input().split()]
    # ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
    
    # ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
              
    # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
    elif s2 == 0 and s2 == 1 :
        f2(a, b, c)
    
    # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    # ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error
    else :
        print('Error')
        
exec(input().strip()) # DON'T remove this line
# 1640153, 2022-09-24 09:49:40, ----[--][PPPP] (17%)

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
   
    d = min(int(a),int(b),int(c))
        
    
    return d
    
def f2(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    d = max(int(a),int(b),int(c))
    return d

def f3(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
    d = abs(int(a)) + abs(int(b)) + abs(int(c))
    e = str(d)
    return int(e[0])

def f4(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน

    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    d = abs(int(a)) + abs(int(b)) + abs(int(c))
    e = str(d)
    return int(e[-1])

def main():
    # รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
    s1,s2,a,b,c = [int(e) for e in input().split()]
    # ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
    
    # ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
              
    # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
    elif s2 == 0 and s2 == 1 :
        f2(a, b, c)
    
    # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    # ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error
    else :
        print('Error')
        
exec(input().strip()) # DON'T remove this line

# 1640202, 2022-09-24 09:50:55, ----[--][PPPP] (17%)

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
   
    d = min(int(a),int(b),int(c))
        
    
    return int(d)
    
def f2(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    d = max(int(a),int(b),int(c))
    return int(d)

def f3(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
    d = abs(int(a)) + abs(int(b)) + abs(int(c))
    e = str(d)
    return int(e[0])

def f4(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน

    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    d = abs(int(a)) + abs(int(b)) + abs(int(c))
    e = str(d)
    return int(e[-1])

def main():
    # รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
    s1,s2,a,b,c = [int(e) for e in input().split()]
    # ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
    
    # ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
              
    # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
    elif s2 == 0 and s2 == 1 :
        f2(a, b, c)
    
    # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    # ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error
    else :
        print('Error')
        
exec(input().strip()) # DON'T remove this line


6231130421
# 1640964, 2022-09-24 10:11:33, ----[--][P-P-] (0%)

def f1(a, b, c) :
    
    return (min(a,b,c))

def f2(a, b, c) :
    
    return (max(a,b,c))

def f3(a, b, c) :
    sum_abc = a + b + c
    d = abs(sum_abc)
    e = str(d)
    pick = e[0]
    return pick
                  
def f4(a, b, c) :
    sum_abc = a + b + c
    d = abs(sum_abc)
    e = str(d)
    pick = e[-1]
    return pick


def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a , b, c))
    else :
        pass
    if s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    else :
        pass
    if s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    else :
        pass
    if s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        pass
    if s1 != 0 or s1 != 1 or s2 != 0 or s2 != 1 :
        print("Error")

exec(input().strip())
# 1641170, 2022-09-24 10:16:55, ----[--][P-P-] (0%)

def f1(a, b, c) :
    if a > 0 :
        return a
    elif b > 0 :
        return b
    elif c > 0 :
        return c
        
    return (min(a,b,c))

def f2(a, b, c) :
    if a < 0 :
        return a
    elif b < 0 :
        return b
    elif c < 0 :
        return c
    return (max(a,b,c))

def f3(a, b, c) :
    sum_abc = a + b + c
    d = abs(sum_abc)
    e = str(d)
    pick = e[0]
    return pick
                  
def f4(a, b, c) :
    sum_abc = a + b + c
    d = abs(sum_abc)
    e = str(d)
    pick = e[-1]
    return pick


def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a , b, c))
    else :
        pass
    if s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    else :
        pass
    if s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    else :
        pass
    if s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        pass
    if s1 != 0 or s1 != 1 or s2 != 0 or s2 != 1 :
        print("Error")

exec(input().strip())
# 1641365, 2022-09-24 10:20:48, ----[--][-P-P] (0%)

def f1(a, b, c) :
    if a > 0 :
        return a
    elif b > 0 :
        return b
    elif c > 0 :
        return c
    return (min(a,b,c))

def f2(a, b, c) :
    if a < 0 :
        return a
    elif b < 0 :
        return b
    elif c < 0 :
        return c
    return (max(a,b,c))

def f3(a, b, c) :
    sum_abc = a + b + c
    d = abs(sum_abc)
    e = str(d)
    pick = e[0]
    return pick
                  
def f4(a, b, c) :
    sum_abc = a + b + c
    d = abs(sum_abc)
    e = str(d)
    pick = e[-1]
    return pick


def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a , b, c))
    else :
        pass
    if s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    else :
        pass
    if s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    else :
        pass
    if s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        pass
    if s1 != 0 and s1 != 1 and s2 != 0 and s2 != 1 :
        print("Error")

exec(input().strip())
# 1641539, 2022-09-24 10:24:26, ----[--][PPPP] (17%)

def f1(a, b, c) :
    if a > 0 :
        return a
    elif b > 0 :
        return b
    elif c > 0 :
        return c
    return (min(a,b,c))

def f2(a, b, c) :
    if a < 0 :
        return a
    elif b < 0 :
        return b
    elif c < 0 :
        return c
    return (max(a,b,c))

def f3(a, b, c) :
    sum_abc = a + b + c
    d = abs(sum_abc)
    e = str(d)
    pick = e[0]
    return pick
                  
def f4(a, b, c) :
    sum_abc = a + b + c
    d = abs(sum_abc)
    e = str(d)
    pick = e[-1]
    return pick


def main() :
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0 :
        print(f1(a , b, c))
    else :
        pass
    if s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    else :
        pass
    if s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    else :
        pass
    if s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        pass
    if s1 != 0 and s1 != 1 or s2 !=0 and s2 != 1:
        print("Error")

exec(input().strip())

6531021021
# 1640642, 2022-09-24 10:03:20, ----[--][P-P-] (0%)

def f1(a, b, c):
    z=[]
    z=[a]+[b]+[c]
    z.sort()
    if z[0]!=0:
        return abs(z[0])
    else:
        if z[1] != 0:
            return abs(z[1])
        else:
            if z[2] != 0:
                return abs(z[2])
    
def f2(a, b, c):
    z=[]
    z=[a]+[b]+[c]
    z.sort()
    if z[2]!=0:
        return abs(z[2])
    else:
        if z[1] != 0:
            return abs(z[1])
        else:
            if z[0] != 0:
                return abs(z[0])
    
def f3(a, b, c):
    return a,b,c

def f4(a, b, c):
    return a,b,c

def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]    
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:print("Error")
    
exec(input().strip()) # DON'T remove this line 

# 1640922, 2022-09-24 10:10:26, P---[P-][P-P-] (17%)

def f1(a, b, c):
    z=[]
    z=[a]+[b]+[c]
    z.sort()
    if z[0]>0:
        return abs(z[0])
    else:
        if z[1]>0:
            return abs(z[1])
        else:
            if z[2]>0:
                return abs(z[2])
    
def f2(a, b, c):
    z=[]
    z=[a]+[b]+[c]
    z.sort()
    if z[2]>0:
        return abs(z[2])
    else:
        if z[1]>0:
            return abs(z[1])
        else:
            if z[0]>0:
                return abs(z[0])
    
def f3(a, b, c):
    return a,b,c

def f4(a, b, c):
    return a,b,c

def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]    
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:print("Error")
    
exec(input().strip()) # DON'T remove this line 

# 1642173, 2022-09-24 10:35:25, P-T-[P-][PTPT] (17%)

def f1(a, b, c):
    z=[]
    z=[a]+[b]+[c]
    z.sort()
    if z[0]>0:
        return abs(z[0])
    elif z[1]>0:
        return abs(z[1])
    elif z[2]>0:
        return abs(z[2])
    
def f2(a, b, c):
    z=[]
    z=[a]+[b]+[c]
    z.sort()
    if abs(z[2])<0:
        return z[2]
    elif abs(z[1])<0:
        return z[1]
    elif abs(z[0])<0:
        return z[0]
    
def f3(a, b, c):
    x=a+b+c
    z=10
    while True:
        if x>z and x<10*z:
            print(x//z)
            break
        z*10

def f4(a, b, c):
    return a,b,c

def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]    
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:print("Error")
    
exec(input().strip()) # DON'T remove this line 

# 1642315, 2022-09-24 10:37:17, P-T-[P-][PTPT] (17%)

def f1(a, b, c):
    z=[]
    z=[a]+[b]+[c]
    z.sort()
    if z[0]>0:
        return abs(z[0])
    elif z[1]>0:
        return abs(z[1])
    elif z[2]>0:
        return abs(z[2])
    
def f2(a, b, c):
    z=[]
    z=[a]+[b]+[c]
    z.sort()
    if abs(z[2])<0:
        return z[2]
    elif abs(z[1])<0:
        return z[1]
    elif abs(z[0])<0:
        return z[0]
    
def f3(a, b, c):
    x=a+b+c
    z=10
    while True:
        if x>z and x<10*z:
            return x//z
            break
        z*10

def f4(a, b, c):
    x=a+b+c
    return x%10

def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]    
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:print("Error")
    
exec(input().strip()) # DON'T remove this line 


6531402421
# 1641179, 2022-09-24 10:17:09, xx-P[--][P-P-] (17%)

def f1(a,b,c):
    for i in range(-1000,1001):
        if a or b or c > 0:
            if a or b or c < 0:
                if a > 0:
                    min = a
                    if b > 0 and min > b:
                        min = b
                        if c > 0 and min > c:
                            min = c
            
    return min

def f2(a,b,c):
    for i in range(-1000,1001):
        if a or b or c > 0:
            if a or b or c < 0:
                if a < 0:
                    max = a
                    if b < 0 and max < b:
                        max = b
                        if c < 0 and max < c:
                            max = c
    return max
    
def f3(a,b,c):
    for i in range(-1000,1001):
        if a or b or c > 0:
            if a or b or c < 0:
                a1 = int(a)
                b1 = int(b)
                c1 = int(c)
                sum1 = abs(a1+b1+c1)
                ans1 = sum1//10
                
    return ans1

def f4(a,b,c):
    for i in range(-1000,1001):
        if a or b or c > 0:
            if a or b or c < 0:
                a2 = int(a)
                b2 = int(b)
                c2 = int(c)
                sum2 = abs(a2+b2+c2)
                ans2 = sum2%10
    return ans2
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    for i in range(-1000,1001):
        if a or b or c > 0:
            if a or b or c < 0:
                if s1 == 0 and s2 == 0:
                    print(f1(a, b, c))
                if s1 == 0 and s2 == 1:
                    print(f2(a, b, c))
                if s1 == 1 and s2 == 0:
                    print(f3(a, b, c))
                if s1 == 1 and s2 == 1:
                    print(f4(a, b, c))
                else:
                    print('Error')
        break

exec(input().strip())
# 1641482, 2022-09-24 10:23:21, xx-P[--][P-P-] (17%)

def f1(a,b,c):
    if a or b or c > 0:
        if a or b or c < 0:
            if a > 0:
                min = a
                if b > 0 and min > b:
                    min = b
                    if c > 0 and min > c:
                        min = c
            
    return min

def f2(a,b,c):
    if a or b or c > 0:
        if a or b or c < 0:
            if a < 0:
                max = a
                if b < 0 and max < b:
                    max = b
                    if c < 0 and max < c:
                        max = c
    return max
    
def f3(a,b,c):
    if a or b or c > 0:
        if a or b or c < 0:
            a1 = int(a)
            b1 = int(b)
            c1 = int(c)
            sum1 = abs(a1+b1+c1)
            ans1 = sum1//10
                
    return ans1

def f4(a,b,c):
    if a or b or c > 0:
        if a or b or c < 0:
            a2 = int(a)
            b2 = int(b)
            c2 = int(c)
            sum2 = abs(a2+b2+c2)
            ans2 = sum2%10
    return ans2
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if a or b or c > 0:
        if a or b or c < 0:
            if s1 == 0 and s2 == 0:
                print(f1(a, b, c))
            if s1 == 0 and s2 == 1:
                print(f2(a, b, c))
            if s1 == 1 and s2 == 0:
                print(f3(a, b, c))
            if s1 == 1 and s2 == 1:
                print(f4(a, b, c))
            else:
                print('Error')

exec(input().strip())
# 1642398, 2022-09-24 10:38:16, xx-x[--][----] (0%)

def f1(a,b,c):
    while -1000 <= a and b and c <= 1000:
        if a or b or c > 0:
            if a or b or c < 0:
                if a > 0:
                    min = a
                    if b > 0 and min > b:
                        min = b
                        if c > 0 and min > c:
                            min = c
        break
    return min

def f2(a,b,c):
    while -1000 <= a and b and c <= 1000:
        if a or b or c > 0:
            if a or b or c < 0:
                if a < 0:
                    max = a
                    if b < 0 and max < b:
                        max = b
                        if c < 0 and max < c:
                            max = c
                else:
                    if b < 0:
                        max = b
                        if c < 0 and max < c:
                            max = c
                    else:
                        if c < 0:
                            max = c
        break
    return max
    
def f3(a,b,c):
    while -1000 <= a and b and c <= 1000:
        if a or b or c > 0:
            if a or b or c < 0:
                a1 = int(a)
                b1 = int(b)
                c1 = int(c)
                sum1 = abs(a1+b1+c1)
                ans1 = sum1//10
        break
                
    return ans1

def f4(a,b,c):
    while -1000 <= a and b and c <= 1000:
        if a or b or c > 0:
            if a or b or c < 0:
                a2 = int(a)
                b2 = int(b)
                c2 = int(c)
                sum2 = abs(a2+b2+c2)
                ans2 = sum2%10
        break
    return ans2
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    while -1000 <= a and b and c <= 1000:
        if a or b or c > 0:
            if a or b or c < 0:
                if s1 == 0 and s2 == 0:
                    print(f1(a, b, c))
                if s1 == 0 and s2 == 1:
                    print(f2(a, b, c))
                if s1 == 1 and s2 == 0:
                    print(f3(a, b, c))
                if s1 == 1 and s2 == 1:
                    print(f4(a, b, c))
                else:
                    print('Error')
        break

exec(input().strip())

6531406021
# 1640773, 2022-09-24 10:06:38, --xP[xx][xxxx] (17%)

def f1(a, b, c):
    if a < c and a < c:
        return a
    if b < a and b < c:
        return b
    if c < a and c < a:
        return c
    
def f2(a, b, c):
    if a > c and a > c:
        return a
    if b > a and b > c:
        return b
    if c > a and c > a:
        return c

def f3(a, b, c):
    x = a+b+c
    for i in range(4):
        if x//10**i < 1: #100 หารด้วย 10**3 < 1 แล้ว ให้แสดง 3-1 
            n = i-1
    y = x//10**n
    y = abs(y)
    return y

def f4(a, b, c):
    x = a+b+c
    x = abs(x)
    y = x % 10
    return y

def main():
    a = input().split()
    if s1 == 0 or 1 and s2 == 0 or 1:       
        if s1 == 0 and s2 == 0:
            print(f1(a, b, c))
        if s1 == 0 and s2 == 1:
            print(f2(a, b, c))
        if s1 == 1 and s2 == 0:
            print(f3(a, b, c))
        if s1 == 1 and s2 == 1:
            print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip()) #DON'T remove this line

# 1640858, 2022-09-24 10:08:45, --xP[--][----] (17%)

def f1(a, b, c):
    if a < c and a < c:
        return a
    if b < a and b < c:
        return b
    if c < a and c < a:
        return c
    
def f2(a, b, c):
    if a > c and a > c:
        return a
    if b > a and b > c:
        return b
    if c > a and c > a:
        return c

def f3(a, b, c):
    x = a+b+c
    for i in range(4):
        if x//10**i < 1: #100 หารด้วย 10**3 < 1 แล้ว ให้แสดง 3-1 
            n = i-1
    y = x//10**n
    y = abs(y)
    return y

def f4(a, b, c):
    x = a+b+c
    x = abs(x)
    y = x % 10
    return y

def main():
    a = input().split()
    if a[0] == 0 or 1 and a[1] == 0 or 1: #s1 = a[0] , s2 = a[1]
        if a[0] == 0 and a[1] == 0:
            print(f1(a, b, c))
        if a[0] == 0 and a[1] == 1:
            print(f2(a, b, c))
        if a[0] == 1 and a[1] == 0:
            print(f3(a, b, c))
        if a[0] == 1 and a[1] == 1:
            print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip()) #DON'T remove this line

# 1640894, 2022-09-24 10:09:44, --xP[--][----] (17%)

def f1(a, b, c):
    if a < c and a < c:
        return a
    if b < a and b < c:
        return b
    if c < a and c < a:
        return c
    
def f2(a, b, c):
    if a > c and a > c:
        return a
    if b > a and b > c:
        return b
    if c > a and c > a:
        return c

def f3(a, b, c):
    x = a+b+c
    for i in range(4):
        if x//10**i < 1: #100 หารด้วย 10**3 < 1 แล้ว ให้แสดง 3-1 
            n = i-1
    y = x//10**n
    y = abs(y)
    return y

def f4(a, b, c):
    x = a+b+c
    x = abs(x)
    y = x % 10
    return y

def main():
    a = input().split()
    s1 = a[0]
    s2 = a[1]
    if s1 == 0 or 1 and s2 == 0 or 1:       
        if s1 == 0 and s2 == 0:
            print(f1(a, b, c))
        if s1 == 0 and s2 == 1:
            print(f2(a, b, c))
        if s1 == 1 and s2 == 0:
            print(f3(a, b, c))
        if s1 == 1 and s2 == 1:
            print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip()) #DON'T remove this line


6530160321
# 1639712, 2022-09-24 09:37:24, ----[-P][PPPP] (17%)

def f1(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่าน้อยท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    x = [a,b,c]
    x2 = []
    for i in range(len(x)) :
        if x[i] > 0 :
            x2.append(x[i])
    j = min(x2)
    x3 = []
    for i in range(len(x2)) :
        if x2[i] == j  :
            x3.append(x[i])
    return x3[-1]
def f2(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    x = [a,b,c]
    x2 = []
    for i in range(len(x)) :
        if x[i] < 0 :
            x2.append(x[i])
    j = max(x2)
    x3 = []
    for i in range(len(x2)) :
        if x2[i] == j  :
            x3.append(x[i])
    return x3[-1]
def f3(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเคร่ืองหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
    k = a+b+c
    if (str(k))[0] == "-" :
        return (str(k))[1]
    else :
        return (str(k))[0]
def f4(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    k = a + b + c
    return (str(k))[-1]
def main():
# รับข้อมูลจากคีย์บอร์ดเป็นจํานวนเต็ม 5 จํานวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
    s1,s2,a,b,c = [ int(e) for e in input().split() ]
# ค่าของ a, b และ c เป็นไปตามข้อกําหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c) # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c) # ถ้าs1 หรือs2 เป็นค่าอ่ืนให้แสดงคําว่าError
    if s1 == 0 and s2 == 0 :
        g = f1(a,b,c)
        return print(g)
    elif s1 == 0 and s2 == 1 :
        g2 = f2(a, b, c)
        return print(g2)
     # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
    elif s1 == 1 and s2 == 0 :
        g3 = f3(a, b, c)
        return print(g3)
    #ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
    elif s1 == 1 and s2 == 1 :
        g4 = f4(a,b,c)
        return print(g4)
    #ถ้าs1 หรือs2 เป็นค่าอ่ืนให้แสดงคําว่าError
    else :
        return print("Error")


exec(input().strip()) # DON'T remove this line
# 1640898, 2022-09-24 10:09:54, ----[-P][-P-P] (0%)

def f1(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่าน้อยท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    x = [a,b,c]
    x2 = []
    for i in range(len(x)) :
        if x[i] > 0 :
            x2.append(x[i])
    j = min(x2)
    x3 = []
    for i in range(len(x2)) :
        if x2[i] == j  :
            x3.append(x[i])
    return x3[-1]
def f2(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    x = [a,b,c]
    x2 = []
    for i in range(len(x)) :
        if x[i] < 0 :
            x2.append(x[i])
    j = max(x2)
    x3 = []
    for i in range(len(x2)) :
        if x2[i] == j  :
            x3.append(x[i])
    return x3[-1]
def f3(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเคร่ืองหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
    k = a+b+c
    if (str(k))[0] == "-" :
        return (str(k))[1]
    else :
        return (str(k))[0]
def f4(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    k = a + b + c
    return (str(k))[-1]
def main():
# รับข้อมูลจากคีย์บอร์ดเป็นจํานวนเต็ม 5 จํานวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
    s1,s2,a,b,c = [ int(e) for e in input().split() ]
# ค่าของ a, b และ c เป็นไปตามข้อกําหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c) # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c) # ถ้าs1 หรือs2 เป็นค่าอ่ืนให้แสดงคําว่าError
    if s1 == 0 and s2 == 0 :
        g = f1(a,b,c)
        return print(g)
    elif s1 == 0 and s2 == 1 :
        g2 = f2(a, b, c)
        return print(g2)
     # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
    elif s1 == 1 and s2 == 0 :
        g3 = f3(a, b, c)
        return print(g3)
    #ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
    elif s1 == 1 and s2 == 1 :
        g4 = f4(a,b,c)
        return print(g4)
    #ถ้าs1 หรือs2 เป็นค่าอ่ืนให้แสดงคําว่าError
    elif s1 != 0 and s2 != 0 :
        return print("Error")
exec(input().strip()) # DON'T remove this line
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
# ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
# ถ้าs1 หรือs2 เป็นค่าอ่ืนให้แสดงคําว่าError
# 1640915, 2022-09-24 10:10:20, ----[-P][PPPP] (17%)

def f1(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่าน้อยท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    x = [a,b,c]
    x2 = []
    for i in range(len(x)) :
        if x[i] > 0 :
            x2.append(x[i])
    j = min(x2)
    x3 = []
    for i in range(len(x2)) :
        if x2[i] == j  :
            x3.append(x[i])
    return x3[-1]
def f2(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    x = [a,b,c]
    x2 = []
    for i in range(len(x)) :
        if x[i] < 0 :
            x2.append(x[i])
    j = max(x2)
    x3 = []
    for i in range(len(x2)) :
        if x2[i] == j  :
            x3.append(x[i])
    return x3[-1]
def f3(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเคร่ืองหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
    k = a+b+c
    if (str(k))[0] == "-" :
        return (str(k))[1]
    else :
        return (str(k))[0]
def f4(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    k = a + b + c
    return (str(k))[-1]
def main():
# รับข้อมูลจากคีย์บอร์ดเป็นจํานวนเต็ม 5 จํานวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
    s1,s2,a,b,c = [ int(e) for e in input().split() ]
# ค่าของ a, b และ c เป็นไปตามข้อกําหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c) # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c) # ถ้าs1 หรือs2 เป็นค่าอ่ืนให้แสดงคําว่าError
    if s1 == 0 and s2 == 0 :
        g = f1(a,b,c)
        return print(g)
    elif s1 == 0 and s2 == 1 :
        g2 = f2(a, b, c)
        return print(g2)
     # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
    elif s1 == 1 and s2 == 0 :
        g3 = f3(a, b, c)
        return print(g3)
    #ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
    elif s1 == 1 and s2 == 1 :
        g4 = f4(a,b,c)
        return print(g4)
    #ถ้าs1 หรือs2 เป็นค่าอ่ืนให้แสดงคําว่าError
    else :
        return print("Error")
exec(input().strip()) # DON'T remove this line
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
# ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
# ถ้าs1 หรือs2 เป็นค่าอ่ืนให้แสดงคําว่าError

6230058821
# 1640788, 2022-09-24 10:06:59, ---P[--][----] (17%)

def f1(a,b,c) :
    if a > 0 and b < 0 and c < 0 :
        return ('a')
    if b > 0 and a < 0 and c < 0 :
        return ('b')
    if c > 0 and a < 0 and b < 0 :
         return ('c')
    if a > 0 and  b > 0 and c < 0 :
         return min(a,b)
    if a > 0 and  c > 0 and b < 0 :
         return min(a,c)
    if b > 0 and  c > 0 and a < 0 :
         return min(b,c)
def f2(a,b,c) :
    if a > 0 and b > 0 and c < 0 :
        return ('c')
    if a > 0 and c > 0 and b < 0 :
        return ('b')
    if b > 0 and c < 0 and a < 0 :
         return ('a')
    if a > 0 and  b < 0 and c < 0 :
         return max(b,c)
    if a < 0 and  c > 0 and b < 0 :
         return max(a,b)
    if b > 0 and  c < 0 and a < 0 :
         return min(a,c)
def f3(a,b,c) :
    if 0 < abs(a+b+c)  < 10 :
        return abs(a+b+c)
    if 0 < abs(a+b+c)//10  < 10 :
        return (abs(a+b+c)//10)
    if 0 < abs(a+b+c)//100 < 10 :
         return (abs(a+b+c)//100)
def f4 (a,b,c) :
    return (abs(a+b+c)%10)
    
def main() :
    d = input().split()
    if d[0] and d[1] == 0 :
        return (f1(d[2],d[3],d[4]))
    elif d[0] == 0 and d[1] == 1 :
        return (f2(d[2],d[3],d[4]))
    elif d[0] == 1 and d[1] == 0 :
        return (f3(d[2],d[3],d[4]))
    elif d[0] == 1 and d[1] == 1 :
        return (f4(d[2],d[3],d[4]))
    else :
        return ('Error')
    









exec(input().strip()) # DON'T remove this line

# 1640981, 2022-09-24 10:12:01, ---P[--][P-P-] (17%)

def f1(a,b,c) :
    if a > 0 and b < 0 and c < 0 :
        return ('a')
    if b > 0 and a < 0 and c < 0 :
        return ('b')
    if c > 0 and a < 0 and b < 0 :
         return ('c')
    if a > 0 and  b > 0 and c < 0 :
         return min(a,b)
    if a > 0 and  c > 0 and b < 0 :
         return min(a,c)
    if b > 0 and  c > 0 and a < 0 :
         return min(b,c)
def f2(a,b,c) :
    if a > 0 and b > 0 and c < 0 :
        return ('c')
    if a > 0 and c > 0 and b < 0 :
        return ('b')
    if b > 0 and c < 0 and a < 0 :
         return ('a')
    if a > 0 and  b < 0 and c < 0 :
         return max(b,c)
    if a < 0 and  c > 0 and b < 0 :
         return max(a,b)
    if b > 0 and  c < 0 and a < 0 :
         return min(a,c)
def f3(a,b,c) :
    if 0 < abs(a+b+c)  < 10 :
        return abs(a+b+c)
    if 0 < abs(a+b+c)//10  < 10 :
        return (abs(a+b+c)//10)
    if 0 < abs(a+b+c)//100 < 10 :
         return (abs(a+b+c)//100)
def f4 (a,b,c) :
    return (abs(a+b+c)%10)
    
def main() :
    d = input().split()
    if d[0] and d[1] == 0 :
        print (f1(d[2],d[3],d[4]))
    elif d[0] == 0 and d[1] == 1 :
        print (f2(d[2],d[3],d[4]))
    elif d[0] == 1 and d[1] == 0 :
        print (f3(d[2],d[3],d[4]))
    elif d[0] == 1 and d[1] == 1 :
        print (f4(d[2],d[3],d[4]))
    else :
        print('Error')
    









exec(input().strip()) # DON'T remove this line


6230423121
# 1641755, 2022-09-24 10:28:19, ----[--][----] (0%)

def f1(a, b, c):
    x = [a,b,c]
    for i in range(len(x)):
        x[i] = int(x[i])
    x.sort()
    n = 0
    if x[n] < 0:
        x.pop(n)
    else:
        n += 1
    a = x[0]
    return a 
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
def f2(a, b, c):
    x = [a,b,c]
    for i in range(len(x)):
        x[i] = int(x[i])
    x.sort()
    n = 0
    if x[n] > 0:
        x.pop(n)
    else:
        n += 1
    a = x[-1]
    return a 
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
def f3(a, b, c):
    x = [a,b,c]
    for i in range(len(x)):
        x[i] = int(x[i])
    x.sort()
    a = str(abs(sum(x)))
    b = a[0]
    return b
    
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
def f4(a, b, c):
    x = [a,b,c]
    for i in range(len(x)):
        x[i] = int(x[i])
    x.sort()
    a = str(abs(sum(x)))
    b = a[-1]
    return b
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
def main():
    x = input().split(" ")
    s1 = int(x[0])
    s2 = int(x[1])
    a = x[2]
    b = x[3]
    c = x[4]
    print(s2)
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
    
# รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
# ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
# ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error


exec(input().strip()) # DON'T remove this line
# 1641829, 2022-09-24 10:29:42, ----[P-][PPPP] (17%)

def f1(a, b, c):
    x = [a,b,c]
    for i in range(len(x)):
        x[i] = int(x[i])
    x.sort()
    n = 0
    if x[n] < 0:
        x.pop(n)
    else:
        n += 1
    a = x[0]
    return a 
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
def f2(a, b, c):
    x = [a,b,c]
    for i in range(len(x)):
        x[i] = int(x[i])
    x.sort()
    n = 0
    if x[n] > 0:
        x.pop(n)
    else:
        n += 1
    a = x[-1]
    return a 
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
def f3(a, b, c):
    x = [a,b,c]
    for i in range(len(x)):
        x[i] = int(x[i])
    x.sort()
    a = str(abs(sum(x)))
    b = a[0]
    return b
    
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
def f4(a, b, c):
    x = [a,b,c]
    for i in range(len(x)):
        x[i] = int(x[i])
    x.sort()
    a = str(abs(sum(x)))
    b = a[-1]
    return b
# a, b และ c มีค่าตามข้อกำหนดข้างบน
# คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
def main():
    x = input().split(" ")
    s1 = int(x[0])
    s2 = int(x[1])
    a = x[2]
    b = x[3]
    c = x[4]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
    
# รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
# ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
# ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
# ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error


exec(input().strip()) # DON'T remove this line

6531410421
# 1641961, 2022-09-24 10:31:53, ----[PP][P-P-] (17%)

def f1(a,b,c):
    if a > 0 and b > 0 and c < 0:
        return min(a,b)
    if a > 0 and c > 0 and b < 0:
        return min(a,c)
    if b > 0 and c > 0 and a < 0:
        return min(a,c)
    

def f2(a,b,c):
    if a < 0 and b < 0 and c > 0:
        return max(a,b)
    if a < 0 and c < 0 and b > 0:
        return max(a,c)
    if b < 0 and c < 0 and a > 0:
        return max(b,c)

    
def f3(a,b,c):
    sol_1 = a + b + c
    sol_2 = abs(sol_1)
    sol_3 = str(sol_2)
    sol_4 = sol_3[0]
    return sol_4
     
def f4(a,b,c):
    sol_1 = a + b + c
    sol_2 = abs(sol_1)
    sol_3 = str(sol_2)
    sol_4 = sol_3[1]
    return sol_4
    
def main():
    n = [int(e) for e in input().split()]
    a = n[2]
    b = n[3]
    c = n[4]
    if n[0] == 0 and n[1] == 0:
        print(f1(a, b, c))
    if n[0] == 0 and n[1] == 1:
        print(f2(a, b, c))
    if n[0] == 1 and n[1] == 0:
        print(f3(a, b, c))
    if n[0] == 1 and n[1] == 1:
        print(f4(a, b ,c))
    if (n[0] or n[1] not in [0,1]):
        print("Error")
        
exec(input().strip())
    
# 1641994, 2022-09-24 10:32:37, ----[PP][P-P-] (17%)

def f1(a,b,c):
    if a > 0 and b > 0 and c < 0:
        return min(a,b)
    if a > 0 and c > 0 and b < 0:
        return min(a,c)
    if b > 0 and c > 0 and a < 0:
        return min(a,c)
    

def f2(a,b,c):
    if a < 0 and b < 0 and c > 0:
        return max(a,b)
    if a < 0 and c < 0 and b > 0:
        return max(a,c)
    if b < 0 and c < 0 and a > 0:
        return max(b,c)

    
def f3(a,b,c):
    sol_1 = a + b + c
    sol_2 = abs(sol_1)
    sol_3 = str(sol_2)
    sol_4 = sol_3[0]
    return sol_4
     
def f4(a,b,c):
    sol_1 = a + b + c
    sol_2 = abs(sol_1)
    sol_3 = str(sol_2)
    sol_4 = sol_3[1]
    return sol_4
    
def main():
    n = [int(e) for e in input().split()]
    a = n[2]
    b = n[3]
    c = n[4]
    if n[0] == 0 and n[1] == 0:
        print(f1(a, b, c))
    if n[0] == 0 and n[1] == 1:
        print(f2(a, b, c))
    if n[0] == 1 and n[1] == 0:
        print(f3(a, b, c))
    if n[0] == 1 and n[1] == 1:
        print(f4(a, b ,c))
    if (n[0] or n[1] not in [0,1]) and (n[0] or n[1] not in [0,1]):
        print("Error")
        
exec(input().strip())

6531010021
# 1641386, 2022-09-24 10:21:09, ----[--][----] (0%)


def f1(a, b, c):

    a = int(a)
    b = int(b)
    c = int(c)
    min_ = a 
    if b < min_ and b > 0 and a > 0:
        min_ = b
    if c < min_ and c > 0:
        min_= c
    return min_
      
def f2(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    mx = a 
    if b > mx and b < 0 and a < 0:
        mx = b
    if c > mx and c < 0:
        mx = c
    return mx
    
def f3(a, b, c):

    a = int(a)
    b = int(b)
    c = int(c)
    x = a + b + c
    x = str(x)
    y = str(x[:2])
    return y
def f4(a, b, c):
    x = a + b + c
   
def main():

    s1,s2, a, b, c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0 :
        x = f1(a, b, c)
        return f1(a, b, c)
    elif s1 == 0 and s2 == 1:
        return f2(a, b, c)
    elif s1 == 1 and s2 == 0:
        return f3(a, b, c)
    elif s1 ==1 and s2 ==1 :
        return f4(a, b, c)
    else :
        return "Error"

exec(input().strip())
# 1641827, 2022-09-24 10:29:41, --xP[--][----] (17%)


def f1(a, b, c):

    a = int(a)
    b = int(b)
    c = int(c)
    min_ = a 
    if b < min_ and b > 0 and a > 0:
        min_ = b
    if c < min_ and c > 0:
        min_= c
    return min_
      
def f2(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    mx = a 
    if b > mx and b < 0 and a < 0:
        mx = b
    if c > mx and c < 0:
        mx = c
    return mx
    
def f3(a, b, c):

 
    x = a + b + c
    x = str(x)
    y = int(str(x[1]))
    return y
def f4(a, b, c):
    x = a + b + c
    x = str(x)
    y = int(str(x[-1]))
    return y
   
def main():

    s1,s2, a, b, c = [int(e) for e in input().split()]

    if s1 == 0 and s2 == 0 :  
        return f1(a, b, c)
    
    if s1 == 0 and s2 == 1: 
        return f2(a, b, c)
    if s1 == 1 and s2 == 0:
        return f3(a, b, c)
    if s1 ==1 and s2 ==1 :
        return  f4(a, b, c)
    else :
        return "Error"

exec(input().strip())

6431027721
# 1640962, 2022-09-24 10:11:31, --x-[PP][----] (17%)

def f1(a, b, c):
    min = 0
    if a > 0 and b > 0 and c > 0:
        min = a
        if b < a:
            min = b
        elif c < b:
            min = c
    elif a > 0 and b > 0 and c <0 :
        min = a
        if b < a:
            min = b
    elif c > 0 and b > 0 and a <0:
        min = b
        if c < b:
            min = c
    elif c > 0 and a > 0 and b <0:
        min = a
        if c < a:
            min = c
    elif c < 0 and a > 0 and b <0:
        min = a
    elif c > 0 and a < 0 and b <0:
        c = min
    elif c < 0 and a < 0 and b >0:
        min = c
        
    return min
        
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่าน้อยท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
def f2(a, b, c):
    max = 0
    if a < 0 and b < 0 and c < 0:
        max = a
        if b > a:
            max = b
        elif c > b:
            max = c
    elif a < 0 and b < 0 and c >0 :
        max = a
        if b > a:
            max = b
    elif c < 0 and b < 0 and a >0:
        max = b
        if c > b:
            max = c
    elif c < 0 and a < 0 and b >0:
        max = a
        if c > a:
            max = c
    elif c > 0 and a < 0 and b >0:
        max = a
    elif c < 0 and a > 0 and b >0:
        max = c
    elif c > 0 and a > 0 and b <0:
        max = b
        
    return max
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
def f3(a, b, c):
    x = str(a+b+c)
    l = x[-2]
    
    return l
    
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเคร่ืองหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
def f4(a, b, c):
    x = str(a+b+c)
    r = x[-1]
    
    return r
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('error')
    
    
    
# รับข้อมูลจากคีย์บอร์ดเป็นจํานวนเต็ม 5 จํานวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกําหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c) # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c) # ถ้าs1 หรือs2 เป็นค่าอ่ืนให้แสดงคําว่าError
exec(input().strip()) # DON'T remove this line

6530026021
# 1642449, 2022-09-24 10:38:50, -xxP[--][P-P-] (17%)

def f1(a, b, c):
    if a < b and a < c :
        a = min
    else :
        if b < a and b < c :
            b = min
        else :
            if c < a and c < b :
                c = min
    return min
def f4(a, b, c):
    x = int(a) + int(b) + int(c)
    o = abs(x) % 10
    return o
def main():
    x = input().split()
    s1 = x[0]
    s2 = x[1]
    a = x[2]
    b = x[3]
    c = x[4]
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    elif not s1 == 0 or s1 == 1 or s2 == 0 or s2 == 1 :
        print('Error')
exec(input().strip())

Max Score = 0


6530130521
# 1639831, 2022-09-24 09:40:40, ----[--][----] (0%)

def f1(a, b, c):
    x = [int(a), int(b), int(c)]
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000 :
        out = []
        for i in range(len(x)):
            if x[i]>=0:
                out.append(x[i])
        out.sort()
    return x[0]
# 1640054, 2022-09-24 09:47:00, ----[--][----] (0%)

def f1(a, b, c):
    x = [int(a), int(b), int(c)]
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000 :
        out = []
        for i in range(len(x)):
            if x[i]>=0:
                out.append(x[i])
        y = min(out)
    return y
# 1640087, 2022-09-24 09:47:48, ----[--][----] (0%)

def f1(a, b, c):
    x = [int(a), int(b), int(c)]
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000 :
        out = []
        for i in range(len(x)):
            if x[i]>=0:
                out.append(x[i])
        y = min(out)
    return int(y)
# 1640119, 2022-09-24 09:48:56, ----[--][----] (0%)

def f2(a, b, c):
    x = [int(a), int(b), int(c)]
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000 :
        out = []
        for i in range(len(x)):
            if x[i]<0:
                out.append(x[i])
        y = max(out)
    return y
    
    
# 1640930, 2022-09-24 10:10:41, ----[--][----] (0%)

def f1(a, b, c):
    x = [int(a), int(b), int(c)]
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000 :
        out = []
        for i in range(len(x)):
            if x[i]>=0:
                out.append(x[i])
        y = min(out)
    return int(y)

def f2(a, b, c):
    x = [int(a), int(b), int(c)]
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000 :
        out = []
        for i in range(len(x)):
            if x[i]<0:
                out.append(x[i])
        y = max(out)
    return y
# 1641048, 2022-09-24 10:13:49, ----[--][----] (0%)

def f1(a, b, c):
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000 :
        x = [int(a), int(b), int(c)]
        out = []
        for i in range(len(x)):
            if x[i]>=0:
                out.append(x[i])
        y = min(out)
    return int(y)
# 1641109, 2022-09-24 10:15:31, compilation error (0%)

def f1(a, b, c):
        x = [int(a), int(b), int(c)]
        out = []
        for i in range(len(x)):
            if x[i]>=0:
                out.append(x[i])
        y = min(out)
    return int(y)
# 1641190, 2022-09-24 10:17:21, ----[--][----] (0%)

def f1(a, b, c):
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000 :
        x = [int(a), int(b), int(c)]
        out = []
        for i in range(len(x)):
            if x[i]>=0:
                out.append(x[i])
        y = min(out)
    return y

def f2(a, b, c):
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000 :
        x = [int(a), int(b), int(c)]
        out = []
        for i in range(len(x)):
            if x[i]<0:
                out.append(x[i])
        y = max(out)
    return y
# 1641672, 2022-09-24 10:26:43, ----[--][----] (0%)

def f1(a, b, c):
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000 :
        x = [a, b, c]
        out = []
        for i in range(len(x)):
            if x[i]>=0:
                out.append(x[i])
        y = min(out)
    return y
# 1641735, 2022-09-24 10:27:56, ----[--][----] (0%)

def f1(a, b, c):
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000 :
        x = [int(a), int(b), int(c)]
        out = []
        for i in range(len(x)):
            if x[i]>=0:
                out.append(x[i])
        y = min(out)
    return y

def f2(a, b, c):
    if -1000<=a<=1000 and -1000<=b<=1000 and -1000<=c<=1000 :
        x = [int(a), int(b), int(c)]
        out = []
        for i in range(len(x)):
            if x[i]<0:
                out.append(x[i])
        y = max(out)
    return y

    
print(f1(2, -18, 4))
print(f2(-20, -18, 4))
# 1642109, 2022-09-24 10:34:32, compilation error (0%)

x=[]
for i in range(0,2001):
    a = -1000+i
    x.append(a)

def f1(a, b, c):
    if a,b,c in x:
        x = [int(a), int(b), int(c)]
        out = []
        for i in range(len(x)):
            if x[i]>=0:
                out.append(x[i])
        y = min(out)
    return y

# 1642201, 2022-09-24 10:35:48, ----[--][----] (0%)

x=[]
for i in range(0,2001):
    a = -1000+i
    x.append(a)

def f1(a, b, c):
    x = [int(a), int(b), int(c)]
    out = []
    for i in range(len(x)):
        if x[i]>=0:
            out.append(x[i])
    y = min(out)
    return y

# 1642245, 2022-09-24 10:36:26, ----[--][----] (0%)

x=[]
for i in range(0,2001):
    a = -1000+i
    x.append(a)

def f1(a, b, c):
    x = [int(a), int(b), int(c)]
    out = []
    for i in range(len(x)):
        if x[i]>=0:
            out.append(x[i])
    y = min(out)
    return y

def f2(a, b, c):
    x = [int(a), int(b), int(c)]
    out = []
    for i in range(len(x)):
        if x[i]<0:
                out.append(x[i])
    y = max(out)
    return y
# 1642409, 2022-09-24 10:38:21, ----[--][----] (0%)

x=[]
for i in range(0,2001):
    a = -1000+i
    x.append(a)

def f1(a, b, c):
    if a and b and c in x:
        x = [int(a), int(b), int(c)]
        out = []
        for i in range(len(x)):
            if x[i]>=0:
                out.append(x[i])
        y = min(out)
        return y

6530081421
# 1641071, 2022-09-24 10:14:23, compilation error (0%)

def f1(a,b,c):
    a,b,c = int(input())
    -1000<= a <= 1000 and a > 0
    -1000<= b <= 1000 and b < 0
    -1000<= c <= 1000 and c < 0
    return a
def f2(a,b,c):
    a,b,c = int(input())
    -1000<= a <= 1000 and a > 0
    -1000<= b <= 1000 and b > 0
    -1000<= c <= 1000 and c < 0 
    return
def f3(a,b,c) :
    a,b,c = int(input())
    -1000<= a <= 1000  
    -1000<= b <= 1000
    -1000<= c <= 1000
    return
def f4(a,b,c):
    a,b,c = int(input())
    -1000<= a <= 1000
    -1000<= b <= 1000
    -1000<= c <= 1000
    return
def main():
    s1,s2,a,b,c = input.split()
    s1 = int(s1)
    s2 = int(s2)
     a = int(a)
     b = int(b)
     c = int(c)
    if s1 == 0 and s2 == 0:
         print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else :
        print("Error")
exec(input().strip()) # DON'T remove this line
    
    

# 1641107, 2022-09-24 10:15:28, compilation error (0%)

def f1(a,b,c):
    a,b,c = int(input())
    -1000<= a <= 1000 and a > 0
    -1000<= b <= 1000 and b < 0
    -1000<= c <= 1000 and c < 0
    return a
def f2(a,b,c):
    a,b,c = int(input())
    -1000<= a <= 1000 and a > 0
    -1000<= b <= 1000 and b > 0
    -1000<= c <= 1000 and c < 0 
    return b
def f3(a,b,c) :
    a,b,c = int(input())
    -1000<= a <= 1000  
    -1000<= b <= 1000
    -1000<= c <= 1000
    return
def f4(a,b,c):
    a,b,c = int(input())
    -1000<= a <= 1000
    -1000<= b <= 1000
    -1000<= c <= 1000
    return
def main():
    s1,s2,a,b,c = input.split()
    s1 = int(s1)
    s2 = int(s2)
     a = int(a)
     b = int(b)
     c = int(c)
    if s1 == 0 and s2 == 0:
         print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else :
        print("Error")
exec(input().strip()) # DON'T remove this line
# 1641606, 2022-09-24 10:25:36, xxxx[xx][xxxx] (0%)

def f1(a,b,c):
    a,b,c = int(input())
    -1000<= a <= 1000 and a > 0
    -1000<= b <= 1000 and b < 0
    -1000<= c <= 1000 and c < 0
    return a
def f2(a,b,c):
    a,b,c = int(input())
    -1000<= a <= 1000 and a > 0
    -1000<= b <= 1000 and b > 0
    -1000<= c <= 1000 and c < 0 
    return
def f3(a,b,c) :
    a,b,c = int(input())
    -1000<= a <= 1000  
    -1000<= b <= 1000
    -1000<= c <= 1000
    return a 
def f4(a,b,c):
    a,b,c = int(input())
    -1000<= a <= 1000
    -1000<= b <= 1000
    -1000<= c <= 1000
    return b
def main():
    s1,s2,a,b,c = input.split()
    s1 = int(s1)
    s2 = int(s2)
    a,b,c = int(input())
    -1000<= a <= 1000
    -1000<= b <= 1000
    -1000<= c <= 1000
    if s1 == 0 and s2 == 0:
         print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else :
        print("Error")
exec(input().strip()) # DON'T remove this line
    
    
# 1641784, 2022-09-24 10:28:57, xxxx[xx][xxxx] (0%)

def f1(a,b,c):
    a,b,c = int(input())
    -1000<= a <= 1000 and a > 0
    -1000<= b <= 1000 and b < 0
    -1000<= c <= 1000 and c < 0
    return a
def f2(a,b,c):
    a,b,c = int(input())
    -1000<= a <= 1000 and a > 0
    -1000<= b <= 1000 and b > 0
    -1000<= c <= 1000 and c < 0 
    return b
def f3(a,b,c) :
    a,b,c = int(input())
    -1000<= a <= 1000  
    -1000<= b <= 1000
    -1000<= c <= 1000
    return a 
def f4(a,b,c):
    a,b,c = int(input())
    -1000<= a <= 1000
    -1000<= b <= 1000
    -1000<= c <= 1000
    return b
def main():
    s1,s2,a,b,c = input.split()
    s1 = int(s1)
    s2 = int(s2)
    a,b,c = int(input())
    -1000<= a <= 1000
    -1000<= b <= 1000
    -1000<= c <= 1000
    if s1 == 0 and s2 == 0:
         print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else :
        print("Error")
exec(input().strip()) # DON'T remove this line
# 1641843, 2022-09-24 10:29:53, ----[--][----] (0%)

def f1(a,b,c):
    a,b,c = int(input())
    -1000<= a <= 1000 and a > 0
    -1000<= b <= 1000 and b < 0
    -1000<= c <= 1000 and c < 0
    return a
def f2(a,b,c):
    a,b,c = int(input())
    -1000<= a <= 1000 and a > 0
    -1000<= b <= 1000 and b > 0
    -1000<= c <= 1000 and c < 0 
    return b
def f3(a,b,c) :
    a,b,c = int(input())
    -1000<= a <= 1000  
    -1000<= b <= 1000
    -1000<= c <= 1000
    return a 
def f4(a,b,c):
    a,b,c = int(input())
    -1000<= a <= 1000
    -1000<= b <= 1000
    -1000<= c <= 1000
    return b
def main():
    s1,s2,a,b,c = input.split()
    s1 = int(s1)
    s2 = int(s2)
    a,b,c = int(input())
    -1000<= a <= 1000
    -1000<= b <= 1000
    -1000<= c <= 1000
    if s1 == 0 and s2 == 0:
         print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else :
        print("Error")
# 1641876, 2022-09-24 10:30:21, ----[--][----] (0%)

def f1(a,b,c):
    a,b,c = int(input())
    -1000<= a <= 1000 and a > 0
    -1000<= b <= 1000 and b < 0
    -1000<= c <= 1000 and c < 0
    return a
def f2(a,b,c):
    a,b,c = int(input())
    -1000<= a <= 1000 and a > 0
    -1000<= b <= 1000 and b > 0
    -1000<= c <= 1000 and c < 0 
    return b
def f3(a,b,c) :
    a,b,c = int(input())
    -1000<= a <= 1000  
    -1000<= b <= 1000
    -1000<= c <= 1000
    return a 
def f4(a,b,c):
    a,b,c = int(input())
    -1000<= a <= 1000
    -1000<= b <= 1000
    -1000<= c <= 1000
    return b
def main():
    s1,s2,a,b,c = input.split()
    s1 = int(s1)
    s2 = int(s2)
    a,b,c = int(input())
    -1000<= a <= 1000
    -1000<= b <= 1000
    -1000<= c <= 1000
    if s1 == 0 and s2 == 0:
         print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    else :
        print("Error")
# 1641899, 2022-09-24 10:30:41, ----[--][----] (0%)

def f1(a,b,c):
    a,b,c = int(input())
    -1000<= a <= 1000 and a > 0
    -1000<= b <= 1000 and b < 0
    -1000<= c <= 1000 and c < 0
    return a
def f2(a,b,c):
    a,b,c = int(input())
    -1000<= a <= 1000 and a > 0
    -1000<= b <= 1000 and b > 0
    -1000<= c <= 1000 and c < 0 
    return b
def main():
    s1,s2,a,b,c = input.split()
    s1 = int(s1)
    s2 = int(s2)
    a,b,c = int(input())
    -1000<= a <= 1000
    -1000<= b <= 1000
    -1000<= c <= 1000
    if s1 == 0 and s2 == 0:
         print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    else :
        print("Error")

6531008921
# 1639526, 2022-09-24 09:32:27, -xxx[xx][xxxx] (0%)

def f1(a, b, c):
    if a > 0 and b >0 and c>0:
        if a>b>c:
            print(c)
        elif b>a>c:
            print(c)
        elif c>b>a:
            print(a)
        elif b>c>a:
            print(a)
        elif a>c>b:
            print(b)
        elif c>a>b:
            print(b)
    if a > 0 and b >0 and c<=0:
        if a>b:
            print(b)
        elif b>a:
            print(a)
    if c > 0 and b >0 and a<=0:
        if c>b:
            print(b)
        elif b>c:
            print(c)
    if c > 0 and a >0 and b<=0:
        if c>a:
            print(a)
        elif a>c:
            print(c)       
exec(input().strip()) # DON'T remove this line


# 1639573, 2022-09-24 09:33:46, compilation error (0%)

def f1(a, b, c):
    if a > 0 and b >0 and c>0:
        if a>b>c:
            print(c)
        elif b>a>c:
            print(c)
        elif c>b>a:
            print(a)
        elif b>c>a:
            print(a)
        elif a>c>b:
            print(b)
        elif c>a>b:
            print(b)
    if a > 0 and b >0 and c<=0:
        if a>b:
            print(b)
        elif b>a:
            print(a)
    if c > 0 and b >0 and a<=0:
        if c>b:
            print(b)
        elif b>c:
            print(c)
    if c > 0 and a >0 and b<=0:
        if c>a:
            print(a)
        elif a>c:
            print(c)       

def f2(a, b, c):
def f3(a, b, c):

def f4(a, b, c):

def main():
exec(input().strip()) # DON'T remove this line

# 1639575, 2022-09-24 09:33:49, compilation error (0%)

def f1(a, b, c):
    if a > 0 and b >0 and c>0:
        if a>b>c:
            print(c)
        elif b>a>c:
            print(c)
        elif c>b>a:
            print(a)
        elif b>c>a:
            print(a)
        elif a>c>b:
            print(b)
        elif c>a>b:
            print(b)
    if a > 0 and b >0 and c<=0:
        if a>b:
            print(b)
        elif b>a:
            print(a)
    if c > 0 and b >0 and a<=0:
        if c>b:
            print(b)
        elif b>c:
            print(c)
    if c > 0 and a >0 and b<=0:
        if c>a:
            print(a)
        elif a>c:
            print(c)       

def f2(a, b, c):
def f3(a, b, c):

def f4(a, b, c):

def main():
exec(input().strip()) # DON'T remove this line
# 1639607, 2022-09-24 09:34:38, -xxx[xx][xxxx] (0%)

def f1(a, b, c):
    if a > 0 and b >0 and c>0:
        if a>b>c:
            print(c)
        elif b>a>c:
            print(c)
        elif c>b>a:
            print(a)
        elif b>c>a:
            print(a)
        elif a>c>b:
            print(b)
        elif c>a>b:
            print(b)
    if a > 0 and b >0 and c<=0:
        if a>b:
            print(b)
        elif b>a:
            print(a)
    if c > 0 and b >0 and a<=0:
        if c>b:
            print(b)
        elif b>c:
            print(c)
    if c > 0 and a >0 and b<=0:
        if c>a:
            print(a)
        elif a>c:
            print(c)       


exec(input().strip()) # DON'T remove this line

# 1639845, 2022-09-24 09:40:53, --xx[xx][xxxx] (0%)

def f1(a, b, c):
    if a > 0 and b >0 and c>0:
        if a>b>c:
            print(c)
        elif b>a>c:
            print(c)
        elif c>b>a:
            print(a)
        elif b>c>a:
            print(a)
        elif a>c>b:
            print(b)
        elif c>a>b:
            print(b)
    if a > 0 and b >0 and c<=0:
        if a>b:
            print(b)
        elif b>a:
            print(a)
    if c > 0 and b >0 and a<=0:
        if c>b:
            print(b)
        elif b>c:
            print(c)
    if c > 0 and a >0 and b<=0:
        if c>a:
            print(a)
        elif a>c:
            print(c)
def f2(a, b, c):
    if a < 0 and b <0 and c<0:
        if a>b>c:
            print(a)
        elif b>a>c:
            print(b)
        elif c>b>a:
            print(c)
        elif b>c>a:
            print(b)
        elif a>c>b:
            print(a)
        elif c>a>b:
            print(c)
    if a < 0 and b <0 and c>=0:
        if a>b:
            print(a)
        elif b>a:
            print(b)
    if c < 0 and b <0 and a>=0:
        if c>b:
            print(c)
        elif b>c:
            print(b)
    if c < 0 and a <0 and b>=0:
        if c>a:
            print(c)
        elif a>c:
            print(a)
    
exec(input().strip()) # DON'T remove this line

# 1641771, 2022-09-24 10:28:39, compilation error (0%)

def f1(a, b, c):
    if a > 0 and b >0 and c>0:
        if a>b>c:
            print(c)
        elif b>a>c:
            print(c)
        elif c>b>a:
            print(a)
        elif b>c>a:
            print(a)
        elif a>c>b:
            print(b)
        elif c>a>b:
            print(b)
    if a > 0 and b >0 and c<=0:
        if a>b:
            print(b)
        elif b>a:
            print(a)
    if c > 0 and b >0 and a<=0:
        if c>b:
            print(b)
        elif b>c:
            print(c)
    if c > 0 and a >0 and b<=0:
        if c>a:
            print(a)
        elif a>c:
            print(c)
def f2(a, b, c):
    if a < 0 and b <0 and c<0:
        if a>b>c:
            print(a)
        elif b>a>c:
            print(b)
        elif c>b>a:
            print(c)
        elif b>c>a:
            print(b)
        elif a>c>b:
            print(a)
        elif c>a>b:
            print(c)
    if a < 0 and b <0 and c>=0:
        if a>b:
            print(a)
        elif b>a:
            print(b)
    if c < 0 and b <0 and a>=0:
        if c>b:
            print(c)
        elif b>c:
            print(b)
    if c < 0 and a <0 and b>=0:
        if c>a:
            print(c)
        elif a>c:
            print(a)
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 = 0 and s2 = 0:
        print(def f1(a, b, c))
    if s1 = 0 and s2 = 1:
        print(def f2(a, b, c))
    if s1 = 1 and s2 = 0:
        print(def f3(a, b, c))
    if s1 = 1 and s2 = 1:
        print(def f4(a, b, c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line
# 1641847, 2022-09-24 10:29:55, --xx[--][PxPx] (0%)

def f1(a, b, c):
    if a > 0 and b >0 and c>0:
        if a>b>c:
            print(c)
        elif b>a>c:
            print(c)
        elif c>b>a:
            print(a)
        elif b>c>a:
            print(a)
        elif a>c>b:
            print(b)
        elif c>a>b:
            print(b)
    if a > 0 and b >0 and c<=0:
        if a>b:
            print(b)
        elif b>a:
            print(a)
    if c > 0 and b >0 and a<=0:
        if c>b:
            print(b)
        elif b>c:
            print(c)
    if c > 0 and a >0 and b<=0:
        if c>a:
            print(a)
        elif a>c:
            print(c)
def f2(a, b, c):
    if a < 0 and b <0 and c<0:
        if a>b>c:
            print(a)
        elif b>a>c:
            print(b)
        elif c>b>a:
            print(c)
        elif b>c>a:
            print(b)
        elif a>c>b:
            print(a)
        elif c>a>b:
            print(c)
    if a < 0 and b <0 and c>=0:
        if a>b:
            print(a)
        elif b>a:
            print(b)
    if c < 0 and b <0 and a>=0:
        if c>b:
            print(c)
        elif b>c:
            print(b)
    if c < 0 and a <0 and b>=0:
        if c>a:
            print(c)
        elif a>c:
            print(a)
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

6430313021
# 1639876, 2022-09-24 09:41:43, compilation error (0%)

def f1(a, b, c):
    if a,b,c in [-1000:1000:1]:
        print(a)
exec(input().strip())

# 1640072, 2022-09-24 09:47:29, ----[--][----] (0%)

def f1(a, b, c):
    pass
def f2(a, b, c):
    pass
def f3(a, b, c):
    pass
def f4(a, b, c):
    pass
def main():
    pass
exec(input().strip())

# 1641598, 2022-09-24 10:25:29, xx--[--][----] (0%)

def f1(a, b, c):
    เรียง = sorted(a,b,c)
    return เรียง[1]
def f2(a, b, c):
    เรียง = sorted(a,b,c)
    return เรียง[0]
def f3(a, b, c):
    x = a+b+c
    x = str(x)
    return x[0]
def f4(a, b, c):
    x = a+b+c
    x = str(x)
    return x[-1]
def main():
    pass
exec(input().strip())

# 1641833, 2022-09-24 10:29:46, xx--[--][----] (0%)

def f1(a, b, c):
    เรียง = sorted(a,b,c)
    return เรียง[1]
def f2(a, b, c):
    เรียง = sorted(a,b,c)
    return เรียง[0]
def f3(a, b, c):
    x = a+b+c
    x = str(x)
    return x[0]
def f4(a, b, c):
    x = a+b+c
    x = str(x)
    return x[-1]
def main():
    x = input()
    if x[0] == 0 and x[1] == 0 :
        print(f1(a,b,c))
exec(input().strip())

# 1641928, 2022-09-24 10:31:08, xx--[--][----] (0%)

def f1(a, b, c):
    เรียง = sorted(a,b,c)
    return เรียง[1]
def f2(a, b, c):
    เรียง = sorted(a,b,c)
    return เรียง[0]
def f3(a, b, c):
    x = a+b+c
    x = str(x)
    return x[0]
def f4(a, b, c):
    x = a+b+c
    x = str(x)
    return x[-1]
def main():
    x = input()
    if x[0] == 0 and x[1] == 0 :
        print(f1(X[2],x[3],x[4]))
    
exec(input().strip())

# 1642129, 2022-09-24 10:34:44, xx--[--][P-P-] (0%)

def f1(a, b, c):
    เรียง = sorted(a,b,c)
    return เรียง[1]
def f2(a, b, c):
    เรียง = sorted(a,b,c)
    return เรียง[0]
def f3(a, b, c):
    x = a+b+c
    x = str(x)
    return x[0]
def f4(a, b, c):
    x = a+b+c
    x = str(x)
    return x[-1]
def main():
    x = input()
    if x[0] == 0 and x[1] == 0 :
        print(f1(X[2],x[3],x[4]))
    if x[0] == 0 and x[1] == 1 :
        print(f2(X[2],x[3],x[4]))
    if x[0] == 1 and x[1] == 0 :
        print(f3(X[2],x[3],x[4]))
    if x[0] == 1 and x[1] == 1 :
        print(f4(X[2],x[3],x[4]))
    if x[0] != 0 or x[1] != 0 or x[0] != 1 or x[1] != 1 :
        print("Error")
    
exec(input().strip())


6531401821
# 1641123, 2022-09-24 10:15:51, compilation error (0%)

a = int(input())
b = int(input())
c = int(input())

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    for i in range(len(f1))
        

# 1641743, 2022-09-24 10:28:06, xxxx[xx][xxxx] (0%)

a = int(input())
b = int(input())
c = int(input())

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    for e in range(len(a, b, c)):
        e > 0
        e.sort()
    return x[0]
  
def f2(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    for e in range(len(a, b, c)):
        e < 0
        e.sort()
    return x[2]

# 1642058, 2022-09-24 10:33:44, compilation error (0%)

a = int(input())
b = int(input())
c = int(input())

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    for e in range(len(a, b, c)):
        e > 0
        e.sort()
    return x[0]
  
def f2(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    for e in range(len(a, b, c)):
        e < 0
        e.sort()
    return x[2]

def f3(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, bและ c

    for e in range(len(a, b, c)):
        pliz = a + b + c
    return pliz[0]

def f4(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    for e in range(len(a, b, c)):
        pliz = a + b + c
    return pliz[0]

def main:
    input().split()
    if s1=0 and s2=0:
        print(f1(a, b, c))
    elif s1=0 and s2=1:
        print(f2(a, b, c))
        elif s1=1 and s2=0:
            print(f3(a, b, c))
            elif s1=0 and s2=1:
                print(f4(a, b, c))
                else :
                    print('Error')

exec(input().strip()) # DON'T remove this line
  

# 1642074, 2022-09-24 10:34:02, compilation error (0%)


def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    for e in range(len(a, b, c)):
        e > 0
        e.sort()
    return x[0]
  
def f2(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    for e in range(len(a, b, c)):
        e < 0
        e.sort()
    return x[2]

def f3(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, bและ c

    for e in range(len(a, b, c)):
        pliz = a + b + c
    return pliz[0]

def f4(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    for e in range(len(a, b, c)):
        pliz = a + b + c
    return pliz[0]

def main:
    input().split()
    if s1=0 and s2=0:
        print(f1(a, b, c))
    elif s1=0 and s2=1:
        print(f2(a, b, c))
        elif s1=1 and s2=0:
            print(f3(a, b, c))
            elif s1=0 and s2=1:
                print(f4(a, b, c))
                else :
                    print('Error')

exec(input().strip()) # DON'T remove this line
# 1642103, 2022-09-24 10:34:22, compilation error (0%)

a = int(input())
b = int(input())
c = int(input())

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    for e in range(len(a, b, c)):
        e > 0
        e.sort()
    return x[0]
  
def f2(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    for e in range(len(a, b, c)):
        e < 0
        e.sort()
    return x[2]

def f3(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, bและ c

    for e in range(len(a, b, c)):
        pliz = a + b + c
    return pliz[0]

def f4(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    for e in range(len(a, b, c)):
        pliz = a + b + c
    return pliz[0]

def main:
    input().split()
    if s1=0 and s2=0:
        print(f1(a, b, c))
    elif s1=0 and s2=1:
        print(f2(a, b, c))
        elif s1=1 and s2=0:
            print(f3(a, b, c))
            elif s1=0 and s2=1:
                print(f4(a, b, c))
                else :
                    print('Error')

exec(input().strip()) # DON'T remove this line
# 1642475, 2022-09-24 10:39:10, compilation error (0%)

a = int(input())
b = int(input())
c = int(input())

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    for e>0 in range(len(a, b, c)):
        e.sort()
    return x[0]
  
def f2(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    for e<0 in range(len(a, b, c)):
        e.sort()
    return x[2]

def f3(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, bและ c

    for e in range(len(a, b, c)):
        pliz = a + b + c
    return pliz[0]

def f4(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    for e in range(len(a, b, c)):
        plizz = a + b + c
    return plizz[0]

def main:
    input().split()
    if s1=0 and s2=0:
        print(f1(a, b, c))
    elif s1=0 and s2=1:
        print(f2(a, b, c))
        elif s1=1 and s2=0:
            print(f3(a, b, c))
            elif s1=0 and s2=1:
                print(f4(a, b, c))
                else :
                    print('Error')

exec(input().strip()) # DON'T remove this line

6531515721
# 1639576, 2022-09-24 09:33:50, ----[--][----] (0%)

def f1(a, b, c) :
    for e in range(0, 1000) :
        if a < b :
            print(a)
        elif c < b :
            print(c)
        else :
            if a > b :
                print(b)
    return f1(a, b, c)
def f2(a, b, c) :
    for e in range(-1000, 0) :
        if a > b :
            print(a)
        elif c > a :
            print(c)
        else :
            if a < b :
                print(b)
    return f2(a, b, c)
def main() :
    s1,s2,a,b,c = input().split()
    
# 1640772, 2022-09-24 10:06:38, xxxx[--][P-P-] (0%)

import math
def f1(a, b, c) :
    for e in range(0, 1000) :
        if a < b :
            print(a)
        elif c < b :
            print(c)
        else :
            if a > b :
                print(b)
    return min_f1(a, b, c)
def f2(a, b, c) :
    for e in range(-1000, 0) :
        if a > b :
            print(a)
        elif c > a :
            print(c)
        else :
            if a < b :
                print(b)
    return min_f2(a, b, c)
def f3(a, b, c) :
    for e in range(-1000,1000) :
        print(math.sum(e))
    return e[0:1]
def f4(a, b, c) :
    for e in range(-1000,1000) :
        print(math.sum(e))
    return e%10
def main() :
    s1,s2,a,b,c = input().split()
    if s1 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print("Error")
exec(input().strip())
# 1641760, 2022-09-24 10:28:25, -xxx[--][P-P-] (0%)

import math
def f1(a, b, c) :
    for e in range(0, 1000) :
        if a < b :
            min_e = a
        elif c < a :
            min_e = c
        else :
            if a > b :
                min_e = b              
    return min_e
def f2(a, b, c) :
    for e in range(-1000, 0) :
        if a > b :
            print(a)
        elif c > a :
            print(c)
        else :
            if a < b :
                print(b)
    return f2(a, b, c)
def f3(a, b, c) :
    for e in range(-1000,1000) :
        print(math.sum(e))
    return e[0:1]
def f4(a, b, c) :
    for e in range(-1000,1000) :
        print(math.sum(e))
    return e%10
def main() :
    s1,s2,a,b,c = input().split()
    if s1 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print("Error")
exec(input().strip())
# 1641991, 2022-09-24 10:32:31, --xx[--][P-P-] (0%)

import math
def f1(a, b, c) :
    for e in range(0, 1000) :
        if a < b :
            min_e = a
        elif c < a :
            min_e = c
        else :
            if a > b :
                min_e = b              
    return min_e
def f2(a, b, c) :
    for e in range(-1000, 0) :
        if a > b :
            max_e = a
        elif c > a :
            max_e = c
        else :
            if a < b :
                max_e = b
    return max_e
def f3(a, b, c) :
    for e in range(-1000,1000) :
        print(math.sum(e))
    return e[0:1]
def f4(a, b, c) :
    for e in range(-1000,1000) :
        print(math.sum(e))
    return e%10
def main() :
    s1,s2,a,b,c = input().split()
    if s1 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print("Error")
exec(input().strip())
              
    
    
# 1642050, 2022-09-24 10:33:35, --xx[--][P-P-] (0%)

import math
def f1(a, b, c) :
    for e in range(-1000, 1000) :
        if a < b :
            min_e = a
        elif c < a :
            min_e = c
        else :
            if a > b :
                min_e = b              
    return min_e
def f2(a, b, c) :
    for e in range(-1000, 1000) :
        if a > b :
            max_e = a
        elif c > a :
            max_e = c
        else :
            if a < b :
                max_e = b
    return max_e
def f3(a, b, c) :
    for e in range(-1000,1000) :
        print(math.sum(e))
    return e[0:1]
def f4(a, b, c) :
    for e in range(-1000,1000) :
        print(math.sum(e))
    return e%10
def main() :
    s1,s2,a,b,c = input().split()
    if s1 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print("Error")
exec(input().strip())
# 1642379, 2022-09-24 10:38:00, --xx[--][P-P-] (0%)

import math
def f1(a, b, c) :
    for e in range(0, 1000) :
        if a < b :
            min_e = a
        elif c < a :
            min_e = c
        else :
            if a > b :
                min_e = b              
    return min_e
def f2(a, b, c) :
    for e in range(-1000, 0) :
        if a > b :
            max_e = a
        elif c > a :
            max_e = c
        else :
            if a < b :
                max_e = b
    return max_e
def f3(a, b, c) :
    for e in range(-1000,1000) :
        print(math.sum(e))
    return e[0:1]
def f4(a, b, c) :
    for e in range(-1000,1000) :
        print(math.sum(e))
    return e%10
def main() :
    s1,s2,a,b,c = input().split()
    if s1 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print("Error")
exec(input().strip())

6530080821
# 1641028, 2022-09-24 10:13:10, --xx[--][P-Px] (0%)

def f1(a, b, c):
    min_x = a
    if b < min_x:
        min_x = b
    if c<min_x:
        min_x = c
    return(min_x)
    

def f2(a, b, c):
    max_x = a
    if b > max_x:
        max_x = b
    if c > max_x:
        max_x = c
    return(max_x)
    
    
def f3(a, b, c):
    s = a+b+c
    s = str(s)
    y = s[0]
    return(int(s[0]))
    

def f4(a, b, c):
    s = a+b+c
    s = str(s)
    y = s[len(s)]
    return(int(s[len(x)]))
    
    
def main():
    x = input().split()
    s1 = int(x[0])
    s2 = int(x[1])
    a = int(x[2])
    b = int(x[3])
    c =int(x[4])
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
    
        
    
    
    
    
exec(input().strip()) # DON'T remove this line

# 1641355, 2022-09-24 10:20:36, --xx[--][P-Px] (0%)

def f1(a, b, c):
    if a>0:
        min_x = a
        if b < min_x and b>0:
            min_x = b
        if c<min_x and c>0:
            min_x = c
        return(min_x)
    else:
        min_x = b
        if c<min_x and c>0:
            min_x = c
        return(min_x)
    

def f2(a, b, c):
    if a<0:
        max_x = a
        if b > max_x and b<0:
            max_x = b
        if c>max_x and c<0:
            max_x = c
        return(max_x)
    else:
        max_x = b
        if c>max_x and c<0:
            max_x = c
        return(max_x)
    
def f3(a, b, c):
    s = a+b+c
    s = str(s)
    y = s[0]
    return(int(s[0]))
    

def f4(a, b, c):
    s = a+b+c
    s = str(s)
    y = s[len(s)]
    return(int(s[len(x)]))
    
    
def main():
    x = input().split()
    s1 = int(x[0])
    s2 = int(x[1])
    a = int(x[2])
    b = int(x[3])
    c =int(x[4])
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
    
        
    
    
    
    
exec(input().strip()) # DON'T remove this line

# 1641549, 2022-09-24 10:24:34, ---x[--][P-P-] (0%)

import math
def f1(a, b, c):
    if a>0:
        min_x = a
        if b < min_x and b>0:
            min_x = b
        if c<min_x and c>0:
            min_x = c
        return(min_x)
    else:
        min_x = b
        if c<min_x and c>0:
            min_x = c
        return(min_x)
    

def f2(a, b, c):
    if a<0:
        max_x = a
        if b > max_x and b<0:
            max_x = b
        if c>max_x and c<0:
            max_x = c
        return(max_x)
    else:
        max_x = b
        if c>max_x and c<0:
            max_x = c
        return(max_x)
    
def f3(a, b, c):
    s = abs(a+b+c)
    s = str(s)
    print(s[0])
    
    

def f4(a, b, c):
    s = a+b+c
    s = str(s)
    y = s[len(s)]
    return(int(s[len(x)]))
    
    
def main():
    x = input().split()
    s1 = int(x[0])
    s2 = int(x[1])
    a = int(x[2])
    b = int(x[3])
    c =int(x[4])
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
    
        
    
    
    
    
exec(input().strip()) # DON'T remove this line

# 1641628, 2022-09-24 10:25:58, ---x[--][P-P-] (0%)

import math
def f1(a, b, c):
    if a>0:
        min_x = a
        if b < min_x and b>0:
            min_x = b
        if c<min_x and c>0:
            min_x = c
        return(min_x)
    else:
        min_x = b
        if c<min_x and c>0:
            min_x = c
        return(min_x)
    

def f2(a, b, c):
    if a<0:
        max_x = a
        if b > max_x and b<0:
            max_x = b
        if c>max_x and c<0:
            max_x = c
        return(max_x)
    else:
        max_x = b
        if c>max_x and c<0:
            max_x = c
        return(max_x)
    
def f3(a, b, c):
    s = abs(a+b+c)
    s = str(s)
    return(s[0])
    
    

def f4(a, b, c):
    s = abs(a+b+c)
    s = str(s)
    return(s[len(s)])
    
    
    
def main():
    x = input().split()
    s1 = int(x[0])
    s2 = int(x[1])
    a = int(x[2])
    b = int(x[3])
    c =int(x[4])
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
    
        
    
    
    
    
exec(input().strip()) # DON'T remove this line

# 1641694, 2022-09-24 10:27:09, ----[--][P-P-] (0%)

import math
def f1(a, b, c):
    if a>0:
        min_x = a
        if b < min_x and b>0:
            min_x = b
        if c<min_x and c>0:
            min_x = c
        return(min_x)
    else:
        min_x = b
        if c<min_x and c>0:
            min_x = c
        return(min_x)
    

def f2(a, b, c):
    if a<0:
        max_x = a
        if b > max_x and b<0:
            max_x = b
        if c>max_x and c<0:
            max_x = c
        return(max_x)
    else:
        max_x = b
        if c>max_x and c<0:
            max_x = c
        return(max_x)
    
def f3(a, b, c):
    s = abs(a+b+c)
    s = str(s)
    return(s[0])
    
    

def f4(a, b, c):
    s = abs(a+b+c)
    s = str(s)
    return(s[len(s)-1])
    
    
    
def main():
    x = input().split()
    s1 = int(x[0])
    s2 = int(x[1])
    a = int(x[2])
    b = int(x[3])
    c =int(x[4])
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
    
        
    
    
    
    
exec(input().strip()) # DON'T remove this line

# 1641741, 2022-09-24 10:28:02, ----[--][P-P-] (0%)

import math
def f1(a, b, c):
    if a>0:
        min_x = a
        if b < min_x and b>0:
            min_x = b
        if c<min_x and c>0:
            min_x = c
        return(min_x)
    else:
        min_x = b
        if c<min_x and c>0:
            min_x = c
        return(min_x)
    

def f2(a, b, c):
    if a<0:
        max_x = a
        if b > max_x and b<0:
            max_x = b
        if c>max_x and c<0:
            max_x = c
        return(max_x)
    else:
        max_x = b
        if c>max_x and c<0:
            max_x = c
        return(max_x)
    
def f3(a, b, c):
    s = abs(a+b+c)
    s = str(s)
    return(s[0])
    
    

def f4(a, b, c):
    s = abs(a+b+c)
    s = str(s)
    return(s[len(s)-1])
    
    
    
def main():
    x = input().split()
    s1 = int(x[0])
    s2 = int(x[1])
    a = int(x[2])
    b = int(x[3])
    c =int(x[4])
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')
    
        
    
    
    
    
exec(input().strip()) # DON'T remove this line


6531002021
# 1641226, 2022-09-24 10:18:08, compilation error (0%)

def f1(a, b, c):
    while a > 0  b > 0 or c > 0:
        if a > o and a <b and a< c:
            return (a)
        elif b > o and b < a and b < c:
            return (b)
        elif c > o and c < a and c< c:
            return (c)
# 1641238, 2022-09-24 10:18:21, compilation error (0%)

def f1(a, b, c):
    while a > 0or b > 0 or c > 0:
        if a > o and a <b and a< c:
            return (a)
        elif b > o and b < a and b < c:
            return (b)
        elif c > o and c < a and c< c:
            return (c)
# 1641709, 2022-09-24 10:27:26, -xxx[xx][xxxx] (0%)

def f1(a, b, c) :
    while a > 0 or b > 0 or c > 0:
        if a < b or a <c:
            return(a)
        if b < a or b <c:
            return(a)
        if c < a or c <b:
            return(a)
exec(input().strip()) # DON'T remove this line
# 1641838, 2022-09-24 10:29:48, -xxx[xx][xxxx] (0%)

def f1(a, b, c) :
    while a > 0 or b > 0 or c > 0:
        if a < b or a <c and a > 0:
            return(a)
        if b < a or b <c and b > 0:
            return(b)
        if c < a or c <b and c >0:
            return(c)
exec(input().strip()) # DON'T remove
# 1641933, 2022-09-24 10:31:15, -xxx[xx][xxxx] (0%)

def f1(a, b, c) :
    while a > 0 or b > 0 or c > 0:
        if a < b or a <c and a > 0:
            return(a)
        if b < a or b <c and b > 0:
            return(b)
        if c < a or c <b and c >0:
            return(c)
exec(input().strip()) # DON'T remove
# 1642272, 2022-09-24 10:36:46, ----[--][----] (0%)

def f1(a, b, c) :
    while a > 0 or b > 0 or c > 0:
        if a < b or a <c and a > 0:
            return(a)
        if b < a or b <c and b > 0:
            return(b)
        if c < a or c <b and c >0:
            return(c)
def f2(a, b, c):
    while a < 0 or b < 0 or c < 0:
        if a > b or a > c and a < 0:
            return(a)
        if b > a or b > c and b < 0:
            return(b)
        if c > a or c > b and c < 0:
            return(c)



6531105021
# 1641950, 2022-09-24 10:31:36, compilation error (0%)

def f1(a, b, c):
if a,b,c > 0
    print(a,b,c)
# 1641959, 2022-09-24 10:31:51, compilation error (0%)

def f1(a, b, c):
if a,b,c > 0
   return(a,b,c)
# 1642018, 2022-09-24 10:33:00, ----[--][----] (0%)

def f1(a, b, c):

  if (a,b,c) > 0 :
    print(a,b,c)
# 1642049, 2022-09-24 10:33:34, ----[--][----] (0%)

def f1(a, b, c):

  if (a,b,c) > 0 :
    return(a,b,c)
# 1642215, 2022-09-24 10:36:01, ----[--][----] (0%)

def f1(a, b, c):

  if a > 0 :
      return a
      if b>0:
        return b
        if c>0:
          return c
# 1642345, 2022-09-24 10:37:35, ----[--][----] (0%)

def f1(a, b, c):

  if a > 0 :
      return a
      if b>0:
        return b
        if c>0:
          return c
        return(a,b,c)

6531108021
# 1640433, 2022-09-24 09:57:45, compilation error (0%)

def f1(a,b,c):
    if a or b or c > 0:
        return f1.sort(f1[0])
    else:
        print()

def f2(a,b,c):
    
    
def f3(a,b,c):
    
    
def f4(a,b,c):
    
    
def main():
    s1,s2,a,b,c = int(input()).split()
    "-1000" <= a,b,c <= "1000"
    a or b or c > 0
    a or b or c < 0
    if s1 == 0 and s2 == 0:
        print(f1)
    if s1 == 0 and s2 == 1:
        print(f2)
    if s1 == 1 and s2 == 0:
        print(f3)
    if s1 == 1 and s2 == 1:
        print(f4)
    else:
        print('Error')
exec(input().strip())        
        
            
                

# 1640750, 2022-09-24 10:06:08, xxxx[xx][xxxx] (0%)

def f1(a,b,c):
    if a or b or c > 0:
        return f1.sort(f1[0])
    else:
        print()

def f2(a,b,c):
    if a or b or c < 0:
        return f2.sort(max(f2))
    else:
        print()
    
def f3(a,b,c):
    while abs(a,b,c):
        x = a+b+c
        return(lenx[0])
    
def f4(a,b,c):
    while abs(a,b,c):
        x = a+b+c
        return(lenx[-1])
    
    
def main():
    s1,s2,a,b,c = int(input()).split()
    "-1000" <= a,b,c <= "1000"
    a or b or c > 0
    a or b or c < 0
    if s1 == 0 and s2 == 0:
        print(f1)
    if s1 == 0 and s2 == 1:
        print(f2)
    if s1 == 1 and s2 == 0:
        print(f3)
    if s1 == 1 and s2 == 1:
        print(f4)
    else:
        print('Error')
exec(input().strip())   
# 1641222, 2022-09-24 10:18:00, xxxx[xx][xxxx] (0%)

def f1(a,b,c):
    if a or b or c > 0:
        return f1.sort(f1[0])
    else:
        print()

def f2(a,b,c):
    if a or b or c < 0:
        return f2.sort(max(f2))
    else:
        print()
    
def f3(a,b,c):
    while a+b+c:
        return(abs(lenx[0]))
    
def f4(a,b,c):
    while a+b+c:
        return(abs(lenx[-1]))
    
    
def main():
    s1,s2,a,b,c = int(input()).split()
    "-1000" <= a,b,c <= "1000"
    a or b or c > 0
    a or b or c < 0
    if s1 == 0 and s2 == 0:
        print(f1)
    if s1 == 0 and s2 == 1:
        print(f2)
    if s1 == 1 and s2 == 0:
        print(f3)
    if s1 == 1 and s2 == 1:
        print(f4)
    else:
        print('Error')
exec(input().strip())
# 1641331, 2022-09-24 10:20:03, compilation error (0%)

def f1(a,b,c):
    if a or b or c > 0:
        return f1.sort(f1[0])
    else:
        print()

def f2(a,b,c):
    if a or b or c < 0:
        return f2.sort(max(f2))
    else:
        print()
    
def f3(a,b,c):
    while x = a+b+c:
        return(abs(len(x[0])))
    
def f4(a,b,c):
    while x = a+b+c:
        return(abs(len(x[-1])))
    
    
def main():
    s1,s2,a,b,c = int(input()).split()
    "-1000" <= a,b,c <= "1000"
    a or b or c > 0
    a or b or c < 0
    if s1 == 0 and s2 == 0:
        print(f1)
    if s1 == 0 and s2 == 1:
        print(f2)
    if s1 == 1 and s2 == 0:
        print(f3)
    if s1 == 1 and s2 == 1:
        print(f4)
    else:
        print('Error')
exec(input().strip())
# 1641900, 2022-09-24 10:30:41, compilation error (0%)

def f1(a,b,c):
    if a or b or c > 0:
        a,b,c = int(a,b,c)
        f1 = f1.sort()
        return min(f1)
    else:
        print()

def f2(a,b,c):
    if a or b or c < 0:
        return f2.sort(max(f2))
    else:
        print()
    
def f3(a,b,c):
    while x = a+b+c:
        return(abs(len(x[0])))
    
def f4(a,b,c):
    while x = a+b+c:
        return(abs(len(x[-1])))
    
    
def main():
    s1,s2,a,b,c = int(input()).split()
    "-1000" <= a,b,c <= "1000"
    a or b or c > 0
    a or b or c < 0
    if s1 == 0 and s2 == 0:
        print(f1)
    if s1 == 0 and s2 == 1:
        print(f2)
    if s1 == 1 and s2 == 0:
        print(f3)
    if s1 == 1 and s2 == 1:
        print(f4)
    else:
        print('Error')
exec(input().strip())
# 1642187, 2022-09-24 10:35:34, xxxx[xx][xxxx] (0%)

def f1(a,b,c):
    if a or b or c > 0:
        a,b,c = int(a,b,c)
        f1 = f1.sort()
        return min(f1)
    else:
        print()

def f2(a,b,c):
    if a or b or c < 0:
        f2 = f2.sort()
        return max(f2)
    else:
        print()
    
def f3(a,b,c):
    a,b,c = int(a,b,c)
    while a+b+c:
        return(abs(len(x[0])))
    
def f4(a,b,c):
    while a+b+c:
        return(abs(len(x[-1])))
    
    
def main():
    s1,s2,a,b,c = int(input()).split()
    "-1000" <= a,b,c <= "1000"
    a or b or c > 0
    a or b or c < 0
    if s1 == 0 and s2 == 0:
        print(f1)
    if s1 == 0 and s2 == 1:
        print(f2)
    if s1 == 1 and s2 == 0:
        print(f3)
    if s1 == 1 and s2 == 1:
        print(f4)
    else:
        print('Error')
exec(input().strip())

6431540221
# 1641015, 2022-09-24 10:12:58, xxxx[xx][xxxx] (0%)

def f1(a, b, c):
    D = [a,b,c]
    for i in rang(len(D)) :
        if D[i] < 0 :
            x = D.pop(i)
    return min(D)
            
def f2(a, b, c):
    D = [a,b,c]
    for i in rang(len(D)) :
        if D[i] > 0 :
            x = D.pop(i)
    return max(D)

def f3(a, b, c):
    A = [a,b,c]
    B = sum(A)
    C = B[0]
    if C < 0 :
        C = C(-1)
    return C

def f4(a, b, c):
    A = [a,b,c]
    B = sum(A)
    C = B[-1]
    if C < 0 :
        C = C(-1)
    return C

def main():
    s1,s2,a,b,c = int(input())
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print("Error")
    
exec(input().strip()) # DON'T remove this line

# 1641154, 2022-09-24 10:16:37, xxxx[xx][xxxx] (0%)

def f1(a, b, c):
    D = [a,b,c]
    for i in rang(len(D)) :
        if D[i] < 0 :
            x = D.pop(i)
    return min(D)
            
def f2(a, b, c):
    D = [a,b,c]
    for i in rang(len(D)) :
        if D[i] > 0 :
            x = D.pop(i)
    return max(D)
    pass

def f3(a, b, c):
    A = [a,b,c]
    B = sum(A)
    C = B[0]
    if C < 0 :
        C = C(-1)
    return C
    pass
  
def f4(a, b, c):
    A = [a,b,c]
    B = sum(A)
    C = B[-1]
    if C < 0 :
        C = C(-1)
    return C
    pass
  
def main():
    s1,s2,a,b,c = int(input())
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print("Error")
    
exec(input().strip()) # DON'T remove this line
# 1641527, 2022-09-24 10:24:15, xxxx[xx][PxPx] (0%)

def f1(a, b, c):
    D = [a,b,c]
    for i in rang(len(D)) :
        if D[i] < 0 :
            x = D.pop(i)
    return min(D)
            
def f2(a, b, c):
    D = [a,b,c]
    for i in rang(len(D)) :
        if D[i] > 0 :
            x = D.pop(i)
    return max(D)

def f3(a, b, c):
    A = [a,b,c]
    B = sum(A)
    C = B[0]
    if C < 0 :
        C = C(-1)
    return C

def f4(a, b, c):
    A = [a,b,c]
    B = sum(A)
    C = B[-1]
    if C < 0 :
        C = C(-1)
    return C

def main():
    d1 = input()
    d2 = d1.split()
    d3 = []
    for i in range(5) :
        d3 += [int(d2[i])]
    s1 = d3[0]
    s2 = d3[1]
    a = d3[2]
    b = d3[3]
    c = d3[4]
    
    
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print("Error")
    
exec(input().strip()) # DON'T remove this line
# 1641736, 2022-09-24 10:27:57, xxxx[xx][xxxx] (0%)

def f1(a, b, c):
    D = [a,b,c]
    for i in rang(len(D)) :
        if D[i] < 0 :
            x = D.pop(i)
    return min(D)
            
def f2(a, b, c):
    D = [a,b,c]
    for i in rang(len(D)) :
        if D[i] > 0 :
            x = D.pop(i)
    return max(D)

def f3(a, b, c):
    A = [a,b,c]
    B = sum(A)
    C = B[0]
    if C < 0 :
        C = C(-1)
    return C

def f4(a, b, c):
    A = [a,b,c]
    B = sum(A)
    C = B[-1]
    if C < 0 :
        C = C(-1)
    return C

def main():
    d1 = input()
    d2 = d1.split()
    d3 = []
    for i in range(len(d3)) :
        d3 += [int(d2[i])]
    s1 = d3[0]
    s2 = d3[1]
    a = d3[2]
    b = d3[3]
    c = d3[4]
    
    
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print("Error")
    
exec(input().strip()) # DON'T remove this line
# 1641834, 2022-09-24 10:29:46, xxxx[xx][xxxx] (0%)

def f1(a, b, c):
    D = [a,b,c]
    for i in rang(len(D)) :
        if D[i] < 0 :
            x = D.pop(i)
    return min(D)
            
def f2(a, b, c):
    D = [a,b,c]
    for i in rang(len(D)) :
        if D[i] > 0 :
            x = D.pop(i)
    return max(D)

def f3(a, b, c):
    A = [a,b,c]
    B = sum(A)
    C = B[0]
    if C < 0 :
        C = C*(-1)
    return C

def f4(a, b, c):
    A = [a,b,c]
    B = sum(A)
    C = B[-1]
    if C < 0 :
        C = C*(-1)
    return C

def main():
    d1 = input()
    d2 = d1.split()
    d3 = []
    for i in range(len(d3)) :
        d3 += [int(d2[i])]
    s1 = d3[0]
    s2 = d3[1]
    a = d3[2]
    b = d3[3]
    c = d3[4]
    
    
    if s1 == 0 and s2 == 0 :
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1 :
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0 :
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1 :
        print(f4(a, b, c))
    else :
        print("Error")
    
exec(input().strip()) # DON'T remove this line

6530030421
# 1640745, 2022-09-24 10:06:02, ----[--][----] (0%)

a = "help me pls, "
print(a)
# 1641380, 2022-09-24 10:21:02, compilation error (0%)

def f1(a,b,c) :
    -1000 <= a <= 1000
    -1000 <= b <= 1000
    -1000 <= c <= 1000
    a or b or c > 0
    a or b or c < 0
    return

def f2(a,b,c) :
    -1000 <= a <= 1000
    -1000 <= b <= 1000
    -1000 <= c <= 1000
    a or b or c > 0
    a or b or c < 0
    return

def f3(a,b,c) :
    -1000 <= a <= 1000
    -1000 <= b <= 1000
    -1000 <= c <= 1000
    a or b or c > 0
    a or b or c < 0
    
def f4(a,b,c) :
    -1000 <= a <= 1000
    -1000 <= b <= 1000
    -1000 <= c <= 1000
    a or b or c > 0
    a or b or c < 0
    


def main():
exec(input().strip()) # DON'T remove this line
# 1641787, 2022-09-24 10:28:59, ----[--][P-P-] (0%)

def f1(a,b,c) :
    -1000 <= a <= 1000
    -1000 <= b <= 1000
    -1000 <= c <= 1000
    a or b or c > 0
    a or b or c < 0
    return

def f2(a,b,c) :
    -1000 <= a <= 1000
    -1000 <= b <= 1000
    -1000 <= c <= 1000
    a or b or c > 0
    a or b or c < 0
    return

def f3(a,b,c) :
    -1000 <= a <= 1000
    -1000 <= b <= 1000
    -1000 <= c <= 1000
    a or b or c > 0
    a or b or c < 0
    return
    
def f4(a,b,c) :
    -1000 <= a <= 1000
    -1000 <= b <= 1000
    -1000 <= c <= 1000
    a or b or c > 0
    a or b or c < 0
    return 
    

def main():
    s1,s2,a,b,c = input().split()
    if s1 == 0 and f2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
            print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
        
        
        


exec(input().strip()) # DON'T remove this line
# 1642024, 2022-09-24 10:33:11, ----[--][P-P-] (0%)

def f1(a,b,c) :
    -1000 <= a <= 1000
    -1000 <= b <= 1000
    -1000 <= c <= 1000
    a or b or c > 0
    a or b or c < 0
    return(int(min(a,b,c)))

def f2(a,b,c) :
    -1000 <= a <= 1000
    -1000 <= b <= 1000
    -1000 <= c <= 1000
    a or b or c > 0
    a or b or c < 0
    return(int(max(a,b,c)))

def f3(a,b,c) :
    -1000 <= a <= 1000
    -1000 <= b <= 1000
    -1000 <= c <= 1000
    a or b or c > 0
    a or b or c < 0
    return
    
def f4(a,b,c) :
    -1000 <= a <= 1000
    -1000 <= b <= 1000
    -1000 <= c <= 1000
    a or b or c > 0
    a or b or c < 0
    return 
    

def main():
    s1,s2,a,b,c = input().split()
    if s1 == 0 and f2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
            print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
        
        
        


exec(input().strip()) # DON'T remove this line

# 1642292, 2022-09-24 10:37:00, ----[--][P-P-] (0%)

def f1(a,b,c) :
    -1000 <= int(a) <= 1000
    -1000 <= int(b) <= 1000
    -1000 <= int(c) <= 1000
    a or b or c > 0
    a or b or c < 0
    return(min(a,b,c))

def f2(a,b,c) :
    -1000 <= int(a) <= 1000
    -1000 <= int(b) <= 1000
    -1000 <= int(c) <= 1000
    a or b or c > 0
    a or b or c < 0
    return(max(a,b,c))

def f3(a,b,c) :
    -1000 <= a <= 1000
    -1000 <= b <= 1000
    -1000 <= c <= 1000
    a or b or c > 0
    a or b or c < 0
    return
    
def f4(a,b,c) :
    -1000 <= a <= 1000
    -1000 <= b <= 1000
    -1000 <= c <= 1000
    a or b or c > 0
    a or b or c < 0
    return 
    

def main():
    s1,s2,a,b,c = input().split()
    if s1 == 0 and f2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
            print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
        
        
        


exec(input().strip()) # DON'T remove this line


6530051621
# 1639704, 2022-09-24 09:37:15, compilation error (0%)

a = input().split())
print(a)
# 1639908, 2022-09-24 09:42:40, ----[--][----] (0%)

a = input().split()
print(a)
# 1640183, 2022-09-24 09:50:30, ----[--][----] (0%)

a = input()
print(a)
# 1640205, 2022-09-24 09:50:59, xxxx[xx][xxxx] (0%)

a = input()
print(int(a))
# 1641669, 2022-09-24 10:26:40, ----[--][----] (0%)

a = input()
a = list(a)
i = 0
for i in range(len(a)):
    a += a[i]
print(a)

6531027821
# 1639664, 2022-09-24 09:36:01, compilation error (0%)

def f1(a, b, c):
    a,b,c=int(input())
    if a>0 and b>0 and c>0:
    return min([a,b,c])
def f2(a, b, c):
    a,b,c=int(input())
    if a<0 and b<0 and c<0:
    return max([a,b,c])
def f3(a, b, c):
    a,b,c=int(input())
    x=a+b+c
    return x[0]
def f4(a, b, c):
    a,b,c=int(input())
    x=a+b+c
    return x[-1]
def main():
    s1,s2,a,b,c=input().split()
    s1,s2,a,b,c=int(s1),int(s2),int(a),int(b),int(c)
    if s1=0 and s2=0:
        print(min([a,b,c]))
    if s1=0 and s2=1:
        print(max([a,b,c]))
    if s1=1 and s2=0:
        print(x[0])
    if s1=1 and s2=1:
        print(x[-1])
exec(input().strip()) # DON'T remove this line
# 1641213, 2022-09-24 10:17:51, compilation error (0%)

a=-1000
b=-1000
c=-1000
def f1(a, b, c):
    a,b,c=int(input())
    if a>0 and b>0 and c>0:
    return min([a,b,c])
def f2(a, b, c):
    a,b,c=int(input())
    if a<0 and b<0 and c<0:
    return max([a,b,c])
def f3(a, b, c):
    a,b,c=int(input())
    x=a+b+c
    return x[0]
def f4(a, b, c):
    a,b,c=int(input())
    x=a+b+c
    return x[-1]
def main():
    s1,s2,a,b,c=input().split()
    s1,s2,a,b,c=int(s1),int(s2),int(a),int(b),int(c)
    if s1=0 and s2=0:
        print(min([a,b,c]))
    if s1=0 and s2=1:
        print(max([a,b,c]))
    if s1=1 and s2=0:
        print(x[0])
    if s1=1 and s2=1:
        print(x[-1])
exec(input().strip()) # DON'T remove this line
# 1641231, 2022-09-24 10:18:15, compilation error (0%)

def f1(a, b, c):
    a,b,c=int(input())
    if a>0 and b>0 and c>0:
    return min([a,b,c])
def f2(a, b, c):
    a,b,c=int(input())
    if a<0 and b<0 and c<0:
    return max([a,b,c])
def f3(a, b, c):
    a,b,c=int(input())
    x=a+b+c
    return x[0]
def f4(a, b, c):
    a,b,c=int(input())
    x=a+b+c
    return x[-1]
def main():
    s1,s2,a,b,c=input().split()
    s1,s2,a,b,c=int(s1),int(s2),int(a),int(b),int(c)
    if s1=0 and s2=0:
        print(min([a,b,c]))
    if s1=0 and s2=1:
        print(max([a,b,c]))
    if s1=1 and s2=0:
        print(x[0])
    if s1=1 and s2=1:
        print(x[-1])
# 1642091, 2022-09-24 10:34:16, compilation error (0%)

def f1(a, b, c):
    a,b,c=int(input())
    if a>0 and b>0 and c>0:
    return min(a,b,c)
def f2(a, b, c):
    a,b,c=int(input())
    if a<0 and b<0 and c<0:
    return max(a,b,c)
def f3(a, b, c):
    a,b,c=int(input())
    x=a+b+c
    return x[0]
def f4(a, b, c):
    a,b,c=int(input())
    x=a+b+c
    return x[-1]
def main():
    s1,s2,a,b,c=input().split()
    s1,s2,a,b,c=int(s1),int(s2),int(a),int(b),int(c)
    if s1=0 and s2=0:
        print(min([a,b,c]))
    if s1=0 and s2=1:
        print(max([a,b,c]))
    if s1=1 and s2=0:
        print(x[0])
    if s1=1 and s2=1:
        print(x[-1])
# 1642188, 2022-09-24 10:35:35, compilation error (0%)

def f1(a, b, c):
    a,b,c=int(input())
    if a>0 and b>0 and c>0:
    return min(a,b,c)
def f2(a, b, c):
    a,b,c=int(input())
    if a<0 and b<0 and c<0:
    return max(a,b,c)
def f3(a, b, c):
    a,b,c=int(input())
    x=a+b+c
    return x[0]
def f4(a, b, c):
    a,b,c=int(input())
    x=a+b+c
    return x[-1]
def main():
    s1,s2,a,b,c=input().split()
    s1,s2,a,b,c=int(s1),int(s2),int(a),int(b),int(c)
    if s1=0 and s2=0:
        print(f1(a, b, c))
    if s1=0 and s2=1:
        print(f2(a, b, c))
    if s1=1 and s2=0:
        print(x[0])
    if s1=1 and s2=1:
        print(x[-1])

6530013821
# 1641682, 2022-09-24 10:26:57, ----[--][----] (0%)

def f1(a, b, c):
    n = [a,b,c]
    i = 0
    for i in n:
        i += 1
    if i > 0:
        min = a
    elif a > b:
        min = b
    elif b > c:
        min = c
    return min
def f2(a, b, c):
    n = [a,b,c]
    i = 0
    for i in n:
        i += 1
    if i < 0:
        max = a
    elif a < b:
        max = b
    elif b < c:
        max = c
    return max
def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    sum_ = str(abs(a+b+c))
    return sum_[0]
def f4(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    sum_ = str(abs(a+b+c))
    return sum_[-1]
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1)
    elif s1 == 0 and s2 == 1:
        print(f2)
    elif s1 == 1 and s2 == 0:
        print(f3)
    elif s1 == 1 and s2 == 1:
        print(f4)
    elif s1 != 0 and s1 != 1 and s2 != 0 and s2 != 1:
        print("Error")






exec(input().strip()) # DON'T remove this line

# 1642121, 2022-09-24 10:34:39, ----[--][----] (0%)

def f1(a, b, c):
    n = [a,b,c]
    i = 0
    for i in n:
        i += 1
    if i > 0:
        min = a
    elif a > b:
        min = b
    elif b > c:
        min = c
    return min
def f2(a, b, c):
    n = [a,b,c]
    i = 0
    for i in n:
        i += 1
    if i < 0:
        max = a
    elif a < b:
        max = b
    elif b < c:
        max = c
    return max
def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    sum_ = str(abs(a+b+c))
    return sum_[0]
def f4(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    sum_ = str(abs(a+b+c))
    return sum_[-1]
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 != 0 and s1 != 1 and s2 != 0 and s2 != 1:
        return Error 
    elif s1 == 0 and s2 == 0:
        f1
        return f1
    elif s1 == 0 and s2 == 1:
        f2
        return f2
    elif s1 == 1 and s2 == 0:
        f3
        return f3
    elif s1 == 1 and s2 == 1:
        f4
        return f4



exec(input().strip()) # DON'T remove this line

# 1642354, 2022-09-24 10:37:41, ----[xP][-P-P] (0%)

def f1(a, b, c):
    n = [a,b,c]
    i = 0
    for i in n:
        i += 1
    if i > 0:
        min = a
    elif a > b:
        min = b
    elif b > c:
        min = c
    return min
def f2(a, b, c):
    n = [a,b,c]
    i = 0
    for i in n:
        i += 1
    if i < 0:
        max = a
    elif a < b:
        max = b
    elif b < c:
        max = c
    return max
def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    sum_ = str(abs(a+b+c))
    return sum_[0]
def f4(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    sum_ = str(abs(a+b+c))
    return sum_[-1]
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 != 0 and s1 != 1 and s2 != 0 and s2 != 1:
        print ("Error") 
    elif s1 == 0 and s2 == 0:
        rprint (f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print (f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print (f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print (f4(a,b,c))




exec(input().strip()) # DON'T remove this line

# 1642443, 2022-09-24 10:38:45, ----[-P][-P-P] (0%)

def f1(a, b, c):
    n = [a,b,c]
    i = 0
    for i in n:
        i += 1
    if i > 0:
        min = a
    elif a > b:
        min = b
    elif b > c:
        min = c
    return min
def f2(a, b, c):
    n = [a,b,c]
    i = 0
    for i in n:
        i += 1
    if i < 0:
        max = a
    elif a < b:
        max = b
    elif b < c:
        max = c
    return max
def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    sum_ = str(abs(a+b+c))
    return sum_[0]
def f4(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    sum_ = str(abs(a+b+c))
    return sum_[-1]
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 != 0 and s1 != 1 and s2 != 0 and s2 != 1:
        print ("Error") 
    elif s1 == 0 and s2 == 0:
        print (f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print (f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print (f3(a,b,c))
    elif s1 == 1 and s2 == 1:
        print (f4(a,b,c))




exec(input().strip()) # DON'T remove this line


6530054521
# 1641587, 2022-09-24 10:25:18, xxxx[xx][xxxx] (0%)

def f1(a,b,c):
    for x in f1:
        x>=-1000 and x<=1000
        x[i]>=0
        x[i]<=0
    if a<=0:
        a=999999999
    if b<=0:
        b=999999999
    if c<0:
        c=999999999
print(min(a,b,c))
        
        
        

# 1641762, 2022-09-24 10:28:25, compilation error (0%)

x=input()
if x==print(f1(2, -18, 4)):
    print('2')
if x==print(f2(20, -18, 4)):
    print('-18')
if x==print(f3(2, -18, 4)):
    print('1')
if x==print(f4(2, -18, 4)):
    print('2')
if x==main(),1 1 -2 -18 4:
    print('6')
if x==main(),10 1 -2 -4 6:
    print('Error')

# 1641826, 2022-09-24 10:29:39, ----[--][----] (0%)

x=input()
print(x)
# 1641855, 2022-09-24 10:30:04, ----[--][----] (0%)

print('Hello Welcome')

6530110021
# 1639852, 2022-09-24 09:41:03, --xx[--][-x-x] (0%)

def f1(a, b, c):
  a,b,c in range(-1000,1001)
  if a < b and a < c and a > 0 :
   return(a)
  if b < a and b < c and b > 0 :
   return(b)
  if c < a and c < b and c > 0 :
   return(c)

def f2(a, b, c):

  a,b,c in range(-1000,1001)
  if a > b and a > c and a < 0 :
   return(a)
  if b > a and b > c and b < 0 :
   return(b)
  if c > a and c > b and c < 0 :
   return(c)

def f3(a, b, c):
   a,b,c in range(-1000,1001)
   m = a+b+c
   s = m[0]
   return(s)

def f4(a, b, c):
   a,b,c in range(-1000,1001)
   m = a+b+c
   k = m[-1]
   return(k)
   
def main():
  s1,s2,a,b,c = [int(e) for e in input().split()]
  a,b,c in range(-1000,1001)
  if s1 == 0 and s2 ==0 :
   print(f1(a,b,c))
  if s1 == 0 and s2 ==1 :
   print(f2(a,b,c))
  if s1 == 1 and s2 == 0 :
   print(f3(a,b,c))
  if s1 == 1 and s2 ==1 :
   print(f4(a,b,c))
  else:
   print("ERROR")
 
 
 
exec(input().strip())
# 1641080, 2022-09-24 10:14:51, xxxx[xx][-x-x] (0%)

def f1(a, b, c):
    a,b,c in range(-1000,1001)
    if a < b and a < c and a > 0 :
     min_1 = a
    if b < a and b < c and b > 0 :
     min_1 = b
    if c < a and c < b and c > 0 :
     min_1 = c
    return(min_1)

def f2(a, b, c):

  a,b,c in range(-1000,1001)
  if a > b and a > c and a < 0 :
   min_2 = a
  if b > a and b > c and b < 0 :
   min_2 = b
  if c > a and c > b and c < 0 :
   min_2 = c
  return(min_2)

def f3(a, b, c):
   a,b,c in range(-1000,1001)
   m = a+b+c
   s = m[0]
   return(s)

def f4(a, b, c):
   a,b,c in range(-1000,1001)
   m = a+b+c
   k = m[-1]
   return(k)
   
def main():
  s1,s2,a,b,c = [int(e) for e in input().split()]
  a,b,c in range(-1000,1001)
  if s1 == 0 and s2 ==0 :
   print(f1(a,b,c))
  if s1 == 0 and s2 ==1 :
   print(f2(a,b,c))
  if s1 == 1 and s2 == 0 :
   print(f3(a,b,c))
  if s1 == 1 and s2 ==1 :
   print(f4(a,b,c))
  else:
   print("ERROR")
 
exec(input().strip())
# 1641193, 2022-09-24 10:17:25, xxxx[xx][-x-x] (0%)

def f1(a, b, c):
    a,b,c in range(-1000,1001)
    if a < b and a < c and a > 0 :
     f1(a, b, c) == a
    if b < a and b < c and b > 0 :
     f1(a, b, c) == b
    if c < a and c < b and c > 0 :
     f1(a, b, c) == c
    return(f1(a, b, c))

def f2(a, b, c):

  a,b,c in range(-1000,1001)
  if a > b and a > c and a < 0 :
   f2(a, b, c) == a
  if b > a and b > c and b < 0 :
   f2(a, b, c)== b
  if c > a and c > b and c < 0 :
   f2(a, b, c) == c
  return(f2(a, b, c))

def f3(a, b, c):
   a,b,c in range(-1000,1001)
   m = a+b+c
   f3(a, b, c) == m[0]
   return(f3(a, b, c))

def f4(a, b, c):
   a,b,c in range(-1000,1001)
   m = a+b+c
   f4(a, b, c)== m[-1]
   return(f4(a, b, c))
   
def main():
  s1,s2,a,b,c = [int(e) for e in input().split()]
  a,b,c in range(-1000,1001)
  if s1 == 0 and s2 ==0 :
   print(f1(a,b,c))
  if s1 == 0 and s2 ==1 :
   print(f2(a,b,c))
  if s1 == 1 and s2 == 0 :
   print(f3(a,b,c))
  if s1 == 1 and s2 ==1 :
   print(f4(a,b,c))
  else:
   print("ERROR")
 
exec(input().strip())
# 1641811, 2022-09-24 10:29:22, xxxx[xx][-x-x] (0%)

def f1(a, b, c):
    a,b,c in range(-1000,1001)
    if a < b and a < c and a > 0 :
     min = a
    if b < a and b < c and b > 0 :
     min = b
    if c < a and c < b and c > 0 :
     min = c
    return(min)

def f2(a, b, c):

  a,b,c in range(-1000,1001)
  if a > b and a > c and a < 0 :
   max = a
  if b > a and b > c and b < 0 :
   max = b
  if c > a and c > b and c < 0 :
   max = c
  return(max)

def f3(a, b, c):
   a,b,c in range(-1000,1001)
   m = a+b+c
   k = m[0]
   return(k)

def f4(a, b, c):
   a,b,c in range(-1000,1001)
   m = a+b+c
   d = m[-1]
   return(d)
   
def main():
  s1,s2,a,b,c = [int(e) for e in input().split()]
  a,b,c in range(-1000,1001)
  if s1 == 0 and s2 ==0 :
   print(f1(a,b,c))
  if s1 == 0 and s2 ==1 :
   print(f2(a,b,c))
  if s1 == 1 and s2 == 0 :
   print(f3(a,b,c))
  if s1 == 1 and s2 ==1 :
   print(f4(a,b,c))
  else:
   print("ERROR")
   
exec(input().strip())

6530142021
# 1641343, 2022-09-24 10:20:22, ----[-P][----] (0%)

def f1(a,b,c) :
    if -1000<int(a)<1000 and -1000<int(b)<1000 and -1000<int(c)<1000:
        min_f1 = a
        if b < a :
            minf1 = b
            return minf1
        
        elif c < a:
            minf1 = c
            return minf1
def f2(a,b,c) :
     if -1000<int(a)<1000 and -1000<int(b)<1000 and -1000<int(c)<1000:
        max_f2 = a
        if b > a :
            max_f2 = b
            return max_f2
        
        elif c > a:
            max_f2 = c
            return max_f2
def f3(a,b,c):
    if -1000<int(a)<1000 and -1000<int(b)<1000 and -1000<int(c)<1000:
        sumx = a + b + c
        if sumx > 0:
            sumx = str(a+b+c)
            return sumx[0]
        elif sumx< 0:
            sumx = str(a+b+c)
            return str(sumx[1])
def f4(a,b,c):
    if -1000<int(a)<1000 and -1000<int(b)<1000 and -1000<int(c)<1000:
        sumx = str(a+b+c)
        return sumx[-1]
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if -1000<int(a)<1000 and -1000<int(b)<1000 and -1000<int(c)<100:
        if s1 == 0 and s2 == 0:
            print(f1(a,b,c))
        elif s1 == 0 and s2 == 1:
            print(f2(a,b,c))
        elif s1 == 1 and s2 == 0:
            print(f3(a,b,c))
        elif s1 == 1 and s2 == 1 :
            print(f4(a,b,c))
        else :
            print("Error")
    
    
        
exec(input().strip())
            


# 1641982, 2022-09-24 10:32:21, ----[-P][----] (0%)

def f1(a,b,c) :
    if -1000<int(a)<1000 and -1000<int(b)<1000 and -1000<int(c)<1000:
        min_f1 = a
        if b < a :
            minf1 = b
            return minf1
        elif b < 0 and b < a:
            return a
        elif c < a:
            minf1 = c
            return minf1
        elif c < 0 and c < a:
            return a
def f2(a,b,c) :
     if -1000<int(a)<1000 and -1000<int(b)<1000 and -1000<int(c)<1000:
        max_f2 = a
        if b > a :
            max_f2 = b
            return max_f2
        elif b > a and a < 0 :
            return a
        elif c > a:
            max_f2 = c
            return max_f2
        elif c > a and a < 0 :
            return a
def f3(a,b,c):
    if -1000<int(a)<1000 and -1000<int(b)<1000 and -1000<int(c)<1000:
        sumx = a + b + c
        if sumx > 0:
            sumx = str(a+b+c)
            return sumx[0]
        elif sumx< 0:
            sumx = str(a+b+c)
            return str(sumx[1])
def f4(a,b,c):
    if -1000<int(a)<1000 and -1000<int(b)<1000 and -1000<int(c)<1000:
        sumx = str(a+b+c)
        return sumx[-1]
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if -1000<int(a)<1000 and -1000<int(b)<1000 and -1000<int(c)<100:
        if s1 == 0 and s2 == 0:
            print(f1(a,b,c))
        elif s1 == 0 and s2 == 1:
            print(f2(a,b,c))
        elif s1 == 1 and s2 == 0:
            print(f3(a,b,c))
        elif s1 == 1 and s2 == 1 :
            print(f4(a,b,c))
        else :
            print("Error")
    
    
        
exec(input().strip())
            


# 1642132, 2022-09-24 10:34:48, ----[-P][----] (0%)

def f1(a,b,c) :
    if -1000<int(a)<1000 and -1000<int(b)<1000 and -1000<int(c)<1000:
        min_f1 = a
        if b < a :
            if b < 0:
                return a

        elif c < a:
            if c < 0 :
                return a
     
def f2(a,b,c) :
     if -1000<int(a)<1000 and -1000<int(b)<1000 and -1000<int(c)<1000:
        max_f2 = a
        if b > a :
            max_f2 = b
            return max_f2
        elif b > a and a < 0 :
            return a
        elif c > a:
            max_f2 = c
            return max_f2
        elif c > a and a < 0 :
            return a
def f3(a,b,c):
    if -1000<int(a)<1000 and -1000<int(b)<1000 and -1000<int(c)<1000:
        sumx = a + b + c
        if sumx > 0:
            sumx = str(a+b+c)
            return sumx[0]
        elif sumx< 0:
            sumx = str(a+b+c)
            return str(sumx[1])
def f4(a,b,c):
    if -1000<int(a)<1000 and -1000<int(b)<1000 and -1000<int(c)<1000:
        sumx = str(a+b+c)
        return sumx[-1]
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if -1000<int(a)<1000 and -1000<int(b)<1000 and -1000<int(c)<100:
        if s1 == 0 and s2 == 0:
            print(f1(a,b,c))
        elif s1 == 0 and s2 == 1:
            print(f2(a,b,c))
        elif s1 == 1 and s2 == 0:
            print(f3(a,b,c))
        elif s1 == 1 and s2 == 1 :
            print(f4(a,b,c))
        else :
            print("Error")
    
    
        
exec(input().strip())
            


# 1642417, 2022-09-24 10:38:28, ----[-P][----] (0%)

def f1(a,b,c) :
    if -1000<int(a)<1000 and -1000<int(b)<1000 and -1000<int(c)<1000:
        min_f1 = a
        if b < a :
            if b < 0:
                return a
            if b > 0 :
                return b

        elif c < a:
            if c < 0 :
                return a
            if c > 0 :
                return c
     
def f2(a,b,c) :
     if -1000<int(a)<1000 and -1000<int(b)<1000 and -1000<int(c)<1000:
        max_f2 = a
        if b > a :
            max_f2 = b
            return max_f2
        elif b > a and a < 0 :
            return a
        elif c > a:
            max_f2 = c
            return max_f2
        elif c > a and a < 0 :
            return a
def f3(a,b,c):
    if -1000<int(a)<1000 and -1000<int(b)<1000 and -1000<int(c)<1000:
        sumx = a + b + c
        if sumx > 0:
            sumx = str(a+b+c)
            return sumx[0]
        elif sumx< 0:
            sumx = str(a+b+c)
            return str(sumx[1])
def f4(a,b,c):
    if -1000<int(a)<1000 and -1000<int(b)<1000 and -1000<int(c)<1000:
        sumx = str(a+b+c)
        return sumx[-1]
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if -1000<int(a)<1000 and -1000<int(b)<1000 and -1000<int(c)<100:
        if s1 == 0 and s2 == 0:
            print(f1(a,b,c))
        elif s1 == 0 and s2 == 1:
            print(f2(a,b,c))
        elif s1 == 1 and s2 == 0:
            print(f3(a,b,c))
        elif s1 == 1 and s2 == 1 :
            print(f4(a,b,c))
        else :
            print("Error")
    
    
        
exec(input().strip())

6530169021
# 1641518, 2022-09-24 10:24:02, compilation error (0%)

def f1(a,b,c):
   if a and b and c >=0:
     return(min(a,b,c))
    
def f2 (a,b,c):
    if a and b and c <=0:
      return(int(max(a,b,c)))
      
def f3(a,b,c):
    return((a+b+c)//10**3%10)
    
def f4(a,b,c):
    return((a+b+c)%10)

exec(input().strip()
# 1641559, 2022-09-24 10:24:42, compilation error (0%)

def f1(a,b,c):
   if a and b and c >=0:
     return(min(a,b,c))
    
def f2 (a,b,c):
    if a and b and c <=0:
      return(int(max(a,b,c)))
      
def f3(a,b,c):
    return((a+b+c)//10**3%10)
    
def f4(a,b,c):
    return((a+b+c)%10)
    
 def main():
    s1,s2,a,b,c = input()
    if s1==0 and s2==0:
        print (f1(a,b,c))
        if s1==0 and s2==1:
           print (f2(a,b,c))
           if s1==1 and s2==0:
             print (f3(a,b,c))
             if s1==1 and s2==1:
                print (f4(a,b,c))
    else: print("Error")
        

exec(input().strip()
# 1641936, 2022-09-24 10:31:25, -xxx[xx][xxxx] (0%)

def f1(a,b,c):
   if a and c >=0:
      return(min(a,c))
  
exec(input().strip())
# 1642431, 2022-09-24 10:38:38, ----[xx][xxxx] (0%)

    
def f1(a,b,c):
   if a and b and c >=0:
     print(min(a,b,c))
    
def f2 (a,b,c):
    if a and b and c <=0:
      return(int(max(a,b,c)))
      
def f3(a,b,c):
    return((a+b+c)//10**3%10)
    
def f4(a,b,c):
    return((a+b+c)%10)
    
def main ():
    s1,s2,a,b,c = input()
    if s1==0 and s2==0:
        print (f1(a,b,c))
        if s1==0 and s2==1:
           print (f2(a,b,c))
           if s1==1 and s2==0:
             print (f3(a,b,c))
             if s1==1 and s2==1:
                print (f4(a,b,c))
    else: print("Error")
        

exec(input().strip())

6530179321
# 1640326, 2022-09-24 09:54:30, ----[P-][-PPP] (0%)

def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    -1000 <= a <= 1000
    -1000 <= b <= 1000
    -1000 <= c <= 1000
    if a < 0 and b < 0:
        return c
    elif a < 0 and c < 0:
        return b
    elif b < 0 and c < 0:
        return a
    elif a < 0:
        return min(b,c)
    elif b < 0:
        return min(a,c)
    elif c < 0:
        return min(a,b)
    

def f2(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    -1000 <= a <= 1000
    -1000 <= b <= 1000
    -1000 <= c <= 1000
    if a > 0 and b > 0:
        return c
    elif a > 0 and c > 0:
        return b
    elif b > 0 and c > 0:
        return a
    elif a > 0:
        return max(b,c)
    elif b > 0:
        return max(a,c)
    elif c > 0:
        return max(a,b)

def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    -1000 <= a <= 1000
    -1000 <= b <= 1000
    -1000 <= c <= 1000
    x = str(abs(a+b+c))
    return x[0]

def f4(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    -1000 <= a <= 1000
    -1000 <= b <= 1000
    -1000 <= c <= 1000
    y = str(abs(a+b+c))
    return y[1]

def main():
    s1,s2,a,b,c = input().split()
    a = int(a)
    b = int(b)
    c = int(c)
    -1000 <= a <= 1000
    -1000 <= b <= 1000
    -1000 <= c <= 1000
    (a or b or c) > 0
    (a or b or c) < 0
    if s1 == '0':
        print(f1(a, b, c))
    elif s1 == '0' and s2 == '1':
        print(f2(a, b, c))
    elif s1 == '1' and s2 == '0':
        print(f3(a, b, c))
    elif s1 == '1' and s2 == '1':
        print(f4(a, b, c))
    else:
        print('Error')

exec(input().strip())
# 1640416, 2022-09-24 09:57:18, ----[P-][-PPP] (0%)

def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    -1000 <= a <= 1000
    -1000 <= b <= 1000
    -1000 <= c <= 1000
    if a < 0 and b < 0:
        return c
    elif a < 0 and c < 0:
        return b
    elif b < 0 and c < 0:
        return a
    elif a < 0:
        return min(b,c)
    elif b < 0:
        return min(a,c)
    elif c < 0:
        return min(a,b)
    else:
        return min(a,b,c)
    

def f2(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    -1000 <= a <= 1000
    -1000 <= b <= 1000
    -1000 <= c <= 1000
    if a > 0 and b > 0:
        return c
    elif a > 0 and c > 0:
        return b
    elif b > 0 and c > 0:
        return a
    elif a > 0:
        return max(b,c)
    elif b > 0:
        return max(a,c)
    elif c > 0:
        return max(a,b)
    else:
        return max(a,b,c)

def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    -1000 <= a <= 1000
    -1000 <= b <= 1000
    -1000 <= c <= 1000
    x = str(abs(a+b+c))
    return x[0]

def f4(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    -1000 <= a <= 1000
    -1000 <= b <= 1000
    -1000 <= c <= 1000
    y = str(abs(a+b+c))
    return y[1]

def main():
    s1,s2,a,b,c = input().split()
    a = int(a)
    b = int(b)
    c = int(c)
    -1000 <= a <= 1000
    -1000 <= b <= 1000
    -1000 <= c <= 1000
    (a or b or c) > 0
    (a or b or c) < 0
    if s1 == '0':
        print(f1(a, b, c))
    elif s1 == '0' and s2 == '1':
        print(f2(a, b, c))
    elif s1 == '1' and s2 == '0':
        print(f3(a, b, c))
    elif s1 == '1' and s2 == '1':
        print(f4(a, b, c))
    else:
        print('Error')

exec(input().strip())
# 1640550, 2022-09-24 10:00:45, ----[P-][-PPP] (0%)

def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    -1000 <= a <= 1000
    -1000 <= b <= 1000
    -1000 <= c <= 1000
    if a < 0 and b < 0:
        return c
    elif a < 0 and c < 0:
        return b
    elif b < 0 and c < 0:
        return a
    elif a < 0:
        return min(b,c)
    elif b < 0:
        return min(a,c)
    elif c < 0:
        return min(a,b)
    else:
        return min(a,b,c)
    

def f2(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    -1000 <= a <= 1000
    -1000 <= b <= 1000
    -1000 <= c <= 1000
    if a > 0 and b > 0:
        return c
    elif a > 0 and c > 0:
        return b
    elif b > 0 and c > 0:
        return a
    elif a > 0:
        return max(b,c)
    elif b > 0:
        return max(a,c)
    elif c > 0:
        return max(a,b)
    else:
        return max(a,b,c)

def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    -1000 <= a <= 1000
    -1000 <= b <= 1000
    -1000 <= c <= 1000
    x = str(abs(a+b+c))
    return x[0]

def f4(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    -1000 <= a <= 1000
    -1000 <= b <= 1000
    -1000 <= c <= 1000
    y = str(abs(a+b+c))
    return y[1]

def main():
    s1,s2,a,b,c = input().split()
    a = int(a)
    b = int(b)
    c = int(c)
    -1000 <= a <= 1000
    -1000 <= b <= 1000
    -1000 <= c <= 1000
    if s1 == '0':
        print(f1(a, b, c))
    elif s1 == '0' and s2 == '1':
        print(f2(a, b, c))
    elif s1 == '1' and s2 == '0':
        print(f3(a, b, c))
    elif s1 == '1' and s2 == '1':
        print(f4(a, b, c))
    else:
        print('Error')

exec(input().strip())
# 1641068, 2022-09-24 10:14:22, ----[P-][-PPP] (0%)

def f1(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    -1000 <= a <= 1000
    -1000 <= b <= 1000
    -1000 <= c <= 1000
    if a < 0 and b < 0:
        return c
    elif a < 0 and c < 0:
        return b
    elif b < 0 and c < 0:
        return a
    elif a < 0:
        return min(b,c)
    elif b < 0:
        return min(a,c)
    elif c < 0:
        return min(a,b)
    else:
        return min(a,b,c)
    

def f2(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    -1000 <= a <= 1000
    -1000 <= b <= 1000
    -1000 <= c <= 1000
    if a > 0 and b > 0:
        return c
    elif a > 0 and c > 0:
        return b
    elif b > 0 and c > 0:
        return a
    elif a > 0:
        return max(b,c)
    elif b > 0:
        return max(a,c)
    elif c > 0:
        return max(a,b)
    else:
        return max(a,b,c)

def f3(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    -1000 <= a <= 1000
    -1000 <= b <= 1000
    -1000 <= c <= 1000
    x = str(abs(a+b+c))
    return x[0]

def f4(a, b, c):
    a = int(a)
    b = int(b)
    c = int(c)
    -1000 <= a <= 1000
    -1000 <= b <= 1000
    -1000 <= c <= 1000
    y = str(abs(a+b+c))
    return y[1]

def main():
    s1, s2, a, b, c = input().split()
    s1 = int(s1)
    s2 = int(s2)
    a = int(a)
    b = int(b)
    c = int(c)
    -1000 <= a <= 1000
    -1000 <= b <= 1000
    -1000 <= c <= 1000
    if s1 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print('Error')

exec(input().strip())

6530190121
# 1640255, 2022-09-24 09:52:13, ----[--][----] (0%)


def f1(a, b, c):
    if -1000 <= a <= 1000 and -1000 <= b <=1000 and -1000 <= c <= 1000:
        if a > 0 or b > 0 or c > 0:
            return min(a,b,c)
        if (a > 0 and b > 0) or (b > 0 and c > 0) or (a > 0 and c > 0):
            return min(a,b,c)
        if (a > 0 and b > 0 and c > 0):
            return min(a,b,c)
        
def f2(a, b, c):
    if -1000 <= a <= 1000 and -1000 <= b <=1000 and -1000 <= c <= 1000:
        if a < 0 or b < 0 or c < 0:
            return max(a,b,c)
        if (a < 0 and b < 0) or (b < 0 and c < 0) or (a < 0 and c < 0):
            return max(a,b,c)
        if (a < 0 and b < 0 and c < 0):
            return max(a,b,c)
        
# 1640283, 2022-09-24 09:53:07, --xx[xx][xxxx] (0%)

def f1(a, b, c):
    if -1000 <= a <= 1000 and -1000 <= b <=1000 and -1000 <= c <= 1000:
        if a > 0 or b > 0 or c > 0:
            return min(a,b,c)
        if (a > 0 and b > 0) or (b > 0 and c > 0) or (a > 0 and c > 0):
            return min(a,b,c)
        if (a > 0 and b > 0 and c > 0):
            return min(a,b,c)
        
def f2(a, b, c):
    if -1000 <= a <= 1000 and -1000 <= b <=1000 and -1000 <= c <= 1000:
        if a < 0 or b < 0 or c < 0:
            return max(a,b,c)
        if (a < 0 and b < 0) or (b < 0 and c < 0) or (a < 0 and c < 0):
            return max(a,b,c)
        if (a < 0 and b < 0 and c < 0):
            return max(a,b,c)
            
exec(input().strip())
# 1640672, 2022-09-24 10:04:07, --xx[xx][xxxx] (0%)

def f1(a, b, c):
    if -1000 <= a <= 1000 and -1000 <= b <=1000 and -1000 <= c <= 1000:
        if (a > 0 and b > 0 and c < 0):
            return min(a,b)
        if (a < 0 and b > 0 and c > 0):
            return min(b,c)
        if (a > 0 and b < 0 and c > 0):
            return min(a,c)
        if (a < 0 and b < 0 and c > 0):
            return c
        if (a > 0 and b < 0 and c < 0):
            return a
        if (a < 0 and b > 0 and c < 0):
            return b
        if (a > 0 and b > 0 and c > 0):
            return min(a,b,c)
        
def f2(a, b, c):
    if -1000 <= a <= 1000 and -1000 <= b <=1000 and -1000 <= c <= 1000:
        if (a > 0 and b > 0 and c < 0):
            return c
        if (a < 0 and b > 0 and c > 0):
            return a
        if (a > 0 and b < 0 and c > 0):
            return b
        if (a < 0 and b < 0 and c > 0):
            return max(a,b)
        if (a > 0 and b < 0 and c < 0):
            return max(b,c)
        if (a < 0 and b > 0 and c < 0):
            return max(a,c)
        if (a < 0 and b < 0 and c < 0):
            return max(a,b,c)
        
exec(input().strip())
# 1641120, 2022-09-24 10:15:49, --xx[xx][xxxx] (0%)

def f1(a, b, c):
    if -1000 <= a <= 1000 and -1000 <= b <=1000 and -1000 <= c <= 1000:
        if (a == 0 or b == 0 or c == 0):
            return None
        if (a > 0 and b > 0 and c <= 0):
            return min(a,b)
        if (a <= 0 and b > 0 and c > 0):
            return min(b,c)
        if (a > 0 and b <= 0 and c > 0):
            return min(a,c)
        if (a <= 0 and b <= 0 and c > 0):
            return c
        if (a > 0 and b <= 0 and c <= 0):
            return a
        if (a <= 0 and b > 0 and c <= 0):
            return b
        if (a > 0 and b > 0 and c > 0):
            return min(a,b,c)
        

def f2(a, b, c):
    if -1000 <= a <= 1000 and -1000 <= b <=1000 and -1000 <= c <= 1000:
        if (a > 0 and b > 0 and c < 0):
            return c
        if (a < 0 and b > 0 and c > 0):
            return a
        if (a > 0 and b < 0 and c > 0):
            return b
        if (a < 0 and b < 0 and c > 0):
            return max(a,b)
        if (a > 0 and b < 0 and c < 0):
            return max(b,c)
        if (a < 0 and b > 0 and c < 0):
            return max(a,c)
        if (a < 0 and b < 0 and c < 0):
            return max(a,b,c)
        
exec(input().strip())

6531005021
# 1640500, 2022-09-24 09:59:20, xxxx[xx][xxxx] (0%)

x= int(input())
def f1(a,b,c) :
    a,b,c > 0
    return min(a,b,c)
def f2(a,b,c) :
    return max(a,b,c)
def f3(a,b,c) :
    return sum(a,b,c)
def f4(a,b,c) :
    return sum(a,b,c)
def main() :
    y = input().split()

    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')


# 1641205, 2022-09-24 10:17:42, compilation error (0%)

x= int(input())
for a,b,c in range (-1000,1000) :
def f1(a,b,c) :
    return min(a,b,c)
def f2(a,b,c) :
    return max(a,b,c)
def f3(a,b,c) :
    return sum(a,b,c)
def f4(a,b,c) :
    return sum(a,b,c)
def main() :
    a,b,c,s1,s2 = [float(e) for e in input().split()]

    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')


# 1641236, 2022-09-24 10:18:19, xxxx[xx][xxxx] (0%)

x= int(input())
def f1(a,b,c) :
    return min(a,b,c)
def f2(a,b,c) :
    return max(a,b,c)
def f3(a,b,c) :
    return sum(a,b,c)
def f4(a,b,c) :
    return sum(a,b,c)
def main() :
    a,b,c,s1,s2 = [float(e) for e in input().split()]

    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
# 1641629, 2022-09-24 10:25:58, xxxx[xx][xxxx] (0%)

x= int(input())
def f1(a,b,c) :
    return min(a,b,c)
def f2(a,b,c) :
    return max(a,b,c)
def f3(a,b,c) :
    return sum(a,b,c)
def f4(a,b,c) :
    return sum(a,b,c)
def main() :
    a,b,c,s1,s2 = [float(e) for e in input().split()]

    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else :
        print('Error')
exec(input().strip())

6231101221
# 1641067, 2022-09-24 10:14:21, compilation error (0%)

def f1(a,b,c):
    if -1000 <= int(a) and int (b) and int(c) <= 1000:
        if a or b or c >= 0 :
            if a or b or c <= 0:
                
        
            
def f2(a,b,c):
    if -1000 <= int(a) and int (b) and int(c) <= 1000:
        if a or b or c >= 0 :
            if a or b or c <= 0:
                
def f3(a,b,c):
    if -1000 <= int(a) and int (b) and int(c) <= 1000:
        if a or b or c >= 0 :
            if a or b or c <= 0:
                x = sum(a,b,c)
                print(x[0])
                
def f4(a,b,c):       
    if -1000 <= int(a) and int (b) and int(c) <= 1000:
        if a or b or c >= 0 :
            if a or b or c <= 0:
                
def main():
    x = input().split()
    s1 = x[0]
    s2 = x[1]
    a = x[2]
    b = x[3]
    c = x[4]
    if -1000 <= int(a) and int (b) and int(c) <= 1000:
        if a or b or c >= 0 :
            if a or b or c <= 0:
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))    
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    if s1 != 1 or s2 != 1 or  s1 != 0 or s2 != 0:
        print('Error')
exec(input().strip())
# 1641675, 2022-09-24 10:26:45, compilation error (0%)

def f1(a,b,c):
    if -1000 <= int(a) and int (b) and int(c) <= 1000:
        if a or b or c >= 0 :
            if a or b or c <= 0:
                print(max(a,b,c>0))
        
            
def f2(a,b,c):
    if -1000 <= int(a) and int (b) and int(c) <= 1000:
        if a or b or c >= 0 :
            if a or b or c <= 0:
                 print(min(a,b,c<0))
                
def f3(a,b,c):
    if -1000 <= int(a) and int (b) and int(c) <= 1000:
        if a or b or c >= 0 :
            if a or b or c <= 0:
                x = sum(a,b,c)
                print(x[0])
                
def f4(a,b,c):       
    if -1000 <= int(a) and int (b) and int(c) <= 1000:
        if a or b or c >= 0 :
            if a or b or c <= 0:
                
def main():
    x = input().split()
    s1 = x[0]
    s2 = x[1]
    a = x[2]
    b = x[3]
    c = x[4]
    if -1000 <= int(a) and int (b) and int(c) <= 1000:
        if a or b or c >= 0 :
            if a or b or c <= 0:
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))    
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    if s1 != 1 or s2 != 1 or  s1 != 0 or s2 != 0:
        print('Error')
exec(input().strip())
# 1642397, 2022-09-24 10:38:15, compilation error (0%)

def f1(a,b,c):
    if -1000 <= int(a) and int (b) and int(c) <= 1000:
        if a or b or c >= 0 :
            if a or b or c <= 0:
            
                print(min(a,b,c))
        
            
def f2(a,b,c):
    if -1000 <= int(a) and int (b) and int(c) <= 1000:
        if a or b or c >= 0 :
            if a or b or c <= 0:
                 print(max(a,b,c<0))
                
def f3(a,b,c):
    if -1000 <= int(a) and int (b) and int(c) <= 1000:
        if a or b or c >= 0 :
            if a or b or c <= 0:
                x = sum(a,b,c)
                print(x[0])
                
def f4(a,b,c):       
    if -1000 <= int(a) and int (b) and int(c) <= 1000:
        if a or b or c >= 0 :
            if a or b or c <= 0:
                
def main():
    x = input().split()
    s1 = x[0]
    s2 = x[1]
    a = x[2]
    b = x[3]
    c = x[4]
    if -1000 <= int(a) and int (b) and int(c) <= 1000:
        if a or b or c >= 0 :
            if a or b or c <= 0:
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))    
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    if s1 != 1 or s2 != 1 or  s1 != 0 or s2 != 0:
        print('Error')
exec(input().strip())

6230425421
# 1640782, 2022-09-24 10:06:50, ----[--][----] (0%)

def f1(a, b, c):
    if a < 0 :
        a = 9999
    if b < 0 :
        b = 9999
    if c < 0 :
        c=  9999
    k = min(a,b,c)
    return k
    
def f2(a, b, c):
    pass

def f3(a, b, c):
    pass

def f4(a, b, c):
    pass

def main():
    pass

exec(input().strip())
# 1640883, 2022-09-24 10:09:18, ----[--][----] (0%)

def f1(a, b, c):
    if -1000 <= a <= 1000 :
        if a < 0 :
            a = 9999
    if -1000 <= b <= 1000 :
        if b < 0 :
            b = 9999
    if -1000 <= c <= 1000 :
        if c < 0 :
            c = 9999
    k = min(a,b,c)
    return k
    
def f2(a, b, c):
    pass

def f3(a, b, c):
    pass

def f4(a, b, c):
    pass

def main():
    pass

exec(input().strip())
# 1641103, 2022-09-24 10:15:25, compilation error (0%)

def f1(a, b, c):
    if -1000 <= a <= 1000 :
        if a < 0 :
            a = 9999
    if -1000 <= b <= 1000 :
        if b < 0 :
            b = 9999
    if -1000 <= c <= 1000 :
        if c < 0 :
            c = 9999
    k = min(a,b,c)
    return k
    
def f2(a, b, c):
    pass

def f3(a, b, c):
    pass

def f4(a, b, c):
    def f4(a, b, c):
    if -1000 <= a <= 1000 :
        a = str(abs(a))
        k = 0
        for i in range(len(a)) :
            k += int(a[i])
            k = str(k)[-1]
    if -1000 <= b <= 1000 :
        b = str(abs(b))
        s = 0
        for i in range(len(b)) :
            s += int(b[i])
            s = str(s)[-1]
    if -1000 <= a <= 1000 :
        a = str(abs(a))
        l = 0
        for i in range(len(a)) :
            l += int(a[i])
            l = str(l)[-1]
    sum = int(k) + int(s) + int(l)
    return sum

def main():
    pass

exec(input().strip())

6431513321
# 1640018, 2022-09-24 09:46:04, xxxx[xx][xxxx] (0%)

a,b,c,d = [int(e) for e in input().split()]

if a > b:
    a,b=b,a

    while d >= a:
        if c > d:
            a += 1
        else:
            d -= 1
    
else:
    if c % 2 == 0:
      d = d + a
        
    else:
      if d > c:
        c = c + d
        
      else:
        b = b + a
        
print(a,b,c,d)
# 1641058, 2022-09-24 10:14:01, xxxx[xx][xxxx] (0%)

def f1(a, b, c):
    
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่าน้อยท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่่า 0
    if a > 0 and b > 0 and c > 0:
        if a > b:
            if b > c:
                ans1=c
            else:
                ans1=b
        else:
            if a < c:
                ans1=a
    
    else: pass
    
        
    return ans1  

def f2(a, b, c):

# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    if a > 0 and b > 0 and c > 0:
        if a < b:
            if b < c:
                ans2=c
            else:
                ans2=b
        else:
            if a > c:
                ans2=a
    
    else: pass
    
        
    return ans2 
#def f3(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเคร่ืองหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
#def f4(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
#def main():
# รับข้อมูลจากคีย์บอร์ดเป็นจํานวนเต็ม 5 จํานวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกําหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c) # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c) # ถ้าs1 หรือs2 เป็นค่าอ่ืนให้แสดงคําว่าError
exec(input().strip()) # DON'T remove this line
# 1641294, 2022-09-24 10:19:23, xxxx[xx][-x-x] (0%)

def f1(a, b, c):
    
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่าน้อยท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่่า 0
    if a > 0 and b > 0 and c > 0:
        if a > b:
            if b > c:
                ans1=c
            else:
                ans1=b
        else:
            if a < c:
                ans1=a
    
    else: pass
    
        
    return ans1  

def f2(a, b, c):

# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    if a > 0 and b > 0 and c > 0:
        if a < b:
            if b < c:
                ans2=c
            else:
                ans2=b
        else:
            if a > c:
                ans2=a
    
    else: pass
    
        
    return ans2 
#def f3(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเคร่ืองหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
#def f4(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    if s1 != 1 or 0:
        print("Error")
    if s2 != 1 or 0:
        print("Error")       
    
exec(input().strip()) # DON'T remove this line

6431103721
# 1641145, 2022-09-24 10:16:23, --xx[--][P-P-] (0%)

def f1(a, b, c):
    -1000 <= a,b,c <= 1000
    if a < 0 :
        if b < 0:
            c > 0
    else:
        if a > 0 :
            if b > 0:
                c < 0       
    x = min(a,b,c)
    if x > 0:
         return(x)

def f2(a, b, c):
    
    x = max(a,b,c)
    if x < 0 :
        return(x)
def f3(a, b, c):
    
    x = int(a) + int(b) +int(c)
    return(x[0])
def f4(a, b, c):
    
    x = int(a)+int(b)+int(c)
    return (x[-1])
def main():
    x = input().split()
    s1 = x[0]
    s2 = x[1]
    a = x[2]
    b = x[3]
    c = x[4]
    #-1000 <= a,b,c <= 1000
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line
# 1641927, 2022-09-24 10:31:08, compilation error (0%)

def f1(a, b, c):
    -1000 <= a,b,c <= 1000
    if a < 0 :
        if b < 0:
            c > 0
    else:
        if a > 0 :
            if b > 0:
                c < 0       
    x = min(a,b,c)
    if x > 0:
         return(x)

def f2(a, b, c):
    
    x = max(a,b,c)
    if x < 0 :
        return(x)
def f3(a, b, c):
    def f1(a, b, c):
    -1000 <= a,b,c <= 1000
    max(a,b,c) > 0
    min(a,b,c) < 0    
    x = min(a,b,c)
    y = int(x)
    if y > 0:
         return(y)

def f2(a, b, c):
    -1000 <= a,b,c <= 1000
    max(a,b,c) > 0
    min(a,b,c) < 0
    x = max(a,b,c)
    y = int(x)
    if x < 0 :
        return(y)
def f3(a, b, c):
    -1000 <= a,b,c <= 1000
    max(a,b,c) > 0
    min(a,b,c) < 0
    x = int(a) + int(b) +int(c)
    return(x[0])
def f4(a, b, c):
    -1000 <= a,b,c <= 1000
    max(a,b,c) > 0
    min(a,b,c) < 0
    x = int(a)+int(b)+int(c)
    return (x[-1])
def main():
    x = input().split()
    s1 = x[0]
    s2 = x[1]
    a = x[2]
    b = x[3]
    c = x[4]
    -1000 <= a,b,c <= 1000
    max(a,b,c) > 0
    min(a,b,c) < 0
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line

    x = int(a) + int(b) +int(c)
    return(x[0])
def f4(a, b, c):
    
    x = int(a)+int(b)+int(c)
    return (x[-1])
def main():
    x = input().split()
    s1 = x[0]
    s2 = x[1]
    a = x[2]
    b = x[3]
    c = x[4]
    #-1000 <= a,b,c <= 1000
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line
# 1642353, 2022-09-24 10:37:40, --xx[xx][xxxx] (0%)

def f1(a, b, c):
    -1000 <= a,b,c <= 1000
    max(a,b,c) > 0
    min(a,b,c) < 0    
    x = min(a,b,c)
    y = int(x)
    if y > 0:
         return(y)

def f2(a, b, c):
    -1000 <= a,b,c <= 1000
    max(a,b,c) > 0
    min(a,b,c) < 0
    x = max(a,b,c)
    y = int(x)
    if x < 0 :
        return(y)
def f3(a, b, c):
    -1000 <= a,b,c <= 1000
    max(a,b,c) > 0
    min(a,b,c) < 0
    x = int(a) + int(b) +int(c)
    if x[0] == "-" :
        return(x[1])
    
def f4(a, b, c):
    -1000 <= a,b,c <= 1000
    max(a,b,c) > 0
    min(a,b,c) < 0
    x = int(a)+int(b)+int(c)
    
    return (x[-1])
def main():
    x = input().split()
    s1 = x[0]
    s2 = x[1]
    a = x[2]
    b = x[3]
    c = x[4]
    -1000 <= a,b,c <= 1000
    max(a,b,c) > 0
    min(a,b,c) < 0
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1 :
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0 :
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1 :
        print(f4(a,b,c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line


6430322621
# 1640459, 2022-09-24 09:58:34, ----[--][----] (0%)

x=input()
print(x)



# 1641177, 2022-09-24 10:17:07, xxxx[xx][xxxx] (0%)

x=input()
y=x.split("+")
total=0
for i in range (len(y)) :
    
    total=int(y[i])+total
print(total)

# 1642065, 2022-09-24 10:33:51, xxxx[--][----] (0%)

x=input()
y=x.split("-")[1::]
a=0
for i in range (len(y)) :
    a=a+int(y[i])
print(a*-1)

6531511121
# 1640351, 2022-09-24 09:55:26, --xx[--][-x-x] (0%)

def f1(a, b, c):
    if a> 0 or b>0 or c > 0:
        return min
def f2(a, b, c):
    if a< 0 or b<0 or c < 0:
        return max
def f3(a, b, c):
    t = a+b+c
    if t > 0:
        print(t[0])
    else:
        t < 0
        print(t[1])
    
def f4(a, b, c):
    t = a+b+c
    print(t[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
        
    
exec(input().strip()) # DON'T remove this line
# 1640980, 2022-09-24 10:12:00, compilation error (0%)

def f1(a, b, c):
    if a> 0 or b>0 or c > 0:
        return min
def f2(a, b, c):
    if a< 0 or b<0 or c < 0:
        return max
def f3(a, b, c):
    t = a+b+c
    if t > 0:
        print(t[0])
    else:
        t < 0
        print(t[1])
    
def f4(a, b, c):
    t = a+b+c
    print(t[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    if s1,s2 != (0,0) or s1,s2 != (0,1) or s1,s2 != (1,0) or s1,s2 != (1,1):
       print("Error")
    
exec(input().strip()) # DON'T remove this line
# 1641245, 2022-09-24 10:18:28, --xx[--][-x-x] (0%)

def f1(a, b, c):
    if a> 0 or b>0 or c > 0:
        return min
def f2(a, b, c):
    if a< 0 or b<0 or c < 0:
        return max
def f3(a, b, c):
    t = a+b+c
    if t > 0:
        print(t[0])
    else:
        t < 0
        print(t[1])
    
def f4(a, b, c):
    t = a+b+c
    print(t[-1])

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    if s1 not in [0,1] and s2 not in [0,1]: 
       print("Error")
    
exec(input().strip()) # DON'T remove this line

6531524321
# 1641096, 2022-09-24 10:15:18, compilation error (0%)

def f1(a, b, c):
    d = [a,b,c]
    if a<0:
        d.remove(a)
    if b<0:
        d.remove(b)
    if c<0:
        d.remove(c)
    return min(d)
    
def f2(a, b, c):
    d = [a,b,c]
    if a>0:
        d.remove(a)
    if b>0:
        d.remove(b)
    if c>0:
        d.remove(c)
    return max(d)
    
def f3(a, b, c):
    x = a+b+c
    if x < 0:
        x = -x
    d = str(x)
    return d[0]

def f4(a, b, c):
    def f3(a, b, c):
    x = a+b+c
    if x < 0:
        x = -x
    d = str(x)
    return d[-1]

def main():
    x = input()
    
    
exec(input().strip()) # DON'T remove this line
# 1641512, 2022-09-24 10:23:55, ----[--][P-P-] (0%)

def f1(a, b, c):
    d = [a,b,c]
    if a<0:
        d.remove(a)
    if b<0:
        d.remove(b)
    if c<0:
        d.remove(c)
    return min(d)
    
def f2(a, b, c):
    d = [a,b,c]
    if a>0:
        d.remove(a)
    if b>0:
        d.remove(b)
    if c>0:
        d.remove(c)
    return max(d)
    
def f3(a, b, c):
    x = a+b+c
    if x < 0:
        x = -x
    d = str(x)
    return d[0]

def f4(a, b, c):
    x = a+b+c
    if x < 0:
        x = -x
    d = str(x)
    return d[-1]

def main():
    s1,s2,a,b,c = input().split()
    if s1==0 and s2==0:
        print(f1(a,b,c))
    if s1==0 and s2==1:
        print(f2(a,b,c))
    if s1==1 and s2==0:
        print(f3(a,b,c))
    if s1==1 and s2==1:
        print(f4(a,b,c))
    if s1!=0 and s1!=1 and s2!=0 and s2!=1:
        print("Error")
    
exec(input().strip()) # DON'T remove this line
# 1642019, 2022-09-24 10:33:00, ----[--][P-P-] (0%)

def f1(a, b, c):
    d = [a,b,c]
    if a<0:
        d.remove(a)
    if b<0:
        d.remove(b)
    if c<0:
        d.remove(c)
    return min(d)
    
def f2(a, b, c):
    d = [a,b,c]
    if a>0:
        d.remove(a)
    if b>0:
        d.remove(b)
    if c>0:
        d.remove(c)
    return max(d)
    
def f3(a, b, c):
    x = a+b+c
    if x < 0:
        x = -x
    d = str(x)
    return d[0]

def f4(a, b, c):
    x = a+b+c
    if x < 0:
        x = -x
    d = str(x)
    return d[-1]

def main():
    s1,s2,a,b,c = input().split()
    if s1==0 and s2==0:
        print(f1(a,b,c))
    if s1==0 and s2==1:
        print(f2(a,b,c))
    if s1==1 and s2==0:
        print(f3(a,b,c))
    if s1==1 and s2==1:
        print(f4(a,b,c))
    if s1!=0 and s1!=1 and s2!=0 and s2!=1:
        print("Error")
    
exec(input().strip()) # DON'T remove this line

6531525021
# 1641036, 2022-09-24 10:13:27, compilation error (0%)

def f1(a, b, c):
    x = []
    x += a
    x += b
    x += c
    x.sort()
    if x[1] > 0:
        return x[1]
    if x[2] > 0:
        return x[2]
    if x[3] > 0:
        return x[2]

def f2(a, b, c):
    x = []
    x += a
    x += b
    x += c
    x.sort()
    if x[1] < 0:
        if x[1] < x[2]:
          return x[2]:
    if x[2] < 0:
        if x[2] < x[3]:
           return x[3] 
    if x[3] < 0:
        return x[3]
    
def f3(a, b, c):
    x = []
    x += a
    x += b
    x += c
    x.sort()
    y = sum(x)
    z = list('y')
    if z[0] < 0:
        return -z[0]
    if z[0] > 0 :
        return z[0]

def f4(a, b, c):
    x = []
    x += a
    x += b
    x += c
    x.sort()
    y = sum(x)
    z = y%10
    if z < 0:
      return -z
    if z > 0:
      return z

    

def main():
    s1,s2,a,b,c = input.split()
    if s1== 0 and s2 == 0 :
        print(f1(a,c,b))
    elif s1== 0 and s2 == 1 :
        print(f2(a,c,b))
    elif s1== 1 and s2 == 0 :
        print(f1(a,c,b))
    elif s1== 0 and s2 == 0 :
        print(f3(a,c,b))
    else:
        print(error)
        
exec(input().strip()) # DON'T remove this line

# 1642070, 2022-09-24 10:33:59, xxxx[xx][xxxx] (0%)

def f1(a, b, c):
    x = []
    x += a
    x += b
    x += c
    x.sort()
    if x[1] > 0:
        return x[1]
    if x[2] > 0:
        return x[2]
    if x[3] > 0:
        return x[2]

def f2(a, b, c):
    x = []
    x += a
    x += b
    x += c
    x.sort()
    if x[1] < 0:
        if x[1] < x[2]:
          return x[2]
    if x[2] < 0:
        if x[2] < x[3]:
           return x[3] 
    if x[3] < 0:
        return x[3]
    
def f3(a, b, c):
    x = []
    x += a
    x += b
    x += c
    x.sort()
    y = sum(x)
    z = list('y')
    if z[0] < 0:
        return -z[0]
    if z[0] > 0 :
        return z[0]

def f4(a, b, c):
    x = []
    x += a
    x += b
    x += c
    x.sort()
    y = sum(x)
    z = y%10
    if z < 0:
      return -z
    if z > 0:
      return z

    

def main():
    s1,s2,a,b,c = input.split()
    if s1== 0 and s2 == 0 :
        print(f1(a,c,b))
    elif s1== 0 and s2 == 1 :
        print(f2(a,c,b))
    elif s1== 1 and s2 == 0 :
        print(f1(a,c,b))
    elif s1== 0 and s2 == 0 :
        print(f3(a,c,b))
    else:
        print(error)
        
exec(input().strip()) # DON'T remove this line
# 1642185, 2022-09-24 10:35:33, xxxx[xx][xxxx] (0%)

def f1(a, b, c):
    x = []
    x += a
    x += b
    x += c
    x.sort()
    if x[1] > 0:
        return x[1]
    if x[2] > 0:
        return x[2]
    if x[3] > 0:
        return x[2]

def f2(a, b, c):
    x = []
    x += a
    x += b
    x += c
    x.sort()
    if x[1] < 0:
        if x[1] < x[2]:
          return x[2]
    if x[2] < 0:
        if x[2] < x[3]:
           return x[3] 
    if x[3] < 0:
           return x[3]
    
def f3(a, b, c):
    x = []
    x += a
    x += b
    x += c
    x.sort()
    y = sum(x)
    z = list('y')
    if z[0] < 0:
        return -z[0]
    if z[0] > 0 :
        return z[0]

def f4(a, b, c):
    x = []
    x += a
    x += b
    x += c
    x.sort()
    y = sum(x)
    z = y%10
    if z < 0:
      return -z
    if z > 0:
      return z

    

def main():
    s1,s2,a,b,c = input.split()
    if s1== 0 and s2 == 0 :
        print(f1(a,c,b))
    elif s1== 0 and s2 == 1 :
        print(f2(a,c,b))
    elif s1== 1 and s2 == 0 :
        print(f1(a,c,b))
    elif s1== 0 and s2 == 0 :
        print(f3(a,c,b))
    else:
        print(error)
        
exec(input().strip()) # DON'T remove this line

6530129021
# 1640409, 2022-09-24 09:57:08, xxx-[xx][xxxx] (0%)

def f4(a, b, c):
    x = a + b + c
    y = x % 10
    return y
    
        

    
exec(input().strip())
# 1641614, 2022-09-24 10:25:43, xxx-[--][----] (0%)

def f4(a, b, c):
    x = a + b + c
    y = x % 10
    return y
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    if s1 not in [0,1] and s2 not in [0,1]:
        print('Error')
exec(input().strip())
# 1642123, 2022-09-24 10:34:41, xx--[--][-P-P] (0%)

def f3(a, b, c):
    x = abs(a + b + c)
    x = str(x)
    return x[0]
def f4(a, b, c):
    x = a + b + c
    y = x % 10
    return y
def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    if s1 not in [0,1] and s2 not in [0,1]:
        print('Error')
exec(input().strip())

6530134021
# 1641806, 2022-09-24 10:29:17, compilation error (0%)

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    a,b,c = [int(e) for e in input().split()]
    if a<b:
        if a<c and a>0:
            return(a)
        else:
            if c<b and c>0:
                return(c)
    else:
        return(b)
             

def f2(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    a,b,c=[int(e) for e in input().split()]
    if a>b:
        if a>c and a<0:
            return(a)
        else:
            if c>b and c>0:
                return(c)
    else:
        return(b)
            
            
    
def f3(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c

    

def f4(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c


def main():
    # รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
    # ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
    # ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
    # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
    # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
    # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
    # ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error


exec(input().strip()) # DON'T remove this line

# 1642143, 2022-09-24 10:35:00, compilation error (0%)

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    a,b,c = [int(e) for e in input().split()]
    if a<b:
        if a<c and a>0:
            return(a)
        else:
            if c<b and c>0:
                return(c)
    else:
        return(b)
             
def f2(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    a,b,c=[int(e) for e in input().split()]
    if a>b:
        if a>c and a<0:
            return(a)
        else:
            if c>b and c>0:
                return(c)
    else:
        return(b)
            
def f3(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
    a,b,c=[int(e) for e in input().split()]
    if a+b+c>0:
        x=(a+b+c)//10**(len(a+b+c)-1)
        return(x)
    else:
        y=0-(a+b+c)//10**(len(a+b+c)-1)
        return(y)
        
    

def f4(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c


def main():
    # รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
    # ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
    # ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
    # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
    # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
    # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
    # ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error


exec(input().strip()) # DON'T remove this line

# 1642271, 2022-09-24 10:36:46, compilation error (0%)

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    a,b,c = [int(e) for e in input().split()]
    if a<b:
        if a<c and a>0:
            return(a)
        else:
            if c<b and c>0:
                return(c)
    else:
        return(b)
             
def f2(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    a,b,c=[int(e) for e in input().split()]
    if a>b:
        if a>c and a<0:
            return(a)
        else:
            if c>b and c>0:
                return(c)
    else:
        return(b)
            
def f3(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
    a,b,c=[int(e) for e in input().split()]
    if a+b+c>0:
        x=floor((a+b+c)/10**(len(a+b+c)-1))
        return(x)
    else:
        y=floor(0-(a+b+c)/10**(len(a+b+c)-1))
        return(y)
        
    

def f4(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
    a,b,c=[int(e) for e in input().split()]
    if a+b+c>0:
        x=(a+b+c)//10
        return(x)
    else:
        y=0-(a+b+c)//10
        return(y)

def main():
    # รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
    # ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
    # ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
    # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
    # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
    # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
    # ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error


exec(input().strip()) # DON'T remove this line


6531011721
# 1640344, 2022-09-24 09:55:07, compilation error (0%)

def f1(a,b,c):
    for a,b,c in range(-1000,1001):
          a or b or c > 0
          a or b or c < 0
    return

def f2(a,b,c):
    for a,b,c in range(-1000,1001):
        
def f3(a,b,c):
    for a,b,c in range(-1000,1001):
        
def f4(a,b,c):
    for a,b,c in range(-1000,1001):

def main():
    x = input().split()
    s1,s2,a,b,c = int(x[0]),int(x[1]),int(x[2]),int(x[3]),int(x[4])
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 ==0 and s2 == 1:
        print(f2(a,b,c))
    if s1 ==1 and s2 == 0:
        print(f3(a,b,c))
    if s1 ==1 and s2 == 1:
        print(f4(a,b,c))
    else:
        print("Error")
    
exec(input().strip()) 
# 1641557, 2022-09-24 10:24:41, xxxx[xx][xxxx] (0%)

x = input()
a,b,c = int(x[0]),int(x[1]),int(x[2])
def f1(a,b,c):
    for a,b,c in range(-1000,1001):
        a or b or c > 0
        a or b or c < 0
    if a < b:
        print(a)
        
def f2(a,b,c):
    for a,b,c in range(-1000,1001):
        a or b or c > 0
        a or b or c < 0
        
def f3(a,b,c):
    for a,b,c in range(-1000,1001):
        a or b or c > 0
        a or b or c < 0
def f4(a,b,c):
    for a,b,c in range(-1000,1001):
        a or b or c > 0
        a or b or c < 0
def main():
    x = input().split()
    s1,s2,a,b,c = int(x[0]),int(x[1]),int(x[2]),int(x[3]),int(x[4])
    for a,b,c in range(-1000,1001):
        a or b or c > 0
        a or b or c < 0
        if s1 == 0 and s2 == 0:
            print(f1(a,b,c))
        if s1 ==0 and s2 == 1:
            print(f2(a,b,c))
        if s1 ==1 and s2 == 0:
            print(f3(a,b,c))
        if s1 ==1 and s2 == 1:
            print(f4(a,b,c))
        else:
            print("Error")
    
exec(input().strip()) 
# 1642093, 2022-09-24 10:34:17, xxxx[xx][xxxx] (0%)

def f1(a,b,c):
    for a,b,c in range(-1000,1001):
        a or b or c > 0
        a or b or c < 0
    return min(a,b,c)
        

def f2(a,b,c):
    for a,b,c in range(-1000,1001):
        a or b or c > 0
        a or b or c < 0
    return max(a,b,c)

def f3(a,b,c):
    for a,b,c in range(-1000,1001):
        a or b or c > 0
        a or b or c < 0
    return
        
        
def f4(a,b,c):
    for a,b,c in range(-1000,1001):
        a or b or c > 0
        a or b or c < 0
        
        
def main():
    x = input().split()
    s1,s2,a,b,c = int(x[0]),int(x[1]),int(x[2]),int(x[3]),int(x[4])
    for a,b,c in range(-1000,1001):
        a or b or c > 0
        a or b or c < 0
        if s1 == 0 and s2 == 0:
            print(f1(a,b,c))
        if s1 ==0 and s2 == 1:
            print(f2(a,b,c))
        if s1 ==1 and s2 == 0:
            print(f3(a,b,c))
        if s1 ==1 and s2 == 1:
            print(f4(a,b,c))
        else:
            print("Error")
    
exec(input().strip()) 

6531022621
# 1639491, 2022-09-24 09:31:37, xxxx[xx][xxxx] (0%)

def f1(a, b, c):
    n = min(f1) and n > 0
    return int(n)
def f2(a, b, c):
    k = min(f2) and k > 0
    return k
def f3(a, b, c):
    p = [int(sum(f3))]
    P = int(p[0])
    return P
def f4(a, b, c):
    e = [int(sum(f4))]
    E = int(e[n])
    return E
def main():
    s1,s2,a,b,c = int(input()).split()
    if s1 == 0 and s2 == 0 :
        return n
    if s1 == 0 and s2 == 1 :
        return k
    if s1 == 1 and s2 == 0 :
        return P
    if s1 == 1 and s2 == 1 :
        return E
    else :
        print("ERROR")
exec(input().strip()) 
# 1641657, 2022-09-24 10:26:26, ----[--][----] (0%)

def f1(a, b, c):
    if a < 0 : 
        n = min(b,c)
        return n 
    if b < 0 : 
        n = min(a,c)
        return n
    if c < 0 : 
        n = min(a,b)
        return n
def f2(a, b, c):
    if a > 0 : 
        n = max(b,c)
        return n 
    if b > 0 : 
        n = max(a,c)
        return n
    if c > 0 : 
        n = max(a,b)
        return n
    if (a or b or c)< 0 :
        k = max(a,b,c) 
        return k
def f3(a, b, c):
    a = sum((a,b,c))
    p =str(a)
    if p[0] == "-" :
        return p[1]
    if p[0] != "-" :
        return p[0]
def f4(a, b, c):
    a = sum((a,b,c))
    p =str(a)
    return p[-1]
# 1641689, 2022-09-24 10:27:06, ----[xx][xxxx] (0%)

def f1(a, b, c):
    if a < 0 : 
        n = min(b,c)
        return n 
    if b < 0 : 
        n = min(a,c)
        return n
    if c < 0 : 
        n = min(a,b)
        return n
def f2(a, b, c):
    if a > 0 : 
        n = max(b,c)
        return n 
    if b > 0 : 
        n = max(a,c)
        return n
    if c > 0 : 
        n = max(a,b)
        return n
    if (a or b or c)< 0 :
        k = max(a,b,c) 
        return k
def f3(a, b, c):
    a = sum((a,b,c))
    p =str(a)
    if p[0] == "-" :
        return p[1]
    if p[0] != "-" :
        return p[0]
def f4(a, b, c):
    a = sum((a,b,c))
    p =str(a)
    return p[-1]
def main():
    s1,s2,a,b,c = int(input()).split()
    if s1 == 0 and s2 == 0 :
        return n
    if s1 == 0 and s2 == 1 :
        return k
    if s1 == 1 and s2 == 0 :
        return P
    if s1 == 1 and s2 == 1 :
        return E
    else :
        print("ERROR")
exec(input().strip())

6431527121
# 1642393, 2022-09-24 10:38:13, x---[--][----] (0%)

def f1(a, b, c):
    return min(f1)

# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่าน้อยท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
def f2(a, b, c):
    return max(a,b,c)

# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
def f3(a, b, c):
    pass
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเคร่ืองหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
def f4(a, b, c):
    pass
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
def main():
    pass
# รับข้อมูลจากคีย์บอร์ดเป็นจํานวนเต็ม 5 จํานวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกําหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c) # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c) # ถ้าs1 หรือs2 เป็นค่าอ่ืนให้แสดงคําว่าError
exec(input().strip()) # DON'T remove this line

# 1642464, 2022-09-24 10:39:02, ----[--][----] (0%)

def f1(a, b, c):
    return min(a,b,c)

# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่าน้อยท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
def f2(a, b, c):
    return max(a,b,c)

# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
def f3(a, b, c):
    pass
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเคร่ืองหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
def f4(a, b, c):
    pass
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
def main():
    pass
# รับข้อมูลจากคีย์บอร์ดเป็นจํานวนเต็ม 5 จํานวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกําหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c) # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c) # ถ้าs1 หรือs2 เป็นค่าอ่ืนให้แสดงคําว่าError
exec(input().strip()) # DON'T remove this line


6431533921
# 1641624, 2022-09-24 10:25:53, xxxx[xx][PxPx] (0%)

def f1(a, b, c):
    a = list(int(input()))
    b = list(int(input()))
    c = list(int(input()))
    a.append(b)
    a.append(c)
    y = a[0]
    z = a[1]
    v = a[2]
    if y > o and y == min(a):
        return y
    elif z > 0 and z == min(a):
        return z
    elif v > 0 and v == min(a):
        return v
    else:
        pass
 
def f2(a, b, c):
    a = int(input())
    b = int(input())
    c = int(input())
    a.append(b)
    a.append(c)
    y = a[0]
    z = a[1]
    v = a[2]
    if y < o and y == max(a):
        return y
    elif z < 0 and z == max(a):
        return z
    elif v < 0 and v == max(a):
        return v
    else:
        pass
    
def f3(a, b, c):
    a = int(input())
    b = int(input())
    c = int(input())
    x = a+b+c
    for i in range(len(x)):
        x = list(x)
    return x[0]
    
def f4(a, b, c):
    a = int(input())
    b = int(input())
    c = int(input())
    x = a+b+c
    for i in range(len(x)):
        x = list(x)
    return x[-1]
 
def main():
    s1,s2,a,b,c = input().split()
    s1 = int(s1)
    s2 = int(s2)
    a = int(a)
    b = int(b)
    c = int(c)
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f4(a,b,c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line
# 1642104, 2022-09-24 10:34:22, xxxx[xx][PxPx] (0%)

def f1(a, b, c):
    a = list(input())
    b = list(input())
    c = list(input())
    a.append(b)
    a.append(c)
    y = a[0]
    z = a[1]
    v = a[2]
    if y > o and y == min(a):
        return y
    elif z > 0 and z == min(a):
        return z
    elif v > 0 and v == min(a):
        return v
    else:
        pass
 
def f2(a, b, c):
    a = list(input())
    b = list(input())
    c = list(input())
    a.append(b)
    a.append(c)
    y = a[0]
    z = a[1]
    v = a[2]
    if y < o and y == max(a):
        return y
    elif z < 0 and z == max(a):
        return z
    elif v < 0 and v == max(a):
        return v
    else:
        pass
    
def f3(a, b, c):
    a = int(input())
    b = int(input())
    c = int(input())
    x = a+b+c
    for i in range(len(x)):
        x = list(x)
    return x[0]
    
def f4(a, b, c):
    a = int(input())
    b = int(input())
    c = int(input())
    x = a+b+c
    for i in range(len(x)):
        x = list(x)
    return x[-1]
 
def main():
    s1,s2,a,b,c = input().split()
    s1 = int(s1)
    s2 = int(s2)
    a = int(a)
    b = int(b)
    c = int(c)
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    elif s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    elif s1 == 1 and s2 == 0:
        print(f4(a,b,c))
    else:
        print("Error")
    
exec(input().strip()) # DON'T remove this line


6530095221
# 1642176, 2022-09-24 10:35:26, compilation error (0%)

a,b,c = [int(input(e))]
-1000 <= e <= 1000
def f1(a, b, c):
    a,b,c = [int(input(e))]
    x = a,b,c and x > 0
    print(min(x))
return f1

    
# 1642356, 2022-09-24 10:37:42, compilation error (0%)

a,b,c = [int(input(e))]
-1000 <= e <= 1000
def f1(a, b, c):
    a,b,c = [int(input(e))]
    x = a,b,c and x > 0
    print(min(x))
return f1

6530107121
# 1640294, 2022-09-24 09:53:28, ----[xx][P-P-] (0%)

def f1(a, b, c):
    x = [a,b,c]
    if a<0:
        x.remove(a) 
    if b<0:
        x.remove(b)
    if c<0:
        x.remove(c)
    if len(x) == 1:
        return x[0]
    else:
        for i in range(1,len(x)):
            min = x[0]
            if x[i]<min:
                min = x[i]
            return min  
def f2(a, b, c):
    x = [a,b,c]
    if a>0:
        x.remove(a) 
    if b>0:
        x.remove(b)
    if c>0:
        x.remove(c)
    if len(x) == 1:
        return x[0]
    else:
        for i in range(1,len(x)):
            max = x[0]
            if x[i] > max:
                max = x[i]
            return max  
def f3(a, b, c):
    x = str(abs(int(a)+int(b)+int(c)))
    return x[0]

def f4(a, b, c):
     x = str(int(a)+int(b)+int(c))
     return x[-1]
def main():
    p = input().split()
    a,b,c = p[2],p[3],p[4]
    if p[0] == '0' and p[1] == '0':
        print(f1(a, b, c))
    if p[0] == '0' and p[1] == '1':
        print(f2(a, b, c))
    if p[0] == '1' and p[1] == '0':
        print(f3(a, b, c))
    if p[0] == '1' and p[1] == '1':
        print(f4(a, b, c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line

# 1640408, 2022-09-24 09:57:05, ----[-x][P-P-] (0%)

def f1(a, b, c):
    x = [int(a),int(b),int(c)]
    if int(a)<0:
        x.remove(int(a)) 
    if int(b)<0:
        x.remove(int(b))
    if int(c)<0:
        x.remove(int(c))
    if len(x) == 1:
        return x[0]
    else:
        for i in range(1,len(x)):
            min = x[0]
            if x[i]<min:
                min = x[i]
            return min  
def f2(a, b, c):
    x = [a,b,c]
    if a>0:
        x.remove(a) 
    if b>0:
        x.remove(b)
    if c>0:
        x.remove(c)
    if len(x) == 1:
        return x[0]
    else:
        for i in range(1,len(x)):
            max = x[0]
            if x[i] > max:
                max = x[i]
            return max  
def f3(a, b, c):
    x = str(abs(int(a)+int(b)+int(c)))
    return x[0]

def f4(a, b, c):
     x = str(int(a)+int(b)+int(c))
     return x[-1]
def main():
    p = input().split()
    a,b,c = p[2],p[3],p[4]
    if p[0] == '0' and p[1] == '0':
        print(f1(a, b, c))
    if p[0] == '0' and p[1] == '1':
        print(f2(a, b, c))
    if p[0] == '1' and p[1] == '0':
        print(f3(a, b, c))
    if p[0] == '1' and p[1] == '1':
        print(f4(a, b, c))
    else:
        print('Error')
exec(input().strip()) # DON'T remove this line


6530119721
# 1639818, 2022-09-24 09:40:19, ----[--][----] (0%)

def f1(a, b, c):
    a,b,c >= 0
    return a

# 1641858, 2022-09-24 10:30:06, compilation error (0%)

def f1(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    
def f2(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    
def f3(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c

def f4(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c

def main():
    # รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
    # ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
    # ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
    # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
    # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
    # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
    # ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error

exec(input().strip()) # DON'T remove this line







6530144321
# 1640099, 2022-09-24 09:48:03, xxxx[xx][xxxx] (0%)

def f1(a, b, c):
    x=[]
    if a>0:
        a.append(x)
    if b>0:
        b.append(x)
    if c>0:
        c.append(x)
    x.sort()
    return min(x)
######
def f2(a, b, c):
    x=[]
    if a<0:
        a.append(x)
    if b<0:
        b.append(x)
    if c<0:
        c.append(x)
    x.sort()
    return max(x)
######
def f3(a, b, c):
    x=[]
    y=a+b+c
    abs.y.append(x)
    ().join(x)
    return x[0]
#####
def f4(a, b, c):
    x=[]
    y=a+b+c
    abs.y.append(x)
    ().join(x)
    return x[-1]
#####
def main():
    x=input.split()
    if s1==0 and s2 == 0:
        print(f1(a, b, c))
    if s1==0 and s2 == 1:
        print(f2(a, b, c))
    if s1==1 and s2 == 0:
        print(f3(a, b, c))
    if s1==1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line
# 1642400, 2022-09-24 10:38:17, xxxx[xx][xxxx] (0%)

def f1(a, b, c):
    x=[]
    if int(a)>0:
        a.append(x)
    if int(b)>0:
        b.append(x)
    if int(c)>0:
        c.append(x)
    return min(x)
def f2(a, b, c):
    x=[]
    if int(a)<0:
        a.append(x)
    if int(b)<0:
        b.append(x)
    if int(c)<0:
        c.append(x)
    return max(x)
def f3(a, b, c):
    x=[]
    y=a+b+c
    y=str(abs.y)
    y.append(x)
    ().join(x)
    return x[0]
def f4(a, b, c):
    x=[]
    y=a+b+c
    y=str(abs.y)
    y.append(x)
    ().join(x)
    return x[-1]
def main():
    x=input.split()
    if x[0]==0 and x[1] == 0:
        print(f1(a, b, c))
    if x[0]==0 and x[1] == 1:
        print(f2(a, b, c))
    if x[0]==1 and x[1] == 0:
        print(f3(a, b, c))
    if x[0]==1 and x[1] == 1:
        print(f4(a, b, c))
    else:
        print("Error")
exec(input().strip()) # DON'T remove this line


6530189621
# 1641401, 2022-09-24 10:21:26, xxxx[xx][xxxx] (0%)

x=input()
a=[]
b=[]
c=''
d=0
for i in range(len(x)):
    if '0'<=x[i]<='9':
        c+=x[i]
        if len(x)==i:
            c+=x[i]
            a.append(c)     
    else:
        a.append(c)
        c=''
   
    if x[i]=='+':
        b.append(x[i])
    elif x[i]=='-':
        b.append(x[i])

if x[0]=='-':
    for i in range(1,len(b)):
        if b[i]=='-':
            d-=int(a[i])
        elif b[i]=='+':
            d+=int(a[i])
else:
    d+=int(a[0])
    for i in range(len(b)-1):
        if b[i]=='-':
            d-=int(a[i+1])
        else:
            d+=int(a[i+1])
if b[len(b)-1]=="-":
    d-=int(c)
elif b[len(b)-1]=="+":
    d+=int(c)



print(d)
    
        


# 1641541, 2022-09-24 10:24:26, xxxx[--][----] (0%)

x=input()
a=[]
b=[]
c=''
d=0
for i in range(len(x)):
    if '0'<=x[i]<='9':
        c+=x[i]
        if len(x)==i:
            c+=x[i]
            a.append(c)     
    else:
        a.append(c)
        c=''
   
    if x[i]=='+':
        b.append(x[i])
    elif x[i]=='-':
        b.append(x[i])
if len(b)==0:
    print(x)
else:
    if x[0]=='-':
        for i in range(1,len(b)):
            if b[i]=='-':
                d-=int(a[i])
            elif b[i]=='+':
                d+=int(a[i])
    else:
        d+=int(a[0])
        for i in range(len(b)-1):
            if b[i]=='-':
                d-=int(a[i+1])
            else:
                d+=int(a[i+1])
    if b[len(b)-1]=="-":
        d-=int(c)
    elif b[len(b)-1]=="+":
        d+=int(c)
    print(d)
    
        



6531024921
# 1641076, 2022-09-24 10:14:33, ----[--][----] (0%)

def f1(a, b, c):
    y = (a, b, c)
    for n in y:
        n > 0
    n = min(a, b, c)
    print(n)
    
def f2(a, b, c):
    y = (a, b, c)
    for m in y:
        m < 0
    m = max(a, b, c)
    print(m)
    
def f3(a, b, c):
    k = abs(a + b + c)
    print(k[0])
      
def f4(a, b, c):
    i = abs(a + b + c)
    print(i[-1])
    
def main():
    s1 = int(input())
    s2 = int(input())
    x = [s1, s2, a, b, c]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print(Error)
# 1642039, 2022-09-24 10:33:25, ----[--][----] (0%)

def f1(a, b, c):
    y = (a, b, c)
    for n in y:
        n > 0
    n = min(a, b, c)
    print(n)
    
def f2(a, b, c):
    y = (a, b, c)
    for m in y:
        m < 0
    m = max(a, b, c)
    print(m)
    
def f3(a, b, c):
    k = abs(a + b + c)
    print(k[0])
      
def f4(a, b, c):
    i = abs(a + b + c)
    print(i[-1])
    
def main():
    s1 = int(input())
    s2 = int(input())
    x = [s1, s2, a, b, c]
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    if s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    if s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    if s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        print(Error)

6531029021
# 1640234, 2022-09-24 09:51:46, xxxx[xx][xxxx] (0%)

def f1(a, b, c):
 for a,b,c in range(1,1000) :
  return(min(a,b,c))
def f2(a, b, c):
 for a,b,c in range(-1000,-1) :   
    return(max(a,b,c))   
def f3(a, b, c):
 for a,b,c in range(-1000,1000) : 
  k = abs(a+b+c)
  return(k[0])
def f4(a, b, c):
 for a,b,c in range(-1000,1000) :   
  k = abs(a+b+c)
  return(k[-1])
def main():
  s1,s2,a,b,c,d = [int(e) for e in input().split()]
  for a,b,c in range(-1000,1000) :
   if s1 == 0 and s2 == 0 :
      print(f1(a, b, c))
   if s1 == 0 and s2 == 1 :
      print(f2(a, b, c))
   if s1 == 1 and s2 == 0 :
      print(f3(a, b, c))
   if s1 == 1 and s2 == 1 :
      print(f4(a, b, c))
   else :
      print('Error')
exec(input().strip()) 
# 1642328, 2022-09-24 10:37:26, --xx[xx][xxxx] (0%)

def f1(a, b, c):   
 for i in range(-1000,1000):
  return(min(a,b,c))
def f2(a, b, c):
 for i in range(-1000,1000) :   
    return(max(a,b,c))   
def f3(a, b, c):
 for i in range(-1000,1000) :
   k == abs(a+b+c)   
   return(k[0])
 for i in range(-1000,1000) :   
   k == abs(a+b+c)
   return(k[-1])
def main():
  s1,s2,a,b,c = [int(e) for e in input().split()]
  for a,b,c in range(-1000,1000) :
   if s1 == 0 and s2 == 0 :
      print(f1(a, b, c))
   if s1 == 0 and s2 == 1 :
      print(f2(a, b, c))
   if s1 == 1 and s2 == 0 :
      print(f3(a, b, c))
   if s1 == 1 and s2 == 1 :
      print(f4(a, b, c))
   else :
      print('Error')
exec(input().strip()) 

6531107321
# 1641176, 2022-09-24 10:17:04, --xx[xx][xxxx] (0%)

def f1(a,b,c):  
    if a > 0:
        n = a
        if n >= b:
            n = b
        elif n >= c:
            n=c
    elif b > 0:
        n = b
        if n >= a:
            n = a
        elif n >= c:
            n=c
    elif c > 0:
        n = c
        if n >= b:
            n = b
        elif n >= b:
            n=b
    return n



def f2(a,b,c):
    if a <0:
        n = a
        if n <= b:
            n = b
        elif n <= c:
            n=c
    elif b < 0:
        n = b
        if n <= a:
            n = a
        elif n <= c:
            n=c
    elif c < 0:
        n = c
        if n <= b:
            n = b
        elif n <= b:
            n=b
    return n


exec(input().strip())

        
        
        
# 1641195, 2022-09-24 10:17:26, x-xx[xx][xxxx] (0%)




def f2(a,b,c):
    if a <0:
        n = a
        if n <= b:
            n = b
        elif n <= c:
            n=c
    elif b < 0:
        n = b
        if n <= a:
            n = a
        elif n <= c:
            n=c
    elif c < 0:
        n = c
        if n <= b:
            n = b
        elif n <= b:
            n=b
    return n


exec(input().strip())

6231010821
# 1641100, 2022-09-24 10:15:20, xxxx[xx][xxxx] (0%)

def f1(a,b,c):
    x = min(f1) 
    return int(x)
def f2(a,b,c):
    x = max(f2)
    return int(x)
def f3(a,b,c):
    x = a+b+c
    return int(x[0])
def f4(a,b,c):
    x = a+b+c
    return int(x[-1])
    
def main():
    if s1 == 0 and s2 == 0:
        print(f1(a,b,c))
    if s1 == 0 and s2 == 1:
        print(f2(a,b,c))
    if s1 == 1 and s2 == 0:
        print(f3(a,b,c))
    if s1 == 1 and s2 == 1:
        print(f4(a,b,c))
    else :
        print("Error")

exec(input().strip())

6331231221
# 1642111, 2022-09-24 10:34:33, -xxx[xx][xxxx] (0%)

import math
def f1(a, b, c):
    return(math.floor(2))
    
exec(input().strip()) # DON'T remove this line


6431141521
# 1641473, 2022-09-24 10:23:08, xxxx[xx][xxxx] (0%)

def f1(a, b, c):
    if a > 0:
        if b > 0 :
            if c > 0 :
               x = min(a,b,c)
    else:
        pass
    return int(x)
def f2(a, b, c):
    if a > 0:
        if b > 0 :
            if c > 0 :
                d = max(a,b,c)
    else:
        pass
    return int(d)
#def f3(a, b, c):
a,b,c = 2 ,-18 , 4
print(int(x))
    


        
    


6431149621
# 1642438, 2022-09-24 10:38:42, compilation error (0%)

def f1(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่าน้อยท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
    mn = a
    if b < mn : mn = b
    if c < mn : mn = c
    print(mn)
def f2(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็มที่มีค่าเท่ากับค่ามากท่ีสุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
    mx = a
    if b > mx : mx = b
    if c > mx : mx = c
    print(mx) 
def f3(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเคร่ืองหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
def f4(a, b, c):
# a, b และ c มีค่าตามข้อกําหนดข้างบน
# คืนจํานวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
def main():
# รับข้อมูลจากคีย์บอร์ดเป็นจํานวนเต็ม 5 จํานวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
# ค่าของ a, b และ c เป็นไปตามข้อกําหนดข้างบน
# ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c) # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c) # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c) # ถ้าs1 หรือs2 เป็นค่าอ่ืนให้แสดงคําว่าError
s1,s2,a,b,c = [int(e) for e in input().split()]
if s1 == 0 and s2 == 0:
    print(def f1(a, b, c))
elif s1 == 0 and s2 == 1:
    print(def f2(a, b, c))
elif s1 == 1 and s2 == 0:
    print(def f3(a, b, c))
elif s1 == 1 and s2 == 1:
    print(def f4(a, b, c))
else :
    print('Error')
    
exec(input().strip()) # DON'T remove this line

6431517921
# 1639974, 2022-09-24 09:44:21, xxxx[x-][P-P-] (0%)

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
        if s1==0 and s2==1:
            print(f2(a, b, c))
            if s1==1 and s2==0:
                print(f3(a, b, c))
                if s1==1 and s2==1:
                    print(f4(a, b, c))
    else:
        print("Error")
              
    
   
exec(input().strip()) #Don't remove this line

6431137021
# 1641708, 2022-09-24 10:27:24, ----[--][----] (0%)

def f1(a, b, c):
    if a or b or c > 0:
        mn = a
        if b < mn:
            mn = b
        if c < mn:
            mn = c
    return mn

def f2(a, b, c):
    if a or b or c < 0:
        mx = a
        if b > mx:
            mx = b
        if c > mx:
            mx = c
    return mx

6530001221
# 1640947, 2022-09-24 10:11:07, compilation error (0%)

def f1(a,b,c) :
    a = int(a)
    b = int(b)
    c = int(c)
    y = min[a,b,c]
    if y > 0 :
        return y
def f2(a,b,c) :
    a = int(a)
    b = int(b)
    c = int(c)
    u = max[a,b,c]
    if u<o :
        return u
def f3(a,b,c) :
    a = int(a)
    b = int(b)
    c = int(c)
    a = abs(a)
    b = abs(b)
    c = abs(c)
    x = a+b+c
    y = str(x)
    z = y[0]
    return z
def f4(a,b,c) :
    a = int(a)
    b = int(b)
    c = int(c)
    a = abs(a)
    b = abs(b)
    c = abs(c)
    x = a+b+c
    y = str(x)
    z = y[-1]
    return z
def main() :
    s1,s2,a,b,c = [int(e) for e in input(). split()]
    a = int(a)
    b = int(b)
    c = int(c)
    if s1 == 0 and s2 == 0 :
        print(f1(a,b,c))
    if s1 == 0 and s2 ==1 :
        print(f2(a,b,c))
    if s1 ==1 and s2 == 0 :
        print(f3(a,b,c))
    if s1 = 1 and s2 = 1 :
        print(f4(a,b,c))
    if s1 != 0 or s1 != 1 and s2 != 0 or s2 != 1 :
        print('Error')

6530002921
# 1641667, 2022-09-24 10:26:36, xxx-[xx][PxPx] (0%)

def f1(a, b, c):
    -1000<=a<=1000
    -1000<=b<=1000
    -1000<=c<=1000
    if a>0:
        return(int(min(a)))
    if b>0:
        return(int(min(b)))
    if c>0:
        return(int(min(c)))


def f2(a, b, c):
    -1000<=a<=1000
    -1000<=b<=1000
    -1000<=c<=1000
    if a<0:
        return(int(max(a)))
    if b<0:
        return(int(max(b)))
    if c<0:
        return(int(max(c)))
def f3(a, b, c):
    -1000<=a<=1000
    -1000<=b<=1000
    -1000<=c<=1000
    return(int(abs((a+b+c)//10**(len(a+b+c)))))
    

def f4(a, b, c):
    -1000<=a<=1000
    -1000<=b<=1000
    -1000<=c<=1000
    return(int(abs((a+b+c)%10)))

def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    if s1==0 and s2==1:
        print(f2(a, b, c))
    if s1==1 and s2==0:
        print(f3(a, b, c))
    if s1==1 and s2==1:
        print(f4(a, b, c))
    else:
        print("Error")

exec(input().strip()) 

6530011521
# 1639902, 2022-09-24 09:42:31, ----[--][----] (0%)

def f1(a, b, c):
    if a>0 and b>0 and c>0:
        x = min([a, b, c])
    elif a>0 and b>0 and c<=0:
        x = min([a, b])
    elif a>0 and b<=0 and c>0:
        x = min([a, c])
    elif a<=0 and b>0 and c>0:
        x = min([a, b])
    elif a<=0 and b<=0 and c>0:
        x = c
    elif a<=0 and b>0 and c<=0:
        x = b
    elif a>0 and b<=0 and c<=0:
        x = a
    return x
print(f1(2, -18, 4))


6530025321
# 1640472, 2022-09-24 09:58:47, compilation error (0%)

x = int(input()).split( )
exec(input().strip())
def main():
    if s1 = 0, s2 = 0 :
        print(f1(a, b, c))

6531203921
# 1642038, 2022-09-24 10:33:24, compilation error (0%)

def f1(a, b, c):

    # a, b และ c มีค่าตามข้อกำหนดข้างบน

    # คืนจำนวนเต็มที่มีค่าเท่ากับค่าน้อยที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่ามากกว่า 0
def f2(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็มที่มีค่าเท่ากับค่ามากที่สุดของ a, b และ c คิดเฉพาะตัวที่มีค่าน้อยกว่า 0
def f3(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน
    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักแรก (ซ้ายสุด) ของผลบวกของ a, b และ c
def f4(a, b, c):
    # a, b และ c มีค่าตามข้อกำหนดข้างบน

    # คืนจำนวนเต็ม (ไม่มีเครื่องหมาย) ที่เป็นตัวเลขหลักสุดท้าย (ขวาสุด) ของผลบวกของ a, b และ c
def main():
    # รับข้อมูลจากคีย์บอร์ดเป็นจำนวนเต็ม 5 จำนวน s1 s2 a b c คั่นด้วยช่องว่างในบรรทัดดียวกัน
    # ค่าของ a, b และ c เป็นไปตามข้อกำหนดข้างบน
    # ถ้า s1 เป็น 0 และ s2 เป็น 0 ให้ print ค่าของ f1(a, b, c)
    # ถ้า s1 เป็น 0 และ s2 เป็น 1 ให้ print ค่าของ f2(a, b, c)
    # ถ้า s1 เป็น 1 และ s2 เป็น 0 ให้ print ค่าของ f3(a, b, c)
    # ถ้า s1 เป็น 1 และ s2 เป็น 1 ให้ print ค่าของ f4(a, b, c)
    # ถ้า s1 หรือ s2 เป็นค่าอื่น ให้แสดงคำว่า Error
exec(input().strip()) # DON'T remove this line

6531408221
# 1642110, 2022-09-24 10:34:32, xxxx[xx][xxxx] (0%)

def f1(a, b, c):
    x = [a,b,c]
    if 0 < int(x[i]) <= 1000:
        x += x[i]
    return min(int(x[i]))

def f2(a, b, c):
    m = [a,b,c]
    if -1000 <= int(m[i]) < 0:
        m += m[i]
    return max(int(m[i]))

def f3(a, b, c):
    k = [a,b,c]
    if -1000 <= int(k[i]) <= 1000:
        s = a+b+c
    return s[0]
        
def f4(a, b, c):
    p = [a,b,c]
    if -1000 <= int(p[i]) <= 1000:
        s = a+b+c
    return s[-1]

def main():
    s1,s2,a,b,c = input().split()
    if -1000 < int(a,b,c) <= 1000:
        if s1 == '0' and s2 == '0':
            print(f1(a, b, c))
        elif s1 == '0' and s2 == '1':
            print(f2(a, b, c))
        elif s1 == '1' and s2 == '0':
            print(f3(a, b, c))
        elif s1 == '1' and s2 == '1':
            print(f4(a, b, c))
        else:
            print("Error")
            
exec(input().strip()) # DON'T remove this line

6531506021
# 1641306, 2022-09-24 10:19:37, compilation error (0%)

a = int(input())
b = int(input())
c = int(input())
a>= 1000 and a<= -1000
b>= 1000 and b<= -1000
c>= 1000 and c<= -1000
def f1(a, b, c):
    return f1(max>0)
def f2(a, b, c):
    return f2 (max<0)

def f3(a, b, c):
    return f3(sum)

def f4(a, b, c):
    return f4(sum)
def main():

x = f1
y = f2
z = f3
g = f4
print(x , y , z , g) 
exec(input().strip()) # DON'T remove this line

6531512821
# 1640454, 2022-09-24 09:58:26, xxxx[--][x-x-] (0%)

def f1(a, b, c):
    nf = []
    for i in f1:
        if i>0:
            nf+=[i]
        e=0
        e+=min(nf)
        return e 
        
def f2(a, b, c):
    r=0
    r+=max(f2)
    return r
def f3(a, b, c):
    t=sum(f3)
    t=str(t)
    p=0
    p+=(t0)
    return p
def f4(a, b, c):
    s=0
    s+=sum(f4)
    ls=0
    ls+=s%10
    return ls
def main():
    s1,s2,a,b,c = [float(e) for e in input().split()]
    if s1 == 0 and s2==0:
        print(f1)
    elif s1 == 0 and s2==1:
        print(f2)
    elif s1 == 1 and s2==0:
        print(f3)
    elif s1 == 1 and s2==1:
        print(f4)
    else:
        print(Error)
    
    
exec(input().strip()) # DON'T remove this line

6531518621
# 1642200, 2022-09-24 10:35:48, ----[--][----] (0%)

def f1(a,b,c) :
    if 0<=a<=1000:
        min_f1 = a
    elif 0<=b<=1000 and b<a :
        min_f1 = b
    elif 0<=c<=1000 and c<b :
        min_f1 = c
        return min_f1
s = f1(2,-18,4)
print(s)


def f2(a,b,c) :
    max_f2 = a
    if -1000<=a<=0:
        max_f2 = a
    elif -1000<=b<=0 and b>a :
        max_f2 = b
    elif -1000<=c<=0 and c>b :
        max_f2 = c
        return max_f2
p = f2(-20,-18,4)
print(p)
    
    

6531520821
# 1640379, 2022-09-24 09:56:08, xxxx[xx][xxxx] (0%)

a = int(input())
print(a)





6531523721
# 1640809, 2022-09-24 10:07:41, compilation error (0%)

def f1 (a, b, c):
    -1000 <= a, b, c <= 1000
    a > 0 or b > 0 or c > 0 or a, b > 0 or a, c > 0 or b, c > 0/
    or a, b, c > 0
    a < 0 or b < 0 or c < 0 or a, b < 0 or a, c < 0 or b, c < 0/
    or a, b, c < 0
    if a, b, c < 0:
        break
    return min(a, b, c)
def f2(a, b, c):
    -1000 <= a, b, c <= 1000
    a > 0 or b > 0 or c > 0 or a, b > 0 or a, c > 0 or b, c > 0/
    or a, b, c > 0
    a < 0 or b < 0 or c < 0 or a, b < 0 or a, c < 0 or b, c < 0/
    or a, b, c < 0
    if a, b, c > 0:
        break
    return max(a, b, c)

def f3(a, b, c):
    -1000 <= a, b, c <= 1000
    a > 0 or b > 0 or c > 0 or a, b > 0 or a, c > 0 or b, c > 0/
    or a, b, c > 0
    a < 0 or b < 0 or c < 0 or a, b < 0 or a, c < 0 or b, c < 0/
    or a, b, c < 0
    x = a+b+c
    x.split()
    x.remove('-')
    return x[0]

def f4(a, b, c):
    -1000 <= a, b, c <= 1000
    a > 0 or b > 0 or c > 0 or a, b > 0 or a, c > 0 or b, c > 0/
    or a, b, c > 0
    a < 0 or b < 0 or c < 0 or a, b < 0 or a, c < 0 or b, c < 0/
    or a, b, c < 0
    x = a+b+c
    x.split()
    return x[-1]

    

def main():
    s1, s2, a, b, c = [int(e) for e in input().split()]
    -1000 <= a, b, c <= 1000
    a > 0 or b > 0 or c > 0 or a, b > 0 or a, c > 0 or b, c > 0/
    or a, b, c > 0
    a < 0 or b < 0 or c < 0 or a, b < 0 or a, c < 0 or b, c < 0/
    or a, b, c < 0
    if s1 = 0 and s2 = 0:
        print(f1(a, b, c))
    elif s1 = 0 and s2 = 1:
        print(f2(a, b, c))
    elif s1 = 1 and s2 = 0:
        print(f3(a, b, c))
    elif s1 = 1 and s2 = 1:
        print(f4(a, b, c))
    else:
        print(f1(a, b, c))
exec(input().strip())

6530039121
# 1642013, 2022-09-24 10:32:58, compilation error (0%)

def f1(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    d=[]
    if a>0:
        d+=[a]
    elif b>0:
        d+=[b]
    elif c>0:
        d+=[c]
    d.sort()
    e=d[0]
    
    
def f2(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    d=[]
    if a<0:
        d+=[a]
    elif b<0:
        d+=[b]
    elif c<0:
        d+=[c]
    d.sort()
    e=d[0]
    
    
def f3(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    d=[]
    if 

def f4(a, b, c):
    a=int(a)
    b=int(b)
    c=int(c)
    d=[]
    if





def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a, b, c))
    elif s1==0 and s2==1:
        print(f2(a, b, c))
    elif s1==1 and s2==0:
        print(f3(a, b, c))
    elif s1,s2==1:
        print(f4(a, b, c))
    else:
        print(Error)
exec(input().strip()) # DON'T remove this line    


6530074021
# 1642430, 2022-09-24 10:38:37, --xx[--][PxPx] (0%)

def f1(a, b, c):
    min1=0
    if int(a)>0:
        min1=int(a)
        if int(b)>0:
            if int(a)>int(b):
                min1=int(b)
                if int(c)>0:
                    if int(b)>int(c):
                        min1=int(c)
                        return min1
            
    

def f2(a, b, c):
    max1=0
    if a<0:
        max1=a
        if a<b:
            max1=b
            if b<c:
                max1=c
    return max1

def f3(a, b, c):
    d=a+b+c
    if d[0] =='-':
        return d[1]
    else:
        return d[0]

def f4(a, b, c):
    f=a+b+c
    return f[-1]

def main():
    s1,s2,a,b,c=[int(e) for e in input().split()]
    if s1==0 and s2==0:
        print(f1(a,b,c))
    elif s1==0 and s2==1:
        print(f2(a,b,c))
    elif s1==1 and s2==0:
        print(f3(a,b,c))
    elif s1==1 and s2==1:
        print(f4(a,b,c))
    else:
        print('Error')
    
exec(input().strip()) # DON'T remove this lin

6530079221
# 1641449, 2022-09-24 10:22:29, compilation error (0%)

def f1(a,b,c):
    h=[]
    for c in [a,b,c]:
        if c > 0:
            h.append(c)
    
    
    k=min(h)
    return k

def f2(a,b,c):
    h=[]
    for c in [a,b,c]:
        if c < 0:
            h.append(c)
    
    
    k=max(h)
    return k
      
    
def f3(a,b,c):
    s=0
    for c in [a,b,c]:
        s+=c
    return str(abs(s))[0]
    
   
def f4(a,b,c):
    s=0
    for c in [a,b,c]:
        s+=c
    return str(abs(s))[-1]
  exec(input().strip())

6530108821
# 1641863, 2022-09-24 10:30:08, compilation error (0%)

import math
a,b,c are perimeter of f1,f2,f3,f4
  -1000 =< a,b,c =< 1000 ; a,b,c = int
  
def f1(a,b,c) :
    if k = [a,b,c] :
print(min(k) for int(k) > 0 )
  
def f2(a,b,c) :
   if k = [a,b,c] :
print(max(k) for int(k) < 0)
         
def f3(a,b,c) :
   if x = a + b + c :
      y = x.index(0)
print(y)     

def f4(a,b,c) :
   if x = a + b + c :
      x = x % 10
print(x)

def main() :
  x = [s1,s2,a,b,c]
  y = (int(e) for e in x.split())
    if s1 = 0 , s2 = 0 :
       print(f1(a,b,c))
    if s1 = 0 , s2 = 1 :
       print(f2(a,b,c))
    if s1 = 1 , s2 = 0 :
       print(f3(a,b,c))
    if s1 = 1 , s2 = 1 :
       print(f4(a,b,c))
    else :
       print("Error")
        

6530120221
# 1641112, 2022-09-24 10:15:36, compilation error (0%)

min_a = int(input())
min_b = int(input())
min_c = int(input())
max_a = int(input())
max_b = int(input())
max_c = int(input())


a[-1000:1000:1] and b[-1000:1000:1] and c[-1000:1000:1]
a[i] > 0 or b[i] > 0 or c[i] > 0 or a[i] < 0 or b[i] < 0 or c[i] < 0


def f1(a, b, c):
     print(min_a, min_b, min_c)

def f2(a, b, c):
      print(max_a, max_b, max_c)


def f3(a, b, c):
     print(max_a, max_b, max_c)


def f4(a, b, c):
     print(max_a, max_b, max_c)


def main():
    s1,s2,a,b,c = [int(e) for e in input().split()]
    
    if s1=0 and s2=0 :
        print(f1(a, b, c))
    if s1=0 and s2=1 :
        print(f2(a, b, c))
    if s1=1 and s2=0 :
        print(f3(a, b, c))
    if s1=1 and s2=1 :
        print(f4(a, b, c))
    else :
        print("Error")
        
        

exec(input().strip()) # DON'T remove this line







6530122521
# 1642357, 2022-09-24 10:37:42, -xxx[xx][xxxx] (0%)

def f1(a,b,c):
    x = [a,b,c]
    if a <= 1000 and b <= 1000 and c <= 1000 and a >= -1000 and b >= -1000 and c >= -1000 :
        a = x[0]
        b = x[1]
        c = x[2]
        result = min(x) 
    else :
        print("Error")  
    return result        
exec(input().strip()) # DON'T remove this line


6530125421
# 1641124, 2022-09-24 10:15:54, xxxx[xx][xxxx] (0%)

s = input()
m = 0
for c in range(len(s)):
    if s[c] == '+':
        
        m += int(s[c+1])
    elif c == '-': 
        
        m += -1*int(s[c+1])
    else:
        m += int(s[c])
print((m-s[0])/2)




6530136321
# 1642427, 2022-09-24 10:38:35, xxxx[xx][xxxx] (0%)

def f1(a,b,c):
    while True:    
        if f1[i]>0:
            print(int(min(f1[0],f1[1],f1[2])))
def f2(a,b,c):
     while True:
         if i<0:
             print(int(max(f2[0],f1[1],f1[2])))
def f3(a,b,c):
        total = abs(sum(a,b,c))
        print(total[0])
def f4(a,b,c):
        total = abs(sum(a,b,c))
        print(total[-1])
def main():
    s1,s2,a,b,c = input().split()
    if s1 ==0 and s2 ==0 : print(f1(a,b,c))
    elif s1 ==0 and s2 ==1 : print(f2(a,b,c))
    elif s1 ==0 and s2 ==0 : print(f3(a,b,c))
    elif s1 ==0 and s2 ==0 : print(f4(a,b,c))
    else: print('Error')
print(main())

6530198221
# 1641491, 2022-09-24 10:23:35, ----[--][----] (0%)

def f1(a, b, c) :
    if a <= 0 :
        a=0
    elif b <= 0 :
        b=0
    elif c <= 0 :
        c =0
    if (a > b and a<c) or (a<b and a>c) :
        return a
    elif (b > a and b<c) or (b<a and b>c) :
        return b
    elif (c > b and c<a) or (c<b and c>a) :
        return c
    if a== 0 and b==0 :
        return c
    elif c== 0 and b==0 :
        return a
    elif a== 0 and c==0 :
        return b
    
    
def f2(a, b, c) :
    if a >= 0 :
        a=0
    elif b >= 0 :
        b=0
    elif c >= 0 :
        c =0
    if a== 0 and b==0 :
        return c
    elif c== 0 and b==0 :
        return a
    elif a== 0 and c==0 :
        return b
    if (a > b and a<c) or (a<b and a>c) :
        return a
    elif (b > a and b<c) or (b<a and b>c) :
        return b
    elif (c > b and c<a) or (c<b and c>a) :
        return c

6530211721
# 1639407, 2022-09-24 09:29:39, compilation error (0%)

def f1(a, b, c):

def f2(a, b, c):
def f3(a, b, c):

def f4(a, b, c):

def main():
  
  
  
  
  
  
  
  
  
exec(input().strip()) # DON'T remove this line

6531004321
# 1641324, 2022-09-24 10:19:58, ----[xx][xxxx] (0%)

def f1(a, b, c):
    min = 0
    if a < b and a < c:
        if a > min:
            min = a
    elif b < a and b < c:
            if b > min:
                min = b
    else:
        if c < a and c < b:
            if c > min:
                min = c
                
    return min
        
def f2(a, b, c):
    min = 0
    if a < b and a < c:
        if a < min:
            min = a
    elif b < a and b < c:
            if b < min:
                min = b
    else:
        if c < a and c < b:
            if c < min:
                min = c
                
    return min

def f3(a, b, c):
    x = str(a+b+c)
    return x[0]

def f4(a, b, c):
    x = str(a+b+c)
    return x[-1]


def main():
    x=int(input()).split()
    s1 = x[0]
    s2 = x[1]
    
    if s1 == 0 and s2 == 0:
        print(f1(a, b, c))
    elif s1 == 0 and s2 == 1:
        print(f2(a, b, c))
    elif s1 == 1 and s2 == 0:
        print(f3(a, b, c))
    elif s1 == 1 and s2 == 1:
        print(f4(a, b, c))
    else:
        s1 !=  0 and s1 != 1 and s2 != 0 and s2 != 1
        print('Error')
    
exec(input().strip()) # DON'T remove this line



6531006621
# 1642440, 2022-09-24 10:38:44, xxxx[xx][xxxx] (0%)

j

6531009521
# 1641054, 2022-09-24 10:13:56, --xx[xx][xxxx] (0%)

def f1(a, b, c):
    if a>b:
        if b<c:
            if b>0:
                return b
    if b>a:
        if a<c:
            if a>0:
                return a
    if a>c:
        if c<b:
            if c>0:
                return c
def f2(a, b, c):
    if a>b:
        if c<a:
            if a<0:
                return a
    if b>a:
        if c<b:
            if b<0:
                return b
    if c>b:
        if a<c:
            if c<0:
                return c
#def f3(a, b, c):
    
    

#def f4(a, b, c):
    
    

def main():
    d=[]
    a=d[2]
    b=d[3]
    c=d[4]
    if d[0] == 0 and d[1] == 0:
        print(f1(a,b,c))
    if d[0] == 0 and d[1] == 1:
        print(f1(a,b,c))
    if d[0] == 1 and d[1] == 0:
        print(f1(a,b,c))
    if d[0] == 1 and d[1] == 1:
        print(f1(a,b,c))
    if c[0] != 0 or c[0] != 1  and  c[1] != 0 or c[1] != 1:
        print('Error')
    
    
exec(input().strip()) # DON'T remove this line
    


6531023221
# 1641155, 2022-09-24 10:16:38, ----[--][----] (0%)

print(int(20))