2565_1_Quiz_1_2

Max Score = 100


# 0001, 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

# 0002, 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

# 0003, 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

# 0004, 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

# 0005, 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

# 0006, 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

# 0007, 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

# 0008, 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

# 0009, 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

# 0010, 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

# 0011, 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

# 0012, 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

# 0013, 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

# 0014, 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

# 0015, 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

# 0016, 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

# 0017, 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

# 0018, 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

# 0019, 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

# 0020, 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

# 0021, 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

# 0022, 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

# 0023, 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

# 0024, 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

# 0025, 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

# 0026, 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

# 0027, 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
# 0028, 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

# 0029, 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

# 0030, 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

# 0031, 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

# 0032, 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

# 0033, 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

# 0034, 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

# 0035, 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

# 0036, 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

# 0037, 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

# 0038, 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

# 0039, 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

# 0040, 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

# 0041, 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


# 0042, 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)
    

# 0043, 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)
# 0044, 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)
# 0045, 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)
# 0046, 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)
# 0047, 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)
# 0048, 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)
# 0049, 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)
# 0050, 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)
# 0051, 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)
# 0052, 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)
# 0053, 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)
# 0054, 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)
# 0055, 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)
# 0056, 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)
# 0057, 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
# 0058, 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
# 0059, 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)
# 0060, 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)
# 0061, 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)
# 0062, 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)
# 0063, 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)
# 0064, 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)
# 0065, 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)
# 0066, 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)
# 0067, 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)
# 0068, 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)
# 0069, 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)
# 0070, 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)

# 0071, 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

# 0072, 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
# 0073, 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
# 0074, 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
# 0075, 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
# 0076, 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
# 0077, 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
# 0078, 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
# 0079, 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
# 0080, 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
# 0081, 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
# 0082, 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
# 0083, 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
# 0084, 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
# 0085, 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
# 0086, 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
# 0087, 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
# 0088, 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
# 0089, 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
# 0090, 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
# 0091, 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
# 0092, 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
# 0093, 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
# 0094, 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
# 0095, 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
# 0096, 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

# 0097, 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)
        
    
# 0098, 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 

# 0099, 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 

# 0100, 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 

# 0101, 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 

# 0102, 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
# 0103, 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
# 0104, 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
# 0105, 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
# 0106, 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
# 0107, 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
# 0108, 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
# 0109, 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 

# 0110, 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 

# 0111, 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 

# 0112, 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 

# 0113, 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 

# 0114, 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 

# 0115, 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
# 0116, 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
# 0117, 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
# 0118, 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 

# 0119, 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
# 0120, 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

# 0121, 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

# 0122, 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

# 0123, 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

# 0124, 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

# 0125, 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

# 0126, 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

# 0127, 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

# 0128, 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

# 0129, 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
# 0130, 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
# 0131, 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

# 0132, 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

# 0133, 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

# 0134, 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
# 0135, 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
# 0136, 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

# 0137, 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
# 0138, 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
# 0139, 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
# 0140, 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

# 0141, 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
# 0142, 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


# 0143, 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())
# 0144, 2022-09-24 09:20:08, ----[--][----] (0%)

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

# 0145, 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())
# 0146, 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())
# 0147, 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())
# 0148, 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())
# 0149, 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())
# 0150, 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())
# 0151, 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())
# 0152, 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())
# 0153, 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())
# 0154, 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())
# 0155, 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())
# 0156, 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())
# 0157, 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())
# 0158, 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())
# 0159, 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())
# 0160, 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())
# 0161, 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())
# 0162, 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())
# 0163, 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())

# 0164, 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())
# 0165, 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())
# 0166, 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())
# 0167, 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())
# 0168, 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())
# 0169, 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())
# 0170, 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())
# 0171, 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())
# 0172, 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())
# 0173, 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())
# 0174, 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())
# 0175, 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())
# 0176, 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())
# 0177, 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())
# 0178, 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())
# 0179, 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())
# 0180, 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())
# 0181, 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())
# 0182, 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())
# 0183, 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())
# 0184, 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())

# 0185, 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())
# 0186, 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())
# 0187, 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())
# 0188, 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())
# 0189, 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())
# 0190, 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())
# 0191, 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())
# 0192, 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())
# 0193, 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())
# 0194, 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())
# 0195, 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())
# 0196, 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())
# 0197, 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())
# 0198, 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
# 0199, 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
# 0200, 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
# 0201, 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
# 0202, 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
# 0203, 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
# 0204, 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

# 0205, 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())

# 0206, 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())

# 0207, 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())
# 0208, 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())

# 0209, 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())

# 0210, 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())

# 0211, 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())
# 0212, 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())

# 0213, 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())

# 0214, 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())

# 0215, 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())

# 0216, 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())


# 0217, 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())
# 0218, 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())


# 0219, 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())
# 0220, 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())

# 0221, 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())
# 0222, 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())
# 0223, 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())
# 0224, 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())


# 0225, 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
# 0226, 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())
# 0227, 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())
# 0228, 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())
# 0229, 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())
# 0230, 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())
# 0231, 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())
# 0232, 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())
# 0233, 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())
# 0234, 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())
# 0235, 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())
# 0236, 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())
# 0237, 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())
# 0238, 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())
# 0239, 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())
# 0240, 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())
# 0241, 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())
# 0242, 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())
# 0243, 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())

# 0244, 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


# 0245, 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


# 0246, 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())
# 0247, 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())
# 0248, 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

# 0249, 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


# 0250, 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

# 0251, 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

# 0252, 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

# 0253, 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

# 0254, 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


# 0255, 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

# 0256, 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


# 0257, 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



# 0258, 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




# 0259, 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())
# 0260, 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())
# 0261, 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())

# 0262, 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())

# 0263, 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())
# 0264, 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())

# 0265, 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())
# 0266, 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
# 0267, 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())

# 0268, 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())

# 0269, 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())

# 0270, 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())
# 0271, 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())
# 0272, 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())

# 0273, 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
# 0274, 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
# 0275, 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




# 0276, 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
# 0277, 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




# 0278, 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




# 0279, 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




# 0280, 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
# 0281, 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
# 0282, 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

# 0283, 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
# 0284, 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

# 0285, 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

# 0286, 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


