#include <errno.h>
#include <inttypes.h>
#include <limits.h>
#include <malloc.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
typedef signed char flex_int8_t;
typedef short int flex_int16_t;
typedef int flex_int32_t;
typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
typedef struct yy_buffer_state* YY_BUFFER_STATE;
typedef size_t yy_size_t;
extern int yyleng;
extern FILE *yyin, *yyout;
struct yy_buffer_state {
    FILE* yy_input_file;
    char* yy_ch_buf;
    char* yy_buf_pos;
    int yy_buf_size;
    int yy_n_chars;
    int yy_is_our_buffer;
    int yy_is_interactive;
    int yy_at_bol;
    int yy_bs_lineno;
    int yy_bs_column;
    int yy_fill_buffer;
    int yy_buffer_status;
};
static size_t yy_buffer_stack_top = 0;
static size_t yy_buffer_stack_max = 0;
static YY_BUFFER_STATE* yy_buffer_stack = NULL;
static char yy_hold_char;
static int yy_n_chars;
int yyleng;
static char* yy_c_buf_p = NULL;
static int yy_init = 0;
static int yy_start = 0;
static int yy_did_buffer_switch_on_eof;
void yyrestart(FILE* input_file);
void yy_switch_to_buffer(YY_BUFFER_STATE new_buffer);
YY_BUFFER_STATE yy_create_buffer(FILE* file, int size);
void yy_delete_buffer(YY_BUFFER_STATE b);
void yy_flush_buffer(YY_BUFFER_STATE b);
void yypush_buffer_state(YY_BUFFER_STATE new_buffer);
void yypop_buffer_state(void);
static void yyensure_buffer_stack(void);
static void yy_load_buffer_state(void);
static void yy_init_buffer(YY_BUFFER_STATE b, FILE* file);
YY_BUFFER_STATE yy_scan_buffer(char* base, yy_size_t size);
YY_BUFFER_STATE yy_scan_string(const char* yy_str);
YY_BUFFER_STATE yy_scan_bytes(const char* bytes, int len);
void* yyalloc(yy_size_t);
void* yyrealloc(void*, yy_size_t);
void yyfree(void*);
typedef flex_uint8_t YY_CHAR;
FILE *yyin = NULL, *yyout = NULL;
typedef int yy_state_type;
extern int yylineno;
int yylineno = 1;
extern char* yytext;
static yy_state_type yy_get_previous_state(void);
static yy_state_type yy_try_NUL_trans(yy_state_type current_state);
static int yy_get_next_buffer(void);
static void yy_fatal_error(const char* msg);
struct yy_trans_info {
    flex_int32_t yy_verify;
    flex_int32_t yy_nxt;
};
static const flex_int16_t yy_accept[11] = {0, 0, 0, 6, 5, 4, 1, 2, 5, 3, 0};
static const YY_CHAR yy_ec[256] = {
    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 4, 1, 1, 1, 5, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
static const YY_CHAR yy_meta[7] = {0, 1, 1, 1, 1, 1, 2};
static const flex_int16_t yy_base[12] = {0, 0, 0, 8, 9, 9, 9, 9, 0, 9, 9, 5};
static const flex_int16_t yy_def[12] = {0,  10, 1,  10, 10, 10,
                                        10, 10, 11, 10, 0,  10};
static const flex_int16_t yy_nxt[16] = {0,  4, 5,  6,  7,  8,  4,  9,
                                        10, 3, 10, 10, 10, 10, 10, 10};
static const flex_int16_t yy_chk[16] = {0, 1,  1,  1,  1,  1,  1,  11,
                                        3, 10, 10, 10, 10, 10, 10, 10};
static yy_state_type yy_last_accepting_state;
static char* yy_last_accepting_cpos;
extern int yy_flex_debug;
int yy_flex_debug = 0;
char* yytext;
void yyerror(char*);
extern int yydebug;
enum yytokentype {
    YYEMPTY = -2,
    YYEOF = 0,
    YYerror = 256,
    YYUNDEF = 257,
    NEWLINE = 258,
    ARROW = 259
};
typedef enum yytokentype yytoken_kind_t;
typedef int YYSTYPE;
extern YYSTYPE yylval;
int yyparse(void);
static int yy_init_globals(void);
int yylex_destroy(void);
int yyget_debug(void);
void yyset_debug(int debug_flag);
void* yyget_extra(void);
void yyset_extra(void* user_defined);
FILE* yyget_in(void);
void yyset_in(FILE* _in_str);
FILE* yyget_out(void);
void yyset_out(FILE* _out_str);
int yyget_leng(void);
char* yyget_text(void);
int yyget_lineno(void);
void yyset_lineno(int _line_number);
extern int yywrap(void);
static void yyunput(int c, char* buf_ptr);
static int input(void);
extern int yylex(void);
int yylex(void) {
    yy_state_type yy_current_state;
    char *yy_cp, *yy_bp;
    int yy_act;
    if (!(yy_init)) {
        (yy_init) = 1;
        if (!(yy_start)) (yy_start) = 1;
        if (!yyin) yyin = stdin;
        if (!yyout) yyout = stdout;
        if (!((yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)]
                                : NULL)) {
            yyensure_buffer_stack();
            (yy_buffer_stack)[(yy_buffer_stack_top)] =
                yy_create_buffer(yyin, 16384);
        }
        yy_load_buffer_state();
    }
    {
        while (1) {
            yy_cp = (yy_c_buf_p);
            *yy_cp = (yy_hold_char);
            yy_bp = yy_cp;
            yy_current_state = (yy_start);
        yy_match:
            do {
                YY_CHAR yy_c = yy_ec[((YY_CHAR)(*yy_cp))];
                if (yy_accept[yy_current_state]) {
                    (yy_last_accepting_state) = yy_current_state;
                    (yy_last_accepting_cpos) = yy_cp;
                }
                while (yy_chk[yy_base[yy_current_state] + yy_c] !=
                       yy_current_state) {
                    yy_current_state = (int)yy_def[yy_current_state];
                    if (yy_current_state >= 11) yy_c = yy_meta[yy_c];
                }
                yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
                ++yy_cp;
            } while (yy_base[yy_current_state] != 9);
        yy_find_action:
            yy_act = yy_accept[yy_current_state];
            if (yy_act == 0) {
                yy_cp = (yy_last_accepting_cpos);
                yy_current_state = (yy_last_accepting_state);
                yy_act = yy_accept[yy_current_state];
            }
            (yytext) = yy_bp;
            yyleng = (int)(yy_cp - yy_bp);
            (yy_hold_char) = *yy_cp;
            *yy_cp = '\0';
            (yy_c_buf_p) = yy_cp;
            ;
        do_action:
            switch (yy_act) {
                case 0:
                    *yy_cp = (yy_hold_char);
                    yy_cp = (yy_last_accepting_cpos);
                    yy_current_state = (yy_last_accepting_state);
                    goto yy_find_action;
                case 1:
                    return '(';
                    break;
                case 2:
                    return ')';
                    break;
                case 3: {
                    return 259;
                } break;
                case 4:
                    return 258;
                    break;
                case 5:
                    do {
                        if (fwrite(yytext, (size_t)yyleng, 1, yyout)) {
                        }
                    } while (0);
                    break;
                case (6 + 0 + 1):
                    return 0;
                case 6: {
                    int yy_amount_of_matched_text = (int)(yy_cp - (yytext)) - 1;
                    *yy_cp = (yy_hold_char);
                    if ((yy_buffer_stack)[(yy_buffer_stack_top)]
                            ->yy_buffer_status == 0) {
                        (yy_n_chars) = (yy_buffer_stack)[(yy_buffer_stack_top)]
                                           ->yy_n_chars;
                        (yy_buffer_stack)[(yy_buffer_stack_top)]
                            ->yy_input_file = yyin;
                        (yy_buffer_stack)[(yy_buffer_stack_top)]
                            ->yy_buffer_status = 1;
                    }
                    if ((yy_c_buf_p) <=
                        &(yy_buffer_stack)[(yy_buffer_stack_top)]
                             ->yy_ch_buf[(yy_n_chars)]) {
                        yy_state_type yy_next_state;
                        (yy_c_buf_p) = (yytext) + yy_amount_of_matched_text;
                        yy_current_state = yy_get_previous_state();
                        yy_next_state = yy_try_NUL_trans(yy_current_state);
                        yy_bp = (yytext) + 0;
                        if (yy_next_state) {
                            yy_cp = ++(yy_c_buf_p);
                            yy_current_state = yy_next_state;
                            goto yy_match;
                        } else {
                            yy_cp = (yy_c_buf_p);
                            goto yy_find_action;
                        }
                    } else
                        switch (yy_get_next_buffer()) {
                            case 1: {
                                (yy_did_buffer_switch_on_eof) = 0;
                                if (yywrap()) {
                                    (yy_c_buf_p) = (yytext) + 0;
                                    yy_act = (6 + (((yy_start)-1) / 2) + 1);
                                    goto do_action;
                                } else {
                                    if (!(yy_did_buffer_switch_on_eof))
                                        yyrestart(yyin);
                                }
                                break;
                            }
                            case 0:
                                (yy_c_buf_p) =
                                    (yytext) + yy_amount_of_matched_text;
                                yy_current_state = yy_get_previous_state();
                                yy_cp = (yy_c_buf_p);
                                yy_bp = (yytext) + 0;
                                goto yy_match;
                            case 2:
                                (yy_c_buf_p) =
                                    &(yy_buffer_stack)[(yy_buffer_stack_top)]
                                         ->yy_ch_buf[(yy_n_chars)];
                                yy_current_state = yy_get_previous_state();
                                yy_cp = (yy_c_buf_p);
                                yy_bp = (yytext) + 0;
                                goto yy_find_action;
                        }
                    break;
                }
                default:
                    yy_fatal_error(
                        "fatal flex scanner internal error--no action found");
            }
        }
    }
}
static int yy_get_next_buffer(void) {
    char* dest = (yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf;
    char* source = (yytext);
    int number_to_move, i;
    int ret_val;
    if ((yy_c_buf_p) >
        &(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf[(yy_n_chars) + 1])
        yy_fatal_error(
            "fatal flex scanner internal error--end of buffer missed");
    if ((yy_buffer_stack)[(yy_buffer_stack_top)]->yy_fill_buffer == 0) {
        if ((yy_c_buf_p) - (yytext)-0 == 1) {
            return 1;
        } else {
            return 2;
        }
    }
    number_to_move = (int)((yy_c_buf_p) - (yytext)-1);
    for (i = 0; i < number_to_move; ++i) *(dest++) = *(source++);
    if ((yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buffer_status == 2)
        (yy_buffer_stack)[(yy_buffer_stack_top)]->yy_n_chars = (yy_n_chars) = 0;
    else {
        int num_to_read =
            (yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buf_size -
            number_to_move - 1;
        while (num_to_read <= 0) {
            YY_BUFFER_STATE b = (yy_buffer_stack)[(yy_buffer_stack_top)];
            int yy_c_buf_p_offset = (int)((yy_c_buf_p)-b->yy_ch_buf);
            if (b->yy_is_our_buffer) {
                int new_size = b->yy_buf_size * 2;
                if (new_size <= 0)
                    b->yy_buf_size += b->yy_buf_size / 8;
                else
                    b->yy_buf_size *= 2;
                b->yy_ch_buf = (char*)yyrealloc(
                    (void*)b->yy_ch_buf, (yy_size_t)(b->yy_buf_size + 2));
            } else
                b->yy_ch_buf = NULL;
            if (!b->yy_ch_buf)
                yy_fatal_error("fatal error - scanner input buffer overflow");
            (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
            num_to_read =
                (yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buf_size -
                number_to_move - 1;
        }
        if (num_to_read > 8192) num_to_read = 8192;
        if ((yy_buffer_stack)[(yy_buffer_stack_top)]->yy_is_interactive) {
            int c = '*';
            int n;
            for (n = 0; n < num_to_read && (c = getc(yyin)) != EOF && c != '\n';
                 ++n)
                (&(yy_buffer_stack)[(yy_buffer_stack_top)]
                      ->yy_ch_buf[number_to_move])[n] = (char)c;
            if (c == '\n')
                (&(yy_buffer_stack)[(yy_buffer_stack_top)]
                      ->yy_ch_buf[number_to_move])[n++] = (char)c;
            if (c == EOF && ferror(yyin))
                yy_fatal_error("input in flex scanner failed");
            (yy_n_chars) = n;
        } else {
            errno = 0;
            while (((yy_n_chars) =
                        (int)fread((&(yy_buffer_stack)[(yy_buffer_stack_top)]
                                         ->yy_ch_buf[number_to_move]),
                                   1, (yy_size_t)num_to_read, yyin)) == 0 &&
                   ferror(yyin)) {
                if (errno != EINTR) {
                    yy_fatal_error("input in flex scanner failed");
                    break;
                }
                errno = 0;
                clearerr(yyin);
            }
        };
        (yy_buffer_stack)[(yy_buffer_stack_top)]->yy_n_chars = (yy_n_chars);
    }
    if ((yy_n_chars) == 0) {
        if (number_to_move == 0) {
            ret_val = 1;
            yyrestart(yyin);
        } else {
            ret_val = 2;
            (yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buffer_status = 2;
        }
    } else
        ret_val = 0;
    if (((yy_n_chars) + number_to_move) >
        (yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buf_size) {
        int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
        (yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf = (char*)yyrealloc(
            (void*)(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf,
            (yy_size_t)new_size);
        if (!(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf)
            yy_fatal_error("out of dynamic memory in yy_get_next_buffer()");
        (yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buf_size =
            (int)(new_size - 2);
    }
    (yy_n_chars) += number_to_move;
    (yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf[(yy_n_chars)] = 0;
    (yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf[(yy_n_chars) + 1] = 0;
    (yytext) = &(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf[0];
    return ret_val;
}
static yy_state_type yy_get_previous_state(void) {
    yy_state_type yy_current_state;
    char* yy_cp;
    yy_current_state = (yy_start);
    for (yy_cp = (yytext) + 0; yy_cp < (yy_c_buf_p); ++yy_cp) {
        YY_CHAR yy_c = (*yy_cp ? yy_ec[((YY_CHAR)(*yy_cp))] : 1);
        if (yy_accept[yy_current_state]) {
            (yy_last_accepting_state) = yy_current_state;
            (yy_last_accepting_cpos) = yy_cp;
        }
        while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) {
            yy_current_state = (int)yy_def[yy_current_state];
            if (yy_current_state >= 11) yy_c = yy_meta[yy_c];
        }
        yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
    }
    return yy_current_state;
}
static yy_state_type yy_try_NUL_trans(yy_state_type yy_current_state) {
    int yy_is_jam;
    char* yy_cp = (yy_c_buf_p);
    YY_CHAR yy_c = 1;
    if (yy_accept[yy_current_state]) {
        (yy_last_accepting_state) = yy_current_state;
        (yy_last_accepting_cpos) = yy_cp;
    }
    while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) {
        yy_current_state = (int)yy_def[yy_current_state];
        if (yy_current_state >= 11) yy_c = yy_meta[yy_c];
    }
    yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
    yy_is_jam = (yy_current_state == 10);
    return yy_is_jam ? 0 : yy_current_state;
}
static void yyunput(int c, char* yy_bp) {
    char* yy_cp;
    yy_cp = (yy_c_buf_p);
    *yy_cp = (yy_hold_char);
    if (yy_cp < (yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf + 2) {
        int number_to_move = (yy_n_chars) + 2;
        char* dest =
            &(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf
                 [(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buf_size + 2];
        char* source = &(yy_buffer_stack)[(yy_buffer_stack_top)]
                            ->yy_ch_buf[number_to_move];
        while (source > (yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf)
            *--dest = *--source;
        yy_cp += (int)(dest - source);
        yy_bp += (int)(dest - source);
        (yy_buffer_stack)[(yy_buffer_stack_top)]->yy_n_chars = (yy_n_chars) =
            (int)(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buf_size;
        if (yy_cp < (yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf + 2)
            yy_fatal_error("flex scanner push-back overflow");
    }
    *--yy_cp = (char)c;
    (yytext) = yy_bp;
    (yy_hold_char) = *yy_cp;
    (yy_c_buf_p) = yy_cp;
}
static int input(void) {
    int c;
    *(yy_c_buf_p) = (yy_hold_char);
    if (*(yy_c_buf_p) == 0) {
        if ((yy_c_buf_p) <
            &(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf[(yy_n_chars)])
            *(yy_c_buf_p) = '\0';
        else {
            int offset = (int)((yy_c_buf_p) - (yytext));
            ++(yy_c_buf_p);
            switch (yy_get_next_buffer()) {
                case 2:
                    yyrestart(yyin);
                case 1: {
                    if (yywrap()) return 0;
                    if (!(yy_did_buffer_switch_on_eof)) yyrestart(yyin);
                    return input();
                }
                case 0:
                    (yy_c_buf_p) = (yytext) + offset;
                    break;
            }
        }
    }
    c = *(unsigned char*)(yy_c_buf_p);
    *(yy_c_buf_p) = '\0';
    (yy_hold_char) = *++(yy_c_buf_p);
    return c;
}
void yyrestart(FILE* input_file) {
    if (!((yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)]
                            : NULL)) {
        yyensure_buffer_stack();
        (yy_buffer_stack)[(yy_buffer_stack_top)] =
            yy_create_buffer(yyin, 16384);
    }
    yy_init_buffer(
        ((yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)] : NULL),
        input_file);
    yy_load_buffer_state();
}
void yy_switch_to_buffer(YY_BUFFER_STATE new_buffer) {
    yyensure_buffer_stack();
    if (((yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)] : NULL) ==
        new_buffer)
        return;
    if (((yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)] : NULL)) {
        *(yy_c_buf_p) = (yy_hold_char);
        (yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buf_pos = (yy_c_buf_p);
        (yy_buffer_stack)[(yy_buffer_stack_top)]->yy_n_chars = (yy_n_chars);
    }
    (yy_buffer_stack)[(yy_buffer_stack_top)] = new_buffer;
    yy_load_buffer_state();
    (yy_did_buffer_switch_on_eof) = 1;
}
static void yy_load_buffer_state(void) {
    (yy_n_chars) = (yy_buffer_stack)[(yy_buffer_stack_top)]->yy_n_chars;
    (yytext) = (yy_c_buf_p) =
        (yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buf_pos;
    yyin = (yy_buffer_stack)[(yy_buffer_stack_top)]->yy_input_file;
    (yy_hold_char) = *(yy_c_buf_p);
}
YY_BUFFER_STATE yy_create_buffer(FILE* file, int size) {
    YY_BUFFER_STATE b;
    b = (YY_BUFFER_STATE)yyalloc(sizeof(struct yy_buffer_state));
    if (!b) yy_fatal_error("out of dynamic memory in yy_create_buffer()");
    b->yy_buf_size = size;
    b->yy_ch_buf = (char*)yyalloc((yy_size_t)(b->yy_buf_size + 2));
    if (!b->yy_ch_buf)
        yy_fatal_error("out of dynamic memory in yy_create_buffer()");
    b->yy_is_our_buffer = 1;
    yy_init_buffer(b, file);
    return b;
}
void yy_delete_buffer(YY_BUFFER_STATE b) {
    if (!b) return;
    if (b ==
        ((yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)] : NULL))
        (yy_buffer_stack)[(yy_buffer_stack_top)] = (YY_BUFFER_STATE)0;
    if (b->yy_is_our_buffer) yyfree((void*)b->yy_ch_buf);
    yyfree((void*)b);
}
static void yy_init_buffer(YY_BUFFER_STATE b, FILE* file) {
    int oerrno = errno;
    yy_flush_buffer(b);
    b->yy_input_file = file;
    b->yy_fill_buffer = 1;
    if (b !=
        ((yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)] : NULL)) {
        b->yy_bs_lineno = 1;
        b->yy_bs_column = 0;
    }
    b->yy_is_interactive = file ? (isatty(fileno(file)) > 0) : 0;
    errno = oerrno;
}
void yy_flush_buffer(YY_BUFFER_STATE b) {
    if (!b) return;
    b->yy_n_chars = 0;
    b->yy_ch_buf[0] = 0;
    b->yy_ch_buf[1] = 0;
    b->yy_buf_pos = &b->yy_ch_buf[0];
    b->yy_at_bol = 1;
    b->yy_buffer_status = 0;
    if (b ==
        ((yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)] : NULL))
        yy_load_buffer_state();
}
void yypush_buffer_state(YY_BUFFER_STATE new_buffer) {
    if (new_buffer == NULL) return;
    yyensure_buffer_stack();
    if (((yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)] : NULL)) {
        *(yy_c_buf_p) = (yy_hold_char);
        (yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buf_pos = (yy_c_buf_p);
        (yy_buffer_stack)[(yy_buffer_stack_top)]->yy_n_chars = (yy_n_chars);
    }
    if (((yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)] : NULL))
        (yy_buffer_stack_top)++;
    (yy_buffer_stack)[(yy_buffer_stack_top)] = new_buffer;
    yy_load_buffer_state();
    (yy_did_buffer_switch_on_eof) = 1;
}
void yypop_buffer_state(void) {
    if (!((yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)] : NULL))
        return;
    yy_delete_buffer(
        ((yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)] : NULL));
    (yy_buffer_stack)[(yy_buffer_stack_top)] = NULL;
    if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top);
    if (((yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)] : NULL)) {
        yy_load_buffer_state();
        (yy_did_buffer_switch_on_eof) = 1;
    }
}
static void yyensure_buffer_stack(void) {
    yy_size_t num_to_alloc;
    if (!(yy_buffer_stack)) {
        num_to_alloc = 1;
        (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc(
            num_to_alloc * sizeof(struct yy_buffer_state*));
        if (!(yy_buffer_stack))
            yy_fatal_error("out of dynamic memory in yyensure_buffer_stack()");
        memset((yy_buffer_stack), 0,
               num_to_alloc * sizeof(struct yy_buffer_state*));
        (yy_buffer_stack_max) = num_to_alloc;
        (yy_buffer_stack_top) = 0;
        return;
    }
    if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1) {
        yy_size_t grow_size = 8;
        num_to_alloc = (yy_buffer_stack_max) + grow_size;
        (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc(
            (yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*));
        if (!(yy_buffer_stack))
            yy_fatal_error("out of dynamic memory in yyensure_buffer_stack()");
        memset((yy_buffer_stack) + (yy_buffer_stack_max), 0,
               grow_size * sizeof(struct yy_buffer_state*));
        (yy_buffer_stack_max) = num_to_alloc;
    }
}
YY_BUFFER_STATE yy_scan_buffer(char* base, yy_size_t size) {
    YY_BUFFER_STATE b;
    if (size < 2 || base[size - 2] != 0 || base[size - 1] != 0) return NULL;
    b = (YY_BUFFER_STATE)yyalloc(sizeof(struct yy_buffer_state));
    if (!b) yy_fatal_error("out of dynamic memory in yy_scan_buffer()");
    b->yy_buf_size = (int)(size - 2);
    b->yy_buf_pos = b->yy_ch_buf = base;
    b->yy_is_our_buffer = 0;
    b->yy_input_file = NULL;
    b->yy_n_chars = b->yy_buf_size;
    b->yy_is_interactive = 0;
    b->yy_at_bol = 1;
    b->yy_fill_buffer = 0;
    b->yy_buffer_status = 0;
    yy_switch_to_buffer(b);
    return b;
}
YY_BUFFER_STATE yy_scan_string(const char* yystr) {
    return yy_scan_bytes(yystr, (int)strlen(yystr));
}
YY_BUFFER_STATE yy_scan_bytes(const char* yybytes, int _yybytes_len) {
    YY_BUFFER_STATE b;
    char* buf;
    yy_size_t n;
    int i;
    n = (yy_size_t)(_yybytes_len + 2);
    buf = (char*)yyalloc(n);
    if (!buf) yy_fatal_error("out of dynamic memory in yy_scan_bytes()");
    for (i = 0; i < _yybytes_len; ++i) buf[i] = yybytes[i];
    buf[_yybytes_len] = buf[_yybytes_len + 1] = 0;
    b = yy_scan_buffer(buf, n);
    if (!b) yy_fatal_error("bad buffer in yy_scan_bytes()");
    b->yy_is_our_buffer = 1;
    return b;
}
static void yy_fatal_error(const char* msg) {
    fprintf(stderr, "%s\n", msg);
    exit(2);
}
int yyget_lineno(void) {
    return yylineno;
}
FILE* yyget_in(void) {
    return yyin;
}
FILE* yyget_out(void) {
    return yyout;
}
int yyget_leng(void) {
    return yyleng;
}
char* yyget_text(void) {
    return yytext;
}
void yyset_lineno(int _line_number) {
    yylineno = _line_number;
}
void yyset_in(FILE* _in_str) {
    yyin = _in_str;
}
void yyset_out(FILE* _out_str) {
    yyout = _out_str;
}
int yyget_debug(void) {
    return yy_flex_debug;
}
void yyset_debug(int _bdebug) {
    yy_flex_debug = _bdebug;
}
static int yy_init_globals(void) {
    (yy_buffer_stack) = NULL;
    (yy_buffer_stack_top) = 0;
    (yy_buffer_stack_max) = 0;
    (yy_c_buf_p) = NULL;
    (yy_init) = 0;
    (yy_start) = 0;
    yyin = NULL;
    yyout = NULL;
    return 0;
}
int yylex_destroy(void) {
    while (
        ((yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)] : NULL)) {
        yy_delete_buffer(((yy_buffer_stack)
                              ? (yy_buffer_stack)[(yy_buffer_stack_top)]
                              : NULL));
        (yy_buffer_stack)[(yy_buffer_stack_top)] = NULL;
        yypop_buffer_state();
    }
    yyfree((yy_buffer_stack));
    (yy_buffer_stack) = NULL;
    yy_init_globals();
    return 0;
}
void* yyalloc(yy_size_t size) {
    return malloc(size);
}
void* yyrealloc(void* ptr, yy_size_t size) {
    return realloc(ptr, size);
}
void yyfree(void* ptr) {
    free((char*)ptr);
}
int yywrap(void) {
    return 1;
}
int yylex(void);
void yyerror(char*);
int MAX(int a, int b) {
    if (a < b) return b;
    return a;
}
enum yysymbol_kind_t {
    YYSYMBOL_YYEMPTY = -2,
    YYSYMBOL_YYEOF = 0,
    YYSYMBOL_YYerror = 1,
    YYSYMBOL_YYUNDEF = 2,
    YYSYMBOL_NEWLINE = 3,
    YYSYMBOL_ARROW = 4,
    YYSYMBOL_5_ = 5,
    YYSYMBOL_6_ = 6,
    YYSYMBOL_YYACCEPT = 7,
    YYSYMBOL_program = 8,
    YYSYMBOL_expr = 9
};
typedef enum yysymbol_kind_t yysymbol_kind_t;
typedef signed char yytype_int8;
typedef short yytype_int16;
typedef unsigned char yytype_uint8;
typedef unsigned short yytype_uint16;
typedef yytype_int8 yy_state_t;
typedef int yy_state_fast_t;
union yyalloc {
    yy_state_t yyss_alloc;
    YYSTYPE yyvs_alloc;
};
static const yytype_int8 yytranslate[] = {
    0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 6, 2, 2, 2, 2, 2, 2,
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4};
static const yytype_int8 yyrline[] = {0, 16, 16, 21, 25, 29};
static const char* yysymbol_name(yysymbol_kind_t yysymbol);
static const char* const yytname[] = {"\"end of file\"",
                                      "error",
                                      "\"invalid token\"",
                                      "NEWLINE",
                                      "ARROW",
                                      "'('",
                                      "')'",
                                      "$accept",
                                      "program",
                                      "expr",
                                      ((void*)0)};
static const char* yysymbol_name(yysymbol_kind_t yysymbol) {
    return yytname[yysymbol];
}
static const yytype_int8 yypact[] = {6, 0, 2, 5, -4, -3, -4, -4, 6, -4, 8};
static const yytype_int8 yydefact[] = {0, 0, 0, 0, 3, 0, 1, 2, 0, 4, 5};
static const yytype_int8 yypgoto[] = {-4, -4, -1};
static const yytype_int8 yydefgoto[] = {0, 2, 3};
static const yytype_int8 yytable[] = {5, 8, 6, 9, 0, 1, 4, 10, 7, 8, 0, 1, 8};
static const yytype_int8 yycheck[] = {1, 4, 0, 6, -1, 5, 6, 8, 3, 4, -1, 5, 4};
static const yytype_int8 yystos[] = {0, 5, 8, 9, 6, 9, 0, 3, 4, 6, 9};
static const yytype_int8 yyr1[] = {0, 7, 8, 9, 9, 9};
static const yytype_int8 yyr2[] = {0, 2, 2, 2, 3, 3};
enum { YYENOMEM = -2 };
static void yy_symbol_value_print(FILE* yyo, yysymbol_kind_t yykind,
                                  YYSTYPE const* const yyvaluep) {
    FILE* yyoutput = yyo;
    ((void)(yyoutput));
    if (!yyvaluep) return;
    ((void)(yykind));
}
static void yy_symbol_print(FILE* yyo, yysymbol_kind_t yykind,
                            YYSTYPE const* const yyvaluep) {
    fprintf(yyo, "%s %s (", yykind < 7 ? "token" : "nterm",
            yysymbol_name(yykind));
    yy_symbol_value_print(yyo, yykind, yyvaluep);
    fprintf(yyo, ")");
}
static void yy_stack_print(yy_state_t* yybottom, yy_state_t* yytop) {
    fprintf(stderr, "Stack now");
    for (; yybottom <= yytop; yybottom++) {
        int yybot = *yybottom;
        fprintf(stderr, " %d", yybot);
    }
    fprintf(stderr, "\n");
}
static void yy_reduce_print(yy_state_t* yyssp, YYSTYPE* yyvsp, int yyrule) {
    int yylno = yyrline[yyrule];
    int yynrhs = yyr2[yyrule];
    int yyi;
    fprintf(stderr, "Reducing stack by rule %d (line %d):\n", yyrule - 1,
            yylno);
    for (yyi = 0; yyi < yynrhs; yyi++) {
        fprintf(stderr, "   $%d = ", yyi + 1);
        yy_symbol_print(stderr,
                        ((yysymbol_kind_t)(yystos[+yyssp[yyi + 1 - yynrhs]])),
                        &yyvsp[(yyi + 1) - (yynrhs)]);
        fprintf(stderr, "\n");
    }
}
int yydebug;
static void yydestruct(const char* yymsg, yysymbol_kind_t yykind,
                       YYSTYPE* yyvaluep) {
    ((void)(yyvaluep));
    if (!yymsg) yymsg = "Deleting";
    do {
        if (yydebug) {
            fprintf(stderr, "%s ", yymsg);
            yy_symbol_print(stderr, yykind, yyvaluep);
            fprintf(stderr, "\n");
        }
    } while (0);
    ((void)(yykind));
}
int yychar;
YYSTYPE yylval;
int yynerrs;
int yyparse(void) {
    yy_state_fast_t yystate = 0;
    int yyerrstatus = 0;
    long yystacksize = 200;
    yy_state_t yyssa[200];
    yy_state_t* yyss = yyssa;
    yy_state_t* yyssp = yyss;
    YYSTYPE yyvsa[200];
    YYSTYPE* yyvs = yyvsa;
    YYSTYPE* yyvsp = yyvs;
    int yyn;
    int yyresult;
    yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
    YYSTYPE yyval;
    int yylen = 0;
    do {
        if (yydebug) fprintf(stderr, "Starting parse\n");
    } while (0);
    yychar = -2;
    goto yysetstate;
yynewstate:
    yyssp++;
yysetstate:
    do {
        if (yydebug) fprintf(stderr, "Entering state %d\n", yystate);
    } while (0);
    ((void)(0 && (0 <= yystate && yystate < 11)));
    *yyssp = ((yy_state_t)(yystate));
    do {
        if (yydebug) yy_stack_print((yyss), (yyssp));
    } while (0);
    if (yyss + yystacksize - 1 <= yyssp) {
        long yysize = yyssp - yyss + 1;
        if (10000 <= yystacksize) goto yyexhaustedlab;
        yystacksize *= 2;
        if (10000 < yystacksize) yystacksize = 10000;
        {
            yy_state_t* yyss1 = yyss;
            union yyalloc* yyptr = ((union yyalloc*)(malloc(
                ((unsigned)(((yystacksize) * (((long)(sizeof(yy_state_t))) +
                                              ((long)(sizeof(YYSTYPE)))) +
                             (((long)(sizeof(union yyalloc))) - 1)))))));
            if (!yyptr) goto yyexhaustedlab;
            do {
                long yynewbytes;
                do {
                    long yyi;
                    for (yyi = 0; yyi < (yysize); yyi++)
                        (&yyptr->yyss_alloc)[yyi] = (yyss)[yyi];
                } while (0);
                yyss = &yyptr->yyss_alloc;
                yynewbytes = yystacksize * ((long)(sizeof(*yyss))) +
                             (((long)(sizeof(union yyalloc))) - 1);
                yyptr += yynewbytes / ((long)(sizeof(*yyptr)));
            } while (0);
            do {
                long yynewbytes;
                do {
                    long yyi;
                    for (yyi = 0; yyi < (yysize); yyi++)
                        (&yyptr->yyvs_alloc)[yyi] = (yyvs)[yyi];
                } while (0);
                yyvs = &yyptr->yyvs_alloc;
                yynewbytes = yystacksize * ((long)(sizeof(*yyvs))) +
                             (((long)(sizeof(union yyalloc))) - 1);
                yyptr += yynewbytes / ((long)(sizeof(*yyptr)));
            } while (0);
            if (yyss1 != yyssa) free(yyss1);
        }
        yyssp = yyss + yysize - 1;
        yyvsp = yyvs + yysize - 1;
        do {
            if (yydebug)
                fprintf(stderr, "Stack size increased to %ld\n",
                        ((long)(yystacksize)));
        } while (0);
        if (yyss + yystacksize - 1 <= yyssp) goto yyabortlab;
    }
    if (yystate == 6) goto yyacceptlab;
    goto yybackup;
yybackup:
    yyn = yypact[yystate];
    if (((yyn) == (-4))) goto yydefault;
    if (yychar == -2) {
        do {
            if (yydebug) fprintf(stderr, "Reading a token\n");
        } while (0);
        yychar = yylex();
    }
    if (yychar <= 0) {
        yychar = 0;
        yytoken = YYSYMBOL_YYEOF;
        do {
            if (yydebug) fprintf(stderr, "Now at end of input.\n");
        } while (0);
    } else if (yychar == 256) {
        yychar = 257;
        yytoken = YYSYMBOL_YYerror;
        goto yyerrlab1;
    } else {
        yytoken = (0 <= (yychar) && (yychar) <= 259
                       ? ((yysymbol_kind_t)(yytranslate[yychar]))
                       : YYSYMBOL_YYUNDEF);
        do {
            if (yydebug) {
                fprintf(stderr, "%s ", "Next token is");
                yy_symbol_print(stderr, yytoken, &yylval);
                fprintf(stderr, "\n");
            }
        } while (0);
    }
    yyn += yytoken;
    if (yyn < 0 || 12 < yyn || yycheck[yyn] != yytoken) goto yydefault;
    yyn = yytable[yyn];
    if (yyn <= 0) {
        if (0) goto yyerrlab;
        yyn = -yyn;
        goto yyreduce;
    }
    if (yyerrstatus) yyerrstatus--;
    do {
        if (yydebug) {
            fprintf(stderr, "%s ", "Shifting");
            yy_symbol_print(stderr, yytoken, &yylval);
            fprintf(stderr, "\n");
        }
    } while (0);
    yystate = yyn;
    *++yyvsp = yylval;
    yychar = -2;
    goto yynewstate;
yydefault:
    yyn = yydefact[yystate];
    if (yyn == 0) goto yyerrlab;
    goto yyreduce;
yyreduce:
    yylen = yyr2[yyn];
    yyval = yyvsp[1 - yylen];
    do {
        if (yydebug) yy_reduce_print(yyssp, yyvsp, yyn);
    } while (0);
    switch (yyn) {
        case 2: {
            return yyval;
        } break;
        case 3: {
            yyval = 0;
        } break;
        case 4: {
            yyval = yyvsp[-1];
        } break;
        case 5: {
            yyval = MAX(yyvsp[-2] + 1, yyvsp[0]);
        } break;
        default:
            break;
    }
    do {
        if (yydebug) {
            fprintf(stderr, "%s ", "-> $$ =");
            yy_symbol_print(stderr, ((yysymbol_kind_t)(yyr1[yyn])), &yyval);
            fprintf(stderr, "\n");
        }
    } while (0);
    (yyvsp -= (yylen), yyssp -= (yylen));
    yylen = 0;
    *++yyvsp = yyval;
    {
        const int yylhs = yyr1[yyn] - 7;
        const int yyi = yypgoto[yylhs] + *yyssp;
        yystate = (0 <= yyi && yyi <= 12 && yycheck[yyi] == *yyssp
                       ? yytable[yyi]
                       : yydefgoto[yylhs]);
    }
    goto yynewstate;
yyerrlab:
    yytoken = yychar == -2 ? YYSYMBOL_YYEMPTY
                           : (0 <= (yychar) && (yychar) <= 259
                                  ? ((yysymbol_kind_t)(yytranslate[yychar]))
                                  : YYSYMBOL_YYUNDEF);
    if (!yyerrstatus) {
        ++yynerrs;
        yyerror("syntax error");
    }
    if (yyerrstatus == 3) {
        if (yychar <= 0) {
            if (yychar == 0) goto yyabortlab;
        } else {
            yydestruct("Error: discarding", yytoken, &yylval);
            yychar = -2;
        }
    }
    goto yyerrlab1;
yyerrorlab:
    if (0) goto yyerrorlab;
    ++yynerrs;
    (yyvsp -= (yylen), yyssp -= (yylen));
    yylen = 0;
    do {
        if (yydebug) yy_stack_print((yyss), (yyssp));
    } while (0);
    yystate = *yyssp;
    goto yyerrlab1;
yyerrlab1:
    yyerrstatus = 3;
    for (;;) {
        yyn = yypact[yystate];
        if (!((yyn) == (-4))) {
            yyn += YYSYMBOL_YYerror;
            if (0 <= yyn && yyn <= 12 && yycheck[yyn] == YYSYMBOL_YYerror) {
                yyn = yytable[yyn];
                if (0 < yyn) break;
            }
        }
        if (yyssp == yyss) goto yyabortlab;
        yydestruct("Error: popping", ((yysymbol_kind_t)(yystos[yystate])),
                   yyvsp);
        (yyvsp -= (1), yyssp -= (1));
        yystate = *yyssp;
        do {
            if (yydebug) yy_stack_print((yyss), (yyssp));
        } while (0);
    }
    *++yyvsp = yylval;
    do {
        if (yydebug) {
            fprintf(stderr, "%s ", "Shifting");
            yy_symbol_print(stderr, ((yysymbol_kind_t)(yystos[yyn])), yyvsp);
            fprintf(stderr, "\n");
        }
    } while (0);
    yystate = yyn;
    goto yynewstate;
yyacceptlab:
    yyresult = 0;
    goto yyreturnlab;
yyabortlab:
    yyresult = 1;
    goto yyreturnlab;
yyexhaustedlab:
    yyerror("memory exhausted");
    yyresult = 2;
    goto yyreturnlab;
yyreturnlab:
    if (yychar != -2) {
        yytoken = (0 <= (yychar) && (yychar) <= 259
                       ? ((yysymbol_kind_t)(yytranslate[yychar]))
                       : YYSYMBOL_YYUNDEF);
        yydestruct("Cleanup: discarding lookahead", yytoken, &yylval);
    }
    (yyvsp -= (yylen), yyssp -= (yylen));
    do {
        if (yydebug) yy_stack_print((yyss), (yyssp));
    } while (0);
    while (yyssp != yyss) {
        yydestruct("Cleanup: popping", ((yysymbol_kind_t)(yystos[+*yyssp])),
                   yyvsp);
        (yyvsp -= (1), yyssp -= (1));
    }
    if (yyss != yyssa) free(yyss);
    return yyresult;
}
void yyerror(char* s) {
    fprintf(stderr, "%s\n", s);
}
int main(void) {
    printf("%d\n", yyparse());
    return 0;
}