dg = "01234567889"


def eva(u):
    i = 0
    while i < len(u):
        if (i == 0 and u[i] == "0") or (u[i - 1] not in dg and u[i] == "0"):
            if i + 1 == len(u) or u[i + 1] not in dg:
                i += 1
            else:
                u = u[:i] + u[i + 1:]
        else:
            i += 1
    return eval(u)


s = input()

res = eva(s)
for i in range(0, len(s) - 1):
    if s[i] not in dg or s[i + 1] not in dg:
        continue
    t = s[i + 1:len(s)]
    t += s[0:i + 1]
    res = max(res, eva(t))
print(res)