# 0287, 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())
# 0288, 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())
# 0289, 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())
# 0290, 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())
# 0291, 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())
# 0292, 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())
# 0293, 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())
# 0294, 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())
# 0295, 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())
# 0296, 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())
# 0297, 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())
# 0298, 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())
# 0299, 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())
# 0300, 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())

# 0301, 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()) 
# 0302, 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())
# 0303, 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())
# 0304, 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())
# 0305, 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())
# 0306, 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())
# 0307, 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())
# 0308, 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
# 0309, 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
# 0310, 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
# 0311, 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
# 0312, 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
# 0313, 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
# 0314, 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

# 0315, 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
# 0316, 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
# 0317, 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
# 0318, 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
# 0319, 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
# 0320, 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
# 0321, 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
# 0322, 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
# 0323, 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
# 0324, 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
# 0325, 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
# 0326, 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
# 0327, 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

# 0328, 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


# 0329, 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


# 0330, 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


# 0331, 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
# 0332, 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
# 0333, 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


# 0334, 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] ] 

# 0335, 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] ] 

# 0336, 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] ] 

# 0337, 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] ] 

# 0338, 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



# 0339, 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



# 0340, 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




# 0341, 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
# 0342, 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
# 0343, 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
# 0344, 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
# 0345, 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
# 0346, 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
# 0347, 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
# 0348, 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
# 0349, 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
# 0350, 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
# 0351, 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
# 0352, 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

# 0353, 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
        
# 0354, 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
        
# 0355, 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
# 0356, 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
        
# 0357, 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
# 0358, 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
# 0359, 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
# 0360, 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
# 0361, 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
        
# 0362, 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
# 0363, 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

# 0364, 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
# 0365, 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
# 0366, 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
# 0367, 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
# 0368, 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
# 0369, 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
# 0370, 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
# 0371, 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
# 0372, 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
# 0373, 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
# 0374, 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

# 0375, 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())
# 0376, 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())
# 0377, 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())
# 0378, 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())
# 0379, 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())
# 0380, 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())
# 0381, 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())
# 0382, 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())
# 0383, 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())
# 0384, 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())
# 0385, 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())

# 0386, 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())
# 0387, 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())
# 0388, 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())
# 0389, 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())
# 0390, 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())
# 0391, 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())
# 0392, 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())
# 0393, 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())
# 0394, 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())
# 0395, 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())
# 0396, 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())

# 0397, 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())
# 0398, 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())
# 0399, 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())
# 0400, 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())
# 0401, 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())
# 0402, 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())
# 0403, 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())
# 0404, 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())
# 0405, 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())
# 0406, 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())

# 0407, 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

# 0408, 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
# 0409, 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
# 0410, 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
# 0411, 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
# 0412, 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
# 0413, 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
# 0414, 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
# 0415, 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
# 0416, 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

# 0417, 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
# 0418, 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
# 0419, 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 
# 0420, 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
# 0421, 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
# 0422, 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
# 0423, 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
# 0424, 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
# 0425, 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

# 0426, 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())
# 0427, 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())
# 0428, 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())
# 0429, 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())

# 0430, 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())
# 0431, 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())
# 0432, 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())

# 0433, 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())
# 0434, 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())

# 0435, 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
# 0436, 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
# 0437, 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
    

# 0438, 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
    

# 0439, 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
# 0440, 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
# 0441, 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
# 0442, 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
# 0443, 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

# 0444, 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())

# 0445, 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())

# 0446, 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())

# 0447, 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())

# 0448, 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())


# 0449, 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())


# 0450, 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())
# 0451, 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())
# 0452, 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())



# 0453, 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()) 
# 0454, 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())
# 0455, 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())
# 0456, 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())
# 0457, 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())
# 0458, 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())
# 0459, 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())
# 0460, 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())
# 0461, 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())

# 0462, 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()) 

# 0463, 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()) 

# 0464, 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()) 

# 0465, 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())
# 0466, 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())
# 0467, 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()) 

# 0468, 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()) 

# 0469, 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())
# 0470, 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())

# 0471, 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())
# 0472, 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())
# 0473, 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())
# 0474, 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())
# 0475, 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())
# 0476, 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

# 0477, 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

# 0478, 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


# 0479, 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

# 0480, 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

# 0481, 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
# 0482, 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
# 0483, 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
# 0484, 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
# 0485, 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
# 0486, 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

# 0487, 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

# 0488, 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

# 0489, 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
# 0490, 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
# 0491, 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
# 0492, 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
# 0493, 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
# 0494, 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

# 0495, 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
# 0496, 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
# 0497, 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
# 0498, 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
# 0499, 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
# 0500, 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
# 0501, 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
# 0502, 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

# 0503, 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())
# 0504, 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())
# 0505, 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())
# 0506, 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())
# 0507, 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())
# 0508, 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())
# 0509, 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())
# 0510, 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())

# 0511, 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())

# 0512, 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())
# 0513, 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())

# 0514, 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())

# 0515, 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())

# 0516, 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())

# 0517, 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())

# 0518, 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())


# 0519, 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]
# 0520, 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]
# 0521, 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())
# 0522, 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())
# 0523, 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())
# 0524, 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())
# 0525, 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())
# 0526, 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())

# 0527, 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())

# 0528, 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())

# 0529, 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())

# 0530, 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())

# 0531, 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())

# 0532, 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())

# 0533, 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())

# 0534, 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())


# 0535, 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
# 0536, 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
# 0537, 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
# 0538, 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
# 0539, 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
# 0540, 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
# 0541, 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

# 0542, 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
    
    
# 0543, 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
# 0544, 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
# 0545, 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
# 0546, 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
# 0547, 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
# 0548, 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

# 0549, 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())
# 0550, 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())
# 0551, 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())
# 0552, 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())
# 0553, 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())
# 0554, 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())
# 0555, 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())

# 0556, 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
# 0557, 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
        
        
    
    
    
    


    
            

# 0558, 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
# 0559, 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
        
        
    
    
    
    


    
            

# 0560, 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
        
        
    
    
    
    


    
            

# 0561, 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
        
        
    
    
    
    


    
            

# 0562, 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
        
        
    
    
    
    


    
            


# 0563, 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







# 0564, 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







# 0565, 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







# 0566, 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








# 0567, 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








