<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def to_int(s):
 """ converts a string to an integer 1000000 1000000 1000 """

    try:
        return int(s.replace('_', ''))
    except ValueError:
        return int(ast.literal_eval(s))