you give bracket sequence s necessarily regular a bracket sequence string contain character a regular bracket sequence bracket sequence transform correct arithmetic expression insert character 1 original character sequence for example bracket sequence regular result expression 11 111 notyour problem calculate number regular bracket sequence length 2n contain give bracket sequence s substre consecutive sequence character modulo 1097 1000000007