# 0568, 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

# 0569, 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


# 0570, 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())
# 0571, 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())
# 0572, 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())
# 0573, 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())
# 0574, 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())
# 0575, 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())
# 0576, 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())

# 0577, 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")
# 0578, 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()) 
# 0579, 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()) 
# 0580, 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()) 
# 0581, 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())
# 0582, 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())
# 0583, 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())

# 0584, 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
# 0585, 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
# 0586, 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
# 0587, 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
# 0588, 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
# 0589, 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
# 0590, 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

# 0591, 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()) 
# 0592, 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()) 
# 0593, 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()) 
# 0594, 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()) 
# 0595, 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()) 
# 0596, 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()) 
# 0597, 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()) 

# 0598, 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())
# 0599, 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())
# 0600, 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())
# 0601, 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())
# 0602, 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())
# 0603, 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())
# 0604, 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())

# 0605, 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())

# 0606, 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())

# 0607, 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())

# 0608, 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())

# 0609, 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())

# 0610, 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())

# 0611, 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())


# 0612, 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())
# 0613, 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())
# 0614, 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())

# 0615, 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())
# 0616, 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())
# 0617, 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())

# 0618, 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()) 

# 0619, 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())
# 0620, 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()) 

# 0621, 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()) 

# 0622, 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()) 

# 0623, 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()) 

# 0624, 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

        

# 0625, 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
# 0626, 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
# 0627, 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

        

# 0628, 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
# 0629, 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


# 0630, 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')
# 0631, 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())
# 0632, 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())
# 0633, 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')
# 0634, 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
# 0635, 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


# 0636, 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')
# 0637, 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())
# 0638, 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())
# 0639, 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())
# 0640, 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())
# 0641, 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())

# 0642, 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

# 0643, 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
# 0644, 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

# 0645, 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
# 0646, 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

# 0647, 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


# 0648, 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()) 

# 0649, 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()) 

# 0650, 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()) 

# 0651, 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()) 

# 0652, 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()) 

# 0653, 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()) 


# 0654, 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())


# 0655, 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())


# 0656, 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())


# 0657, 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())


# 0658, 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())


# 0659, 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())



# 0660, 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())

# 0661, 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())

# 0662, 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())

# 0663, 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())

# 0664, 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())

# 0665, 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())


# 0666, 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())
# 0667, 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())
# 0668, 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())
# 0669, 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())
# 0670, 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())
# 0671, 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())

# 0672, 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())
# 0673, 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())
# 0674, 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())
# 0675, 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())
# 0676, 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())
# 0677, 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())

# 0678, 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())
# 0679, 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())
# 0680, 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())
# 0681, 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())
# 0682, 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())
# 0683, 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())

# 0684, 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())
    

# 0685, 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())
# 0686, 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())
    

# 0687, 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())
# 0688, 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())
    

# 0689, 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())

# 0690, 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

# 0691, 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

# 0692, 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

# 0693, 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

# 0694, 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


# 0695, 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
# 0696, 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
# 0697, 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
# 0698, 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
# 0699, 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

# 0700, 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())   
# 0701, 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())   

# 0702, 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())   

# 0703, 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())   

# 0704, 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())   


# 0705, 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

# 0706, 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

    

# 0707, 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

    
# 0708, 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

    
# 0709, 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

    
    


# 0710, 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
    
    
    
    
    
# 0711, 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
    
    
    
    
    
# 0712, 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
    
    
    
    
    
# 0713, 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
    
    
    
    
    
# 0714, 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
    
    
    
    
    

# 0715, 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
# 0716, 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
# 0717, 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
# 0718, 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
# 0719, 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

# 0720, 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())

# 0721, 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())
# 0722, 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())
# 0723, 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())
# 0724, 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())

# 0725, 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')
# 0726, 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()) 
# 0727, 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())        

# 0728, 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())        

# 0729, 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())


# 0730, 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())
# 0731, 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())
# 0732, 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())
# 0733, 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())
# 0734, 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())

# 0735, 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

# 0736, 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

# 0737, 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

# 0738, 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

# 0739, 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


# 0740, 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))

# 0741, 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")



# 0742, 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())
# 0743, 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())

# 0744, 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())

# 0745, 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())
# 0746, 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())
# 0747, 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())
# 0748, 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())
# 0749, 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())

# 0750, 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
# 0751, 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
# 0752, 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
# 0753, 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
# 0754, 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

# 0755, 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
# 0756, 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
# 0757, 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
# 0758, 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

# 0759, 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())
# 0760, 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())
# 0761, 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())
# 0762, 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())

# 0763, 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


# 0764, 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

# 0765, 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

# 0766, 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

# 0767, 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

# 0768, 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
# 0769, 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())
# 0770, 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())

# 0771, 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())
# 0772, 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())
# 0773, 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())
# 0774, 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

# 0775, 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

# 0776, 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

# 0777, 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


# 0778, 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



# 0779, 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

# 0780, 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
# 0781, 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
# 0782, 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


# 0783, 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

# 0784, 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

# 0785, 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

# 0786, 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


# 0787, 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
  
  

# 0788, 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


  
  

# 0789, 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
# 0790, 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

# 0791, 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()) 
# 0792, 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())
# 0793, 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())
# 0794, 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())

# 0795, 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

# 0796, 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

# 0797, 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

# 0798, 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


# 0799, 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

# 0800, 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
# 0801, 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
# 0802, 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


# 0803, 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())
# 0804, 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())
# 0805, 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())
# 0806, 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())

# 0807, 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
    
    

# 0808, 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

# 0809, 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
# 0810, 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

# 0811, 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

# 0812, 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

# 0813, 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
# 0814, 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

# 0815, 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())
# 0816, 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())

# 0817, 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())

# 0818, 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())

# 0819, 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())
# 0820, 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())
# 0821, 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())
# 0822, 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())

# 0823, 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

# 0824, 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

# 0825, 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

# 0826, 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

# 0827, 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())
# 0828, 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())
# 0829, 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())
# 0830, 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())

# 0831, 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

# 0832, 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

# 0833, 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

# 0834, 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


# 0835, 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
# 0836, 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
# 0837, 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
# 0838, 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

# 0839, 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

# 0840, 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

# 0841, 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

# 0842, 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


# 0843, 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())

