#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
scalar_t__ EOF;
int check_sum(char *, int /*<<< orphan*/, int);
char getchar();
int /*<<< orphan*/ puts(char *);
scalar_t__ scanf(char *, int *);
int main() {
  int target;
  char tree[4096];
  int count, paren;
  char ch;
  while (scanf("%d", &target) != EOF) {
    count = 0;
    paren = 0;
    while (1) {
      ch = getchar();
      if (ch == ' ' || ch == '\t' || ch == '\n') {
        continue;
      }
      switch (ch) {
      case '(':
        tree[count++] = ch;
        paren++;
        break;
      case ')':
        tree[count++] = ch;
        paren--;
        break;
      default:
        tree[count++] = ch;
        break;
      }
      if (count > 0 && paren == 0) {
        tree[count] = '\0';
        break;
      }
    }
    if (tree[0] == '(' && tree[1] == ')') {
      puts("no");
    } else if (check_sum(tree, 0, target) == 1) {
      puts("yes");
    } else {
      puts("no");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1020,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    0x2e7f(%rip),%rcx
cmp    (%rcx),%rax
je     1324 <main+0x1e4>
movl   $0x0,-0x1014(%rbp)
movl   $0x0,-0x1018(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x1019(%rbp)
movsbl -0x1019(%rbp),%eax
cmp    $0x20,%eax
je     11c3 <main+0x83>
movsbl -0x1019(%rbp),%eax
cmp    $0x9,%eax
je     11c3 <main+0x83>
movsbl -0x1019(%rbp),%eax
cmp    $0xa,%eax
jne    11c8 <main+0x88>
jmp    1186 <main+0x46>
movsbl -0x1019(%rbp),%eax
mov    %eax,-0x1020(%rbp)
sub    $0x28,%eax
je     11f7 <main+0xb7>
jmp    11e3 <main+0xa3>
mov    -0x1020(%rbp),%eax
sub    $0x29,%eax
je     122b <main+0xeb>
jmp    125f <main+0x11f>
mov    -0x1019(%rbp),%cl
mov    -0x1014(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x1014(%rbp)
cltq
mov    %cl,-0x1010(%rbp,%rax,1)
mov    -0x1018(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1018(%rbp)
jmp    127f <main+0x13f>
mov    -0x1019(%rbp),%cl
mov    -0x1014(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x1014(%rbp)
cltq
mov    %cl,-0x1010(%rbp,%rax,1)
mov    -0x1018(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1018(%rbp)
jmp    127f <main+0x13f>
mov    -0x1019(%rbp),%cl
mov    -0x1014(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x1014(%rbp)
cltq
mov    %cl,-0x1010(%rbp,%rax,1)
cmpl   $0x0,-0x1014(%rbp)
jle    12ad <main+0x16d>
cmpl   $0x0,-0x1018(%rbp)
jne    12ad <main+0x16d>
movslq -0x1014(%rbp),%rax
movb   $0x0,-0x1010(%rbp,%rax,1)
jmp    12b2 <main+0x172>
jmp    1186 <main+0x46>
movsbl -0x1010(%rbp),%eax
cmp    $0x28,%eax
jne    12e3 <main+0x1a3>
movsbl -0x100f(%rbp),%eax
cmp    $0x29,%eax
jne    12e3 <main+0x1a3>
lea    0xd2a(%rip),%rdi
call   1030 <puts@plt>
jmp    131f <main+0x1df>
lea    -0x1010(%rbp),%rdi
mov    -0x8(%rbp),%edx
xor    %esi,%esi
call   1040 <check_sum@plt>
cmp    $0x1,%eax
jne    130e <main+0x1ce>
lea    0xd02(%rip),%rdi
call   1030 <puts@plt>
jmp    131a <main+0x1da>
lea    0xcee(%rip),%rdi
call   1030 <puts@plt>
jmp    131f <main+0x1df>
jmp    1152 <main+0x12>
xor    %eax,%eax
add    $0x1020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1018,%rsp
lea    0xea8(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x2e7f(%rip),%r13
cmp    0x0(%r13),%rax
jne    1183 <main+0x43>
xor    %eax,%eax
add    $0x1018,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe79(%rip),%rbx
lea    0xc(%rsp),%r12
movabs $0x100000600,%rbp
xor    %r15d,%r15d
xor    %r14d,%r14d
jmp    11f0 <main+0xb0>
mov    0xc(%rsp),%edx
lea    0x10(%rsp),%rdi
xor    %esi,%esi
call   1040 <check_sum@plt>
cmp    $0x1,%eax
mov    %rbx,%rdi
lea    0xe48(%rip),%rax
cmove  %rax,%rdi
call   1030 <puts@plt>
lea    0xe32(%rip),%rdi
mov    %r12,%rsi
call   1060 <scanf@plt>
xor    %r15d,%r15d
mov    $0x0,%r14d
cmp    0x0(%r13),%rax
je     116f <main+0x2f>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0x20,%al
ja     1204 <main+0xc4>
movzbl %al,%ecx
bt     %rcx,%rbp
jb     11f0 <main+0xb0>
movsbl %al,%ecx
cmp    $0x29,%ecx
je     121c <main+0xdc>
cmp    $0x28,%ecx
jne    1227 <main+0xe7>
mov    %al,0x10(%rsp,%r15,1)
add    $0x1,%r14d
jmp    122c <main+0xec>
mov    %al,0x10(%rsp,%r15,1)
add    $0xffffffff,%r14d
jmp    122c <main+0xec>
mov    %al,0x10(%rsp,%r15,1)
add    $0x1,%r15
test   %r14d,%r14d
jne    11f0 <main+0xb0>
mov    %r15d,%eax
movb   $0x0,0x10(%rsp,%rax,1)
cmpb   $0x28,0x10(%rsp)
jne    11a1 <main+0x61>
cmpb   $0x29,0x11(%rsp)
mov    %rbx,%rdi
je     11c2 <main+0x82>
jmp    11a1 <main+0x61>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.1 = [3 x i8] c"no\00"
@.str.2 = [4 x i8] c"yes\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [4096 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
store i32 0, i32* %1
br label %7
7: ; preds = %84, %0
%8 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%9 = load i64, i64* @EOF
%10 = icmp ne i64 %8, %9
br i1 %10, label %11, label %85
11: ; preds = %7
store i32 0, i32* %4
store i32 0, i32* %5
br label %12
12: ; preds = %11, %25, %61
%13 = call signext i8 (...) @getchar()
store i8 %13, i8* %6
%14 = load i8, i8* %6
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 32
br i1 %16, label %25, label %17
17: ; preds = %12
%18 = load i8, i8* %6
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 9
br i1 %20, label %25, label %21
21: ; preds = %17
%22 = load i8, i8* %6
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 10
br i1 %24, label %25, label %26
25: ; preds = %21, %17, %12
br label %12
26: ; preds = %21
%27 = load i8, i8* %6
%28 = sext i8 %27 to i32
switch i32 %28, label %45 [
i32 40, label %29
i32 41, label %37
]
29: ; preds = %26
%30 = load i8, i8* %6
%31 = load i32, i32* %4
%32 = add nsw i32 %31, 1
store i32 %32, i32* %4
%33 = sext i32 %31 to i64
%34 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 %33
store i8 %30, i8* %34
%35 = load i32, i32* %5
%36 = add nsw i32 %35, 1
store i32 %36, i32* %5
br label %51
37: ; preds = %26
%38 = load i8, i8* %6
%39 = load i32, i32* %4
%40 = add nsw i32 %39, 1
store i32 %40, i32* %4
%41 = sext i32 %39 to i64
%42 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 %41
store i8 %38, i8* %42
%43 = load i32, i32* %5
%44 = add nsw i32 %43, -1
store i32 %44, i32* %5
br label %51
45: ; preds = %26
%46 = load i8, i8* %6
%47 = load i32, i32* %4
%48 = add nsw i32 %47, 1
store i32 %48, i32* %4
%49 = sext i32 %47 to i64
%50 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 %49
store i8 %46, i8* %50
br label %51
51: ; preds = %45, %37, %29
%52 = load i32, i32* %4
%53 = icmp sgt i32 %52, 0
br i1 %53, label %54, label %61
54: ; preds = %51
%55 = load i32, i32* %5
%56 = icmp eq i32 %55, 0
br i1 %56, label %57, label %61
57: ; preds = %54
%58 = load i32, i32* %4
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 %59
store i8 0, i8* %60
br label %62
61: ; preds = %54, %51
br label %12
62: ; preds = %57
%63 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%64 = load i8, i8* %63
%65 = sext i8 %64 to i32
%66 = icmp eq i32 %65, 40
br i1 %66, label %67, label %74
67: ; preds = %62
%68 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 1
%69 = load i8, i8* %68
%70 = sext i8 %69 to i32
%71 = icmp eq i32 %70, 41
br i1 %71, label %72, label %74
72: ; preds = %67
%73 = call i32 @puts(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %84
74: ; preds = %67, %62
%75 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%76 = load i32, i32* %2
%77 = call i32 @check_sum(i8* %75, i32 0, i32 %76)
%78 = icmp eq i32 %77, 1
br i1 %78, label %79, label %81
79: ; preds = %74
%80 = call i32 @puts(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %83
81: ; preds = %74
%82 = call i32 @puts(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %83
83: ; preds = %81, %79
br label %84
84: ; preds = %83, %72
br label %7
85: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.1 = [3 x i8] c"no\00"
@.str.2 = [4 x i8] c"yes\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4096 x i8]
%3 = bitcast i32* %1 to i8*
%4 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%5 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i64, i64* @EOF
%7 = icmp eq i64 %5, %6
br i1 %7, label %52, label %8
8: ; preds = %0
%9 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 1
br label %10
10: ; preds = %30, %8
%11 = phi i64 [ 0, %8 ], [ %31, %30 ]
%12 = phi i32 [ 0, %8 ], [ %32, %30 ]
br label %13
13: ; preds = %15, %10
%14 = call signext i8 (...) @getchar()
switch i8 %14, label %16 [
i8 32, label %15
i8 10, label %15
i8 9, label %15
]
15: ; preds = %13, %13, %13
br label %13
16: ; preds = %13
%17 = sext i8 %14 to i32
switch i32 %17, label %24 [
i32 40, label %18
i32 41, label %21
]
18: ; preds = %16
%19 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 %11
store i8 %14, i8* %19
%20 = add nsw i32 %12, 1
br label %26
21: ; preds = %16
%22 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 %11
store i8 %14, i8* %22
%23 = add nsw i32 %12, -1
br label %26
24: ; preds = %16
%25 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 %11
store i8 %14, i8* %25
br label %26
26: ; preds = %24, %21, %18
%27 = phi i32 [ %12, %24 ], [ %23, %21 ], [ %20, %18 ]
%28 = add nuw i64 %11, 1
%29 = icmp eq i32 %27, 0
br i1 %29, label %33, label %30
30: ; preds = %26, %46
%31 = phi i64 [ %28, %26 ], [ 0, %46 ]
%32 = phi i32 [ %27, %26 ], [ 0, %46 ]
br label %10
33: ; preds = %26
%34 = and i64 %28, 4294967295
%35 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 %34
store i8 0, i8* %35
%36 = load i8, i8* %4
%37 = icmp eq i8 %36, 40
%38 = load i8, i8* %9
%39 = icmp eq i8 %38, 41
%40 = select i1 %37, i1 %39, i1 false
br i1 %40, label %46, label %41
41: ; preds = %33
%42 = load i32, i32* %1
%43 = call i32 @check_sum(i8* %4, i32 0, i32 %42)
%44 = icmp eq i32 %43, 1
%45 = select i1 %44, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0)
br label %46
46: ; preds = %41, %33
%47 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %33 ], [ %45, %41 ]
%48 = call i32 @puts(i8* dereferenceable(1) %47)
%49 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%50 = load i64, i64* @EOF
%51 = icmp eq i64 %49, %50
br i1 %51, label %52, label %30
52: ; preds = %46, %0
ret i32 0
}