# 0844, 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())
# 0845, 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())

# 0846, 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())


# 0847, 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 
# 0848, 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
# 0849, 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        
# 0850, 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        

# 0851, 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


# 0852, 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


# 0853, 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

# 0854, 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


# 0855, 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


# 0856, 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



# 0857, 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
# 0858, 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
# 0859, 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

# 0860, 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

# 0861, 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

# 0862, 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


# 0863, 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]
# 0864, 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
# 0865, 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

# 0866, 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"""

# 0867, 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"""
# 0868, 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"""

# 0869, 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

# 0870, 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

# 0871, 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


# 0872, 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


# 0873, 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







# 0874, 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



# 0875, 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')
# 0876, 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())
# 0877, 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())

# 0878, 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())
    
    
    


# 0879, 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())
    
    
    


# 0880, 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())
    
    
    



# 0881, 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())
# 0882, 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())
# 0883, 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())

# 0884, 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())
# 0885, 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())
# 0886, 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())

# 0887, 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

# 0888, 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

# 0889, 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))


# 0890, 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
# 0891, 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
# 0892, 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

# 0893, 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
# 0894, 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
# 0895, 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

# 0896, 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
# 0897, 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
# 0898, 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

# 0899, 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()) 
# 0900, 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()) 
# 0901, 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()) 

# 0902, 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())
# 0903, 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())
# 0904, 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())

# 0905, 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())

# 0906, 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())

# 0907, 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())


# 0908, 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
# 0909, 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
# 0910, 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

# 0911, 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())

# 0912, 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())

# 0913, 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())


# 0914, 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())

# 0915, 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())

# 0916, 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())

# 0917, 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())


# 0918, 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())
# 0919, 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())

# 0920, 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())
# 0921, 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())

# 0922, 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

# 0923, 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


# 0924, 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())
# 0925, 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())

# 0926, 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   
# 0927, 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

# 0928, 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



# 0929, 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




# 0930, 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


# 0931, 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

# 0932, 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

# 0933, 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


# 0934, 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

# 0935, 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


# 0936, 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")
    
    
# 0937, 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())

# 0938, 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())
# 0939, 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())

# 0940, 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





# 0941, 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








# 0942, 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

# 0943, 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


# 0944, 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
# 0945, 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

# 0946, 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())

# 0947, 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())


# 0948, 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

# 0949, 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


# 0950, 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())

    
# 0951, 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())

    

# 0952, 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

# 0953, 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


# 0954, 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())
# 0955, 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())

# 0956, 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
# 0957, 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

# 0958, 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
# 0959, 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

# 0960, 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())
# 0961, 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())

# 0962, 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

# 0963, 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

# 0964, 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())
# 0965, 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())


# 0966, 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())

# 0967, 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())


# 0968, 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

# 0969, 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


# 0970, 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
# 0971, 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

# 0972, 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
# 0973, 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

# 0974, 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
# 0975, 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

# 0976, 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

# 0977, 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

# 0978, 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
# 0979, 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

# 0980, 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

# 0981, 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

# 0982, 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
# 0983, 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

# 0984, 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

    
    

# 0985, 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

    
    


# 0986, 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
# 0987, 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

# 0988, 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()) 
# 0989, 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()) 

# 0990, 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')

    

# 0991, 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

# 0992, 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())

# 0993, 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

# 0994, 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())
    
    
    

    
        


# 0995, 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



# 0996, 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




# 0997, 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

# 0998, 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())


# 0999, 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


# 1000, 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())

# 1001, 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())

# 1002, 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())
    

    
    
    

            



# 1003, 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())

# 1004, 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

# 1005, 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


# 1006, 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())

# 1007, 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())

# 1008, 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())

# 1009, 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

# 1010, 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())


# 1011, 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

# 1012, 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

# 1013, 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


# 1014, 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


# 1015, 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

# 1016, 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())


# 1017, 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())

# 1018, 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

# 1019, 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())

# 1020, 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())

# 1021, 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


# 1022, 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()) 
# 1023, 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()) 
    

# 1024, 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()) 
    

# 1025, 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()) 
    

# 1026, 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()) 
    

# 1027, 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()) 
# 1028, 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()) 
    

# 1029, 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()) 
    



# 1030, 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

# 1031, 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

# 1032, 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

# 1033, 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

# 1034, 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

# 1035, 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
# 1036, 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

# 1037, 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 
# 1038, 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
# 1039, 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
# 1040, 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
# 1041, 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
# 1042, 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
# 1043, 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

# 1044, 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())
# 1045, 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())
# 1046, 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())
# 1047, 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())
# 1048, 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())
# 1049, 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())

# 1050, 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)
# 1051, 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)
# 1052, 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)
# 1053, 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())
    
# 1054, 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())
    

# 1055, 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())

# 1056, 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())
# 1057, 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())
# 1058, 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())
# 1059, 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())

# 1060, 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())
# 1061, 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())
# 1062, 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())


# 1063, 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())

# 1064, 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")


# 1065, 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
# 1066, 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

# 1067, 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())
# 1068, 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())
# 1069, 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())

# 1070, 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
# 1071, 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

# 1072, 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())


# 1073, 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())

# 1074, 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

# 1075, 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


# 1076, 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

# 1077, 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

# 1078, 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

# 1079, 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

# 1080, 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

# 1081, 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

# 1082, 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

# 1083, 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

# 1084, 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

# 1085, 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
# 1086, 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

# 1087, 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

# 1088, 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

# 1089, 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

# 1090, 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
# 1091, 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
# 1092, 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
# 1093, 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
# 1094, 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
# 1095, 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
# 1096, 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
# 1097, 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
# 1098, 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

# 1099, 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

# 1100, 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
# 1101, 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
# 1102, 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
# 1103, 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
# 1104, 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

# 1105, 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

# 1106, 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

# 1107, 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

# 1108, 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

# 1109, 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

# 1110, 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

# 1111, 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

# 1112, 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

# 1113, 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

# 1114, 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

# 1115, 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

# 1116, 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

# 1117, 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


# 1118, 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


# 1119, 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


# 1120, 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


# 1121, 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
# 1122, 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

# 1123, 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
# 1124, 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
# 1125, 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
# 1126, 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
# 1127, 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
# 1128, 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
# 1129, 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
# 1130, 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
# 1131, 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
# 1132, 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
# 1133, 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
# 1134, 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
# 1135, 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
# 1136, 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
# 1137, 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
# 1138, 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
# 1139, 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

# 1140, 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())
# 1141, 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())

# 1142, 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())

# 1143, 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())

# 1144, 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())
# 1145, 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())

# 1146, 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())
# 1147, 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())

# 1148, 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())

# 1149, 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())

# 1150, 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())

# 1151, 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())

# 1152, 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())
# 1153, 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())

# 1154, 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())


# 1155, 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]
# 1156, 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]
        
    


# 1157, 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

# 1158, 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

# 1159, 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
# 1160, 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

# 1161, 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

# 1162, 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

# 1163, 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

# 1164, 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

# 1165, 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

# 1166, 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

# 1167, 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

# 1168, 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

# 1169, 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


# 1170, 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

# 1171, 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

# 1172, 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'

# 1173, 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'

# 1174, 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'

# 1175, 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

# 1176, 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]
# 1177, 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

# 1178, 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

# 1179, 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

# 1180, 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

# 1181, 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

# 1182, 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

# 1183, 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


# 1184, 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()
# 1185, 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())
# 1186, 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())
# 1187, 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())
# 1188, 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())
# 1189, 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())
# 1190, 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())
# 1191, 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())
# 1192, 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())
# 1193, 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())
# 1194, 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())
# 1195, 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())
# 1196, 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())
# 1197, 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())

# 1198, 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
# 1199, 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
# 1200, 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
# 1201, 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
# 1202, 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
# 1203, 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
# 1204, 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
# 1205, 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
# 1206, 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
# 1207, 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
# 1208, 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
# 1209, 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
# 1210, 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
# 1211, 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

# 1212, 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())
# 1213, 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")
# 1214, 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())
# 1215, 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())
# 1216, 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())
# 1217, 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())
    
# 1218, 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())
# 1219, 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())
# 1220, 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())
# 1221, 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")
# 1222, 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())
# 1223, 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())
# 1224, 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())

# 1225, 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')
# 1226, 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())


# 1227, 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())
# 1228, 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())
# 1229, 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())
# 1230, 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())
# 1231, 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())
# 1232, 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())
# 1233, 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())
# 1234, 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())


# 1235, 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())


# 1236, 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')
        
    

# 1237, 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())

# 1238, 2022-09-24 09:15:52, ----[--][----] (0%)

def f1(a, b, c):
    return max(a,b,b,0)
# 1239, 2022-09-24 09:16:53, ----[--][----] (0%)

def f1(a, b, c):
    return min(a,b,c,0)
# 1240, 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)
# 1241, 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
# 1242, 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


# 1243, 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
# 1244, 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


# 1245, 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


# 1246, 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


# 1247, 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


# 1248, 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
# 1249, 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



# 1250, 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())

# 1251, 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())

# 1252, 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())

# 1253, 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())

# 1254, 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())
# 1255, 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())

# 1256, 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())

# 1257, 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())

# 1258, 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())

# 1259, 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())

# 1260, 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())

# 1261, 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())

# 1262, 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())
# 1263, 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())
# 1264, 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())
# 1265, 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())
# 1266, 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())

# 1267, 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())
# 1268, 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())
# 1269, 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())
# 1270, 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())
# 1271, 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())
# 1272, 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())
# 1273, 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())

# 1274, 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())
        
    

# 1275, 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())
        
    

# 1276, 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))
# 1277, 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))
# 1278, 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)
# 1279, 2022-09-24 10:30:20, ----[--][----] (0%)

def f4(a, b, c):
    d=a+b+c
    if d<0:
        d=-d
    return(d%10)
# 1280, 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())
# 1281, 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())
# 1282, 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())
# 1283, 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())
# 1284, 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())

# 1285, 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())
# 1286, 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())
# 1287, 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())
# 1288, 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())
# 1289, 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())
# 1290, 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())
# 1291, 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())
# 1292, 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())
# 1293, 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())
# 1294, 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())

# 1295, 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
# 1296, 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
# 1297, 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
# 1298, 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
# 1299, 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
# 1300, 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
# 1301, 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
# 1302, 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
# 1303, 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

# 1304, 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

# 1305, 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

# 1306, 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

# 1307, 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

# 1308, 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

# 1309, 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

# 1310, 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

# 1311, 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


# 1312, 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())
# 1313, 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())
# 1314, 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())
    
# 1315, 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())
# 1316, 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())
# 1317, 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())
# 1318, 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())
# 1319, 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())

# 1320, 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
# 1321, 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
# 1322, 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
# 1323, 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
# 1324, 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
# 1325, 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
# 1326, 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
# 1327, 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

# 1328, 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
# 1329, 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

# 1330, 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

# 1331, 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
# 1332, 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

# 1333, 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
# 1334, 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

# 1335, 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)

# 1336, 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


# 1337, 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

# 1338, 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
# 1339, 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')

# 1340, 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')

# 1341, 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


# 1342, 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)
# 1343, 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())
# 1344, 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())
# 1345, 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())
# 1346, 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())
# 1347, 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())
# 1348, 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())

# 1349, 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
# 1350, 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
# 1351, 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
# 1352, 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
# 1353, 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
# 1354, 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
# 1355, 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

# 1356, 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

# 1357, 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

# 1358, 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
# 1359, 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())

# 1360, 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())

# 1361, 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())


# 1362, 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

    
        

# 1363, 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

    
        

# 1364, 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

    
        

# 1365, 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
# 1366, 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

    
        

# 1367, 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

# 1368, 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')
                


# 1369, 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())

# 1370, 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())

# 1371, 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())

# 1372, 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())
# 1373, 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())

# 1374, 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
 
 
 
 

# 1375, 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
 
 
 
 

# 1376, 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
 
 
 
 

# 1377, 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
# 1378, 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
# 1379, 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

# 1380, 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())

# 1381, 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())

# 1382, 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())

# 1383, 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())

# 1384, 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())

# 1385, 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())


# 1386, 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



# 1387, 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
# 1388, 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


# 1389, 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
# 1390, 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

# 1391, 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())        
        
        
        
        
        
        
        
        

# 1392, 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())        
        
        
        
        
        
        
        
        

# 1393, 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())        
        
        
        
        
        
        
        
        

# 1394, 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())        
        
        
        
        
        
        
        
        

# 1395, 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())

# 1396, 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())

# 1397, 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())

# 1398, 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())

# 1399, 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())

# 1400, 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())


# 1401, 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())
# 1402, 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())
# 1403, 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())
# 1404, 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())

# 1405, 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())

# 1406, 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())
# 1407, 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))


# 1408, 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())
# 1409, 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())
# 1410, 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())

# 1411, 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())
# 1412, 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())
# 1413, 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())
# 1414, 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())
# 1415, 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())

# 1416, 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())
    
# 1417, 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())
    
# 1418, 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())
# 1419, 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())
# 1420, 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())

# 1421, 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
# 1422, 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
# 1423, 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
# 1424, 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
# 1425, 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

# 1426, 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
# 1427, 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
# 1428, 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
# 1429, 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
# 1430, 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

# 1431, 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


# 1432, 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


# 1433, 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
# 1434, 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

# 1435, 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())
# 1436, 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())
# 1437, 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())
# 1438, 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())

# 1439, 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
# 1440, 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
# 1441, 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
# 1442, 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

# 1443, 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())

# 1444, 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())
# 1445, 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())

# 1446, 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())


# 1447, 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")
# 1448, 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
    


# 1449, 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
    


# 1450, 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

# 1451, 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())            
    

# 1452, 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())            
    

# 1453, 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())
# 1454, 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())            
    


# 1455, 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())
# 1456, 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())
    
# 1457, 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())
# 1458, 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())

# 1459, 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())

# 1460, 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())

# 1461, 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())

# 1462, 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())


# 1463, 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
# 1464, 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
# 1465, 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
# 1466, 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

# 1467, 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



# 1468, 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



# 1469, 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

# 1470, 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

# 1471, 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

# 1472, 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


# 1473, 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
# 1474, 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
# 1475, 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

# 1476, 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
# 1477, 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
# 1478, 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

# 1479, 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())
# 1480, 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())
# 1481, 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())

# 1482, 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())
# 1483, 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())
# 1484, 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())

# 1485, 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())
# 1486, 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())
# 1487, 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())

# 1488, 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())
# 1489, 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())

# 1490, 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
# 1491, 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

# 1492, 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")
# 1493, 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())

# 1494, 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())

# 1495, 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())


# 1496, 2022-09-24 09:59:18, ----[--][----] (0%)

1
# 1497, 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())

# 1498, 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())
# 1499, 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())

# 1500, 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())
# 1501, 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())

# 1502, 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


# 1503, 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
        

# 1504, 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())   

# 1505, 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


# 1506, 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
# 1507, 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
# 1508, 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
# 1509, 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
# 1510, 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())
# 1511, 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())
# 1512, 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())
# 1513, 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())
# 1514, 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())
# 1515, 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())
# 1516, 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())
# 1517, 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())
# 1518, 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())
# 1519, 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())

# 1520, 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())
# 1521, 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())
# 1522, 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())
# 1523, 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())
# 1524, 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())
# 1525, 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())
# 1526, 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())
# 1527, 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())
# 1528, 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())

# 1529, 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())

# 1530, 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())

# 1531, 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())
# 1532, 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())

# 1533, 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)

# 1534, 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()) 
# 1535, 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())

# 1536, 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())

# 1537, 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())

# 1538, 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())

# 1539, 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())


# 1540, 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())



# 1541, 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())



# 1542, 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())



# 1543, 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())

# 1544, 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())
# 1545, 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())


# 1546, 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")
# 1547, 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())
# 1548, 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")
# 1549, 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


# 1550, 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


# 1551, 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



# 1552, 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())
# 1553, 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())
# 1554, 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())
# 1555, 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())
# 1556, 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())

# 1557, 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]
# 1558, 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
# 1559, 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

# 1560, 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

# 1561, 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


# 1562, 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
# 1563, 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())
# 1564, 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())
# 1565, 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())

# 1566, 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())
# 1567, 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())
# 1568, 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())
# 1569, 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())

# 1570, 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

# 1571, 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

# 1572, 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

# 1573, 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

# 1574, 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

# 1575, 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
# 1576, 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
# 1577, 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

# 1578, 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())
        


# 1579, 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())
        


# 1580, 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())
        


# 1581, 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())
        



# 1582, 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
# 1583, 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
# 1584, 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
# 1585, 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

# 1586, 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
# 1587, 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
# 1588, 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

# 1589, 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
    

# 1590, 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
    

# 1591, 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
    


# 1592, 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

# 1593, 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


# 1594, 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
# 1595, 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

# 1596, 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())

# 1597, 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



# 1598, 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


# 1599, 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
# 1600, 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())
# 1601, 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())
# 1602, 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())
# 1603, 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())
# 1604, 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())
# 1605, 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())
# 1606, 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())
# 1607, 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())
# 1608, 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())
# 1609, 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())
# 1610, 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())
# 1611, 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())
# 1612, 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())
# 1613, 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())
# 1614, 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())

# 1615, 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())
# 1616, 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())

# 1617, 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
# 1618, 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
# 1619, 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
# 1620, 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
# 1621, 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
# 1622, 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
# 1623, 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
# 1624, 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
# 1625, 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
# 1626, 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
    
    
    

# 1627, 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
# 1628, 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
# 1629, 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
# 1630, 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

# 1631, 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
# 1632, 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
# 1633, 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
# 1634, 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
# 1635, 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
# 1636, 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
# 1637, 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
# 1638, 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
# 1639, 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
# 1640, 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
# 1641, 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
# 1642, 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
# 1643, 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

# 1644, 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")
# 1645, 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

# 1646, 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
# 1647, 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
# 1648, 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
# 1649, 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
# 1650, 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
# 1651, 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
# 1652, 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

# 1653, 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())
# 1654, 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
# 1655, 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
# 1656, 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())

# 1657, 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())
# 1658, 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())
# 1659, 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())
# 1660, 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())
# 1661, 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())

# 1662, 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
# 1663, 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
# 1664, 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
# 1665, 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


# 1666, 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
# 1667, 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
# 1668, 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
# 1669, 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
# 1670, 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

# 1671, 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
# 1672, 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
# 1673, 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
# 1674, 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
# 1675, 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
# 1676, 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
# 1677, 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
# 1678, 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
# 1679, 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

# 1680, 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

# 1681, 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

# 1682, 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

# 1683, 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

# 1684, 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
# 1685, 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

# 1686, 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

# 1687, 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


# 1688, 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
        
# 1689, 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
# 1690, 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        
# 1691, 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        
# 1692, 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        
# 1693, 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        
# 1694, 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        
# 1695, 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        

# 1696, 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
# 1697, 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
# 1698, 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
# 1699, 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
# 1700, 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
# 1701, 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
# 1702, 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

# 1703, 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())
# 1704, 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)


# 1705, 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)


# 1706, 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())
# 1707, 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())
# 1708, 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())
# 1709, 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())

# 1710, 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

# 1711, 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
# 1712, 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

# 1713, 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

# 1714, 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

# 1715, 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


# 1716, 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")
        
# 1717, 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")
# 1718, 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")
        
# 1719, 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")
# 1720, 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
# 1721, 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

# 1722, 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())
# 1723, 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())
# 1724, 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())
# 1725, 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())
# 1726, 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())

# 1727, 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





# 1728, 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





# 1729, 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





# 1730, 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






# 1731, 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()) 
# 1732, 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()) 

# 1733, 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())

# 1734, 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))
    
    
    
    
    
    
    
    
    

# 1735, 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
# 1736, 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

# 1737, 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
# 1738, 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
# 1739, 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

# 1740, 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
# 1741, 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
# 1742, 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

# 1743, 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 
# 1744, 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


# 1745, 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

# 1746, 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
# 1747, 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
# 1748, 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

# 1749, 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())
# 1750, 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())
# 1751, 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())

# 1752, 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
# 1753, 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
# 1754, 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


# 1755, 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())
# 1756, 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()
# 1757, 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())

# 1758, 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())
# 1759, 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())
# 1760, 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())

# 1761, 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
# 1762, 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
# 1763, 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

# 1764, 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


# 1765, 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

# 1766, 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

# 1767, 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


# 1768, 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

# 1769, 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


# 1770, 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

# 1771, 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


# 1772, 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


# 1773, 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())

# 1774, 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



# 1775, 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


# 1776, 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())
# 1777, 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())
# 1778, 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())
# 1779, 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())
# 1780, 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
# 1781, 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())
# 1782, 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())
# 1783, 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())
# 1784, 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())
# 1785, 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())
# 1786, 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())
# 1787, 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())
# 1788, 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())
# 1789, 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())
# 1790, 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())
# 1791, 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())
# 1792, 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())
# 1793, 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())
# 1794, 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())
# 1795, 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())
# 1796, 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())
# 1797, 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())
# 1798, 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())

# 1799, 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
    
    

# 1800, 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)
# 1801, 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)
# 1802, 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
    
    


# 1803, 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
    

# 1804, 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
# 1805, 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())
# 1806, 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())
# 1807, 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
# 1808, 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
# 1809, 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

# 1810, 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
    
    
# 1811, 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

# 1812, 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
# 1813, 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
    

# 1814, 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

# 1815, 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
    
    


# 1816, 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

# 1817, 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
    
    


# 1818, 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
    
    


# 1819, 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
    
    



# 1820, 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
   
# 1821, 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
 
 
# 1822, 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
# 1823, 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
  
# 1824, 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
# 1825, 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
    
    

# 1826, 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
# 1827, 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
# 1828, 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
# 1829, 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
    
# 1830, 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
 
# 1831, 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
# 1832, 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
# 1833, 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

# 1834, 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





# 1835, 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





# 1836, 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
# 1837, 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
# 1838, 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
# 1839, 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
# 1840, 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
# 1841, 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
# 1842, 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
# 1843, 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
# 1844, 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
# 1845, 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

# 1846, 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

# 1847, 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
# 1848, 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
# 1849, 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
# 1850, 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
# 1851, 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
# 1852, 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
# 1853, 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
# 1854, 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
# 1855, 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
# 1856, 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

# 1857, 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))
# 1858, 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())
# 1859, 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())
# 1860, 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())    
# 1861, 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())
# 1862, 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())
# 1863, 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())
# 1864, 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())
# 1865, 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())
# 1866, 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())
# 1867, 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())

# 1868, 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")
    
    
# 1869, 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())
    
# 1870, 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()) 
# 1871, 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())   
    
# 1872, 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())   
# 1873, 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())   
    

# 1874, 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())
# 1875, 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())   
    
# 1876, 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())
# 1877, 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())
# 1878, 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())   

# 1879, 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())
# 1880, 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())
# 1881, 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())
# 1882, 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())
# 1883, 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())
# 1884, 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())
# 1885, 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())
# 1886, 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())
# 1887, 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())
# 1888, 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())

# 1889, 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

# 1890, 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
# 1891, 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

# 1892, 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
# 1893, 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

# 1894, 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


# 1895, 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

# 1896, 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

# 1897, 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


# 1898, 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 
# 1899, 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
# 1900, 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   
# 1901, 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 
# 1902, 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 
# 1903, 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 
# 1904, 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
# 1905, 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  

# 1906, 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)
# 1907, 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
# 1908, 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
# 1909, 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
# 1910, 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
# 1911, 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
# 1912, 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

# 1913, 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())
# 1914, 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())

# 1915, 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())
# 1916, 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())

# 1917, 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())

# 1918, 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())

# 1919, 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())
# 1920, 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())
# 1921, 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())
# 1922, 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())
# 1923, 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())

# 1924, 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())

# 1925, 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

# 1926, 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

# 1927, 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

# 1928, 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
# 1929, 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

# 1930, 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


# 1931, 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())
# 1932, 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())
# 1933, 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())
# 1934, 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())

# 1935, 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 

# 1936, 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 

# 1937, 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 

# 1938, 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 


# 1939, 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())
# 1940, 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())
# 1941, 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())

# 1942, 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

# 1943, 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

# 1944, 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


# 1945, 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
# 1946, 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
# 1947, 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

# 1948, 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

# 1949, 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


# 1950, 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
# 1951, 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

# 1952, 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())
    
# 1953, 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())

# 1954, 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())
# 1955, 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())

# 1956, 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

# 1957, 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


# 1958, 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]
# 1959, 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
# 1960, 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)
# 1961, 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
    
    
# 1962, 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
# 1963, 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)
# 1964, 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)
# 1965, 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
# 1966, 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
# 1967, 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))
# 1968, 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

# 1969, 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

# 1970, 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
# 1971, 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

# 1972, 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
    
    

# 1973, 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
# 1974, 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
    
    
# 1975, 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
# 1976, 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")
# 1977, 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")
# 1978, 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")

# 1979, 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


# 1980, 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

# 1981, 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
# 1982, 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

# 1983, 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

# 1984, 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
# 1985, 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

# 1986, 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())

# 1987, 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())

# 1988, 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())

# 1989, 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())

# 1990, 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())

# 1991, 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())


# 1992, 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))
        

# 1993, 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]

# 1994, 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
  

# 1995, 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
# 1996, 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
# 1997, 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

# 1998, 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()
    
# 1999, 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())
# 2000, 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())
# 2001, 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())
              
    
    
# 2002, 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())
# 2003, 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())

# 2004, 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

# 2005, 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

# 2006, 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

# 2007, 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

# 2008, 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

# 2009, 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


# 2010, 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)
# 2011, 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)
# 2012, 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
# 2013, 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
# 2014, 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
# 2015, 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)



# 2016, 2022-09-24 10:31:36, compilation error (0%)

def f1(a, b, c):
if a,b,c > 0
    print(a,b,c)
# 2017, 2022-09-24 10:31:51, compilation error (0%)

def f1(a, b, c):
if a,b,c > 0
   return(a,b,c)
# 2018, 2022-09-24 10:33:00, ----[--][----] (0%)

def f1(a, b, c):

  if (a,b,c) > 0 :
    print(a,b,c)
# 2019, 2022-09-24 10:33:34, ----[--][----] (0%)

def f1(a, b, c):

  if (a,b,c) > 0 :
    return(a,b,c)
# 2020, 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
# 2021, 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)

# 2022, 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())        
        
            
                

# 2023, 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())   
# 2024, 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())
# 2025, 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())
# 2026, 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())
# 2027, 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())

# 2028, 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

# 2029, 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
# 2030, 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
# 2031, 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
# 2032, 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

# 2033, 2022-09-24 10:06:02, ----[--][----] (0%)

a = "help me pls, "
print(a)
# 2034, 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
# 2035, 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
# 2036, 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

# 2037, 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


# 2038, 2022-09-24 09:37:15, compilation error (0%)

a = input().split())
print(a)
# 2039, 2022-09-24 09:42:40, ----[--][----] (0%)

a = input().split()
print(a)
# 2040, 2022-09-24 09:50:30, ----[--][----] (0%)

a = input()
print(a)
# 2041, 2022-09-24 09:50:59, xxxx[xx][xxxx] (0%)

a = input()
print(int(a))
# 2042, 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)

# 2043, 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
# 2044, 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
# 2045, 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])
# 2046, 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])
# 2047, 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])

# 2048, 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

# 2049, 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

# 2050, 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

# 2051, 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


# 2052, 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))
        
        
        

# 2053, 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')

# 2054, 2022-09-24 10:29:39, ----[--][----] (0%)

x=input()
print(x)
# 2055, 2022-09-24 10:30:04, ----[--][----] (0%)

print('Hello Welcome')

# 2056, 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())
# 2057, 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())
# 2058, 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())
# 2059, 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())

# 2060, 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())
            


# 2061, 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())
            


# 2062, 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())
            


# 2063, 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())

# 2064, 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()
# 2065, 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()
# 2066, 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())
# 2067, 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())

# 2068, 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())
# 2069, 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())
# 2070, 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())
# 2071, 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())

# 2072, 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)
        
# 2073, 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())
# 2074, 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())
# 2075, 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())

# 2076, 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')


# 2077, 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')


# 2078, 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')
# 2079, 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())

# 2080, 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())
# 2081, 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())
# 2082, 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())

# 2083, 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())
# 2084, 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())
# 2085, 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())

# 2086, 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)
# 2087, 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
# 2088, 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

# 2089, 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
# 2090, 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
# 2091, 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


# 2092, 2022-09-24 09:58:34, ----[--][----] (0%)

x=input()
print(x)



# 2093, 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)

# 2094, 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)

# 2095, 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
# 2096, 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
# 2097, 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

# 2098, 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
# 2099, 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
# 2100, 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

# 2101, 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

# 2102, 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
# 2103, 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

# 2104, 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())
# 2105, 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())
# 2106, 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())

# 2107, 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

# 2108, 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

# 2109, 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


# 2110, 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()) 
# 2111, 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()) 
# 2112, 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()) 

# 2113, 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()) 
# 2114, 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]
# 2115, 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())

# 2116, 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

# 2117, 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


# 2118, 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
# 2119, 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


# 2120, 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

    
# 2121, 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

# 2122, 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

# 2123, 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


# 2124, 2022-09-24 09:40:19, ----[--][----] (0%)

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

# 2125, 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







# 2126, 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
# 2127, 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


# 2128, 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)
    
        


# 2129, 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)
    
        



# 2130, 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)
# 2131, 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)

# 2132, 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()) 
# 2133, 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()) 

# 2134, 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())

        
        
        
# 2135, 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())

# 2136, 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())

# 2137, 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


# 2138, 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))
    


        
    


# 2139, 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

# 2140, 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

# 2141, 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

# 2142, 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')

# 2143, 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()) 

# 2144, 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))


# 2145, 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))

# 2146, 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

# 2147, 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

# 2148, 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

# 2149, 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

# 2150, 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)
    
    

# 2151, 2022-09-24 09:56:08, xxxx[xx][xxxx] (0%)

a = int(input())
print(a)





# 2152, 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())

# 2153, 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    


# 2154, 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

# 2155, 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())

# 2156, 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")
        

# 2157, 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







# 2158, 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


# 2159, 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)




# 2160, 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())

# 2161, 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

# 2162, 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

# 2163, 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



# 2164, 2022-09-24 10:38:44, xxxx[xx][xxxx] (0%)

j

# 2165, 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
    


# 2166, 2022-09-24 10:16:38, ----[--][----] (0%)

print(int(20))