Harryxun/stf_run huggingface dataset:
#coding:utf-8
n, a, b = map(int, input().split())
count = n // (a+b)
mod = n % (a+b)
#print(count, mod)
ball = ('b'* a + 'r'* b) * count

if mod >= 1:
    ball = ball + 'b'* a + 'r'* b

ans_ball = ball[:n]
print(ans_ball.count('b'))

### FIXED CODE ###

#coding:utf-8
n, a, b = map(int, input().split())

if a == 0 and b == 0:
    print(0)
    exit()

count = n // (a+b)
mod = n % (a+b)

ans = a * count + min(mod, a)
print(ans)
def isM(s):
    return 1<=int(s)<=12

if __name__ == '__main__':
    input = sys.stdin.read()
    F, S = input[:2], input[2:]
    if isM(F) and not isM(S): print "MMYY"
    elif not isM(F) and isM(S): print "YYMM"
    elif isM(F) and isM(S): print "AMBIGUOUS"
    else: print 'NA'

### FIXED CODE ###

import sys

def isM(s):
    if (s[0] == '0' and '1'<=s[1]<='9' ) or \
        (s[0] == '1' and s[1] in ('0', '1', '2')):
        return True
    return False

if __name__ == '__main__':
    input = sys.stdin.read()
    F, S = input[:2], input[2:]
    if isM(F) and not isM(S): print "MMYY"
    elif not isM(F) and isM(S): print "YYMM"
    elif isM(F) and isM(S): print "AMBIGUOUS"
    else: print 'NA'
while True:
    x,y = map(int, input().split())
    if x == 0 and y == 0 :
        break
    elif x <= y :
        print (x,y)
    else x > y :
        print (y,x)

### FIXED CODE ###

while True:
    x,y = map(int, input().split())
    if x == 0 and y == 0 :
        break
    elif x <= y :
        print (x,y)
    else :
        print (y,x)
n = int(input())
a = list(map(int, input().split()))
total = 0
for i in range(n):
    a[i] = a[i] - (i + 1)
if n % 2 == 0:
    ave = a[int(n/2)]
    for i in range(n):
        total += abs(a[i] - ave)
    print(total)
else:
    total2 = 0
    ave = a[int(n/2)]
    for i in range(n):
        total += abs(a[i] - ave)
    ave = a[int((n + 1)/2)]
    for i in range(n):
        total2 += abs(a[i] - ave)
    if total2 >= total:
        print(total)
    else:
        print(total2)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
total = 0
for i in range(n):
    a[i] = a[i] - (i + 1)
if n == 1:
    print(0)
    exit()
a.sort()
if n % 2 == 0:
    ave = a[int(n/2)]
    for i in range(n):
        total += abs(a[i] - ave)
    print(total)
else:
    total2 = 0
    ave = a[int(n/2)]
    for i in range(n):
        total += abs(a[i] - ave)
    ave = a[int((n + 1)/2)]
    for i in range(n):
        total2 += abs(a[i] - ave)
    if total2 >= total:
        print(total)
    else:
        print(total2)
a,b=map(int,input().split())

if a==b
  print("Draw")
elif a==1:
  print("Alice")
elif b==1:
  print("Bob")
elif a>b:
  print("Alice")
else:
  print("Bob")

### FIXED CODE ###

a,b=map(int,input().split())
     
if a==b:
  print("Draw")
elif a==1:
  print("Alice")
elif b==1:
  print("Bob")
elif a>b:
  print("Alice")
else:
  print("Bob")
N = int(input())
A = list(map(int, input().split(' ')))
A = sorted(A)
A = A[::-1]

first_second_biggest_numpairs = []

flag = False
for i in range(N):
    if flag == True:
        flag = False
        continue
    if i < N:
        if A[i] == A[i + 1]:
            if len(first_second_biggest_numpairs) >= 2:
                first_second_biggest_numpairs.append(A[i])
                flag = True
            else:
                break
            
if len(first_second_biggest_numpairs) == 2:
    print(str(first_second_biggest_numpairs[0] * first_second_biggest_numpairs[1]))
else:
    print("0")



### FIXED CODE ###

N = int(input())
A = list(map(int, input().split(' ')))
A = sorted(A)
A = A[::-1]

first_second_biggest_numpairs = []

flag = False
for i in range(N):
    if flag == True:
        flag = False
        continue
    if i + 1 < N:
        if A[i] == A[i + 1]:
            if len(first_second_biggest_numpairs) < 2:
                first_second_biggest_numpairs.append(A[i])
                flag = True
            else:
                break
            
if len(first_second_biggest_numpairs) == 2:
    print(str(first_second_biggest_numpairs[0] * first_second_biggest_numpairs[1]))
else:
    print("0")
def main():
    n = int(input())
    num_list = [int(input()) for _ in range(n)]

    tmp = copy.deepcopy(num_list)
    tmp.sort()

    max_first = max(num_list)
    max_second = tmp[1]
    
    for num in num_list:
        if num == max_first:
            print(max_second)
        else:
            print(max_first)
        
if __name__ == '__main__':
    main()

### FIXED CODE ###

import copy

def main():
    n = int(input())
    num_list = [int(input()) for _ in range(n)]

    tmp = copy.deepcopy(num_list)
    tmp.sort()

    max_first = max(num_list)
    max_second = tmp[n-2]
    
    for num in num_list:
        if num == max_first:
            print(max_second)
            continue
        print(max_first)
        
if __name__ == '__main__':
    main()
while True:
    try:
        n=input()
        m=input()
    except SyntaxError:
        pass
    if n==m==0:break
    S,L=set(),[]
    for i in range(m):
        a,b=map(int,raw_input().split())
        if a==1:
            S.add(b)
        elif b==1:
            S.add(a)
        else:
            L.append((a,b))
    for i in S:
        for s in L:
            if i in s:
                S=S.union(s)
    print len(S)

### FIXED CODE ###

while True:
    n=raw_input()
    if n in "0":break
    try:
        m=input()
    except SyntaxError:
        break
    S,L=set(),[]
    for i in range(m):
        a,b=map(int,raw_input().split())
        if a==1:
            S.add(b)
        elif b==1:
            S.add(a)
        else:
            L.append((a,b))
    for i in S:
        for s in L:
            if i in s:
                S=S.union(s)
    print len(S)
n, t = map(int, input().split())
a, b = [0] * n, [0] * n
for i in range(n):
  a[i], b[i] = map(int, input().split())

dp = [[-1] * (t+1) for i in [0] * n]
def dfs(i, l):
  if(i == n or l <= 0):
    return 0
  elif(dp[i][l] != -1):
    return dp[i][l]
  else:
    dp[i][l] = max(b[i] + dfs(i+1, l - a[i]), dfs(i+1, l))
    return dp[i][l]

print(dfs(0, t))

### FIXED CODE ###

n, t = map(int, input().split())
a, b = [0] * n, [0] * n
for i in range(n):
  a[i], b[i] = map(int, input().split())

dp = [[[0] * (t+1) for i in range(n+1)] for j in range(2)]
for i in range(n):
  for d in range(2):
    for l in range(1,t+1):
      if(l < a[i]):
        dp[d][i+1][l] = max(dp[d][i][l], d*(b[i]+dp[0][i][l-1]))
      else:
        dp[d][i+1][l] = max(dp[d][i][l], b[i]+dp[d][i][l-a[i]], d*(b[i]+dp[0][i][l-1]))

print(dp[1][n][t])
N = int(input())
A = sorted([int(x) for x in input().split()], reverse=True)
ans = 0
for i, ai in enumerate(A):
    f = 1
    for aj in A[i+1:]:
        if ai % aj == 0:
            f = 0
            break
    ans += f
ans -= (A[-1] == A[-2])
print(ans)


### FIXED CODE ###

N = int(input())
A = [int(x) for x in input().split()]
m = max(A)+2
cnt = [0] * m
for a in A:
    cnt[a] += 1
    if cnt[a] == 1:
        for i in range(a+a, m, a):
            cnt[i] += 1
ans = 0
for a in A:
    ans += (cnt[a] == 1)
print(ans)
N = int(input())
L = [(N,0),(1,0), (2,1), (4,2), (8,3), (16,4), (32,5), (64,6)]
sorted_L = sorted(L,key=lambda x:x[0])
print(sorted_L)
for i,j in enumerate(sorted_L):
  if j[0] == N:
    if sorted_L[i][0] == sorted_L[i+1][0]:
      print(sorted_L[i][0])
      break
    else:
      print(sorted_L[i-1][0])
      break


### FIXED CODE ###

N = int(input())
L = [(N,0),(1,0), (2,1), (4,2), (8,3), (16,4), (32,5), (64,6),(128,7)]
sorted_L = sorted(L,key=lambda x:x[0])
for i,j in enumerate(sorted_L):
  if j[0] == N:
    if sorted_L[i][0] == sorted_L[i+1][0]:
      print(sorted_L[i][0])
      break
    else:
      print(sorted_L[i-1][0])
      break
a

### FIXED CODE ###

n = int(input())
d,x = map(int,input().split())
a=[]
for i in range(n):
    a.append(int(input()))
s = 0
for i in range(n):
    day = 1
    while(day<=d):
        s += 1
        day += a[i]
print(s+x)
import math
a,b,n = map(int,input().split())
c = max(0,n // b * b - 1)
ans = mmath.floor(a * c / b) - a * math.floor(c / b)
 
print(ans)

### FIXED CODE ###

#copy
import math
a, b, n = list(map(int, input().split()))
x = min(b-1,n)
ans = math.floor(a*x/b)-a*math.floor(x/b)
print(ans)
import math
X = int(input())
ruto = math.ceil(math.sqrt(2*X))
kari = ruto**2+ruto
for i in range(ruto-1, 0, -1):
    if i**2+i < 2*X:
        ans = i+1
        break
    kari = i**2+i
print(ans)


### FIXED CODE ###

import math
X = int(input())
ruto = math.ceil(math.sqrt(2*X))+1
kari = ruto**2+ruto
ans=1
for i in range(ruto-1, 0, -1):
    if i**2+i < 2*X:
        ans = i+1
        break
    kari = i**2+i
print(ans)
# coding=utf-8
import math


r = int(input())
print('{0:f} {1:f}'.format(r*r*math.pi, 2*r*math.pi))

### FIXED CODE ###

# coding=utf-8
import math


r = float(input())
print('{0:f} {1:f}'.format(r*r*math.pi, 2*r*math.pi))
n,m=map(int,input().split())
a=[int(i) for i in input().split()]

a.sort()
for i in range(m):
 b,c=map(int,input().split())
 for i in range(b):
  if a[i] < c:
   a[i] = c
  else:
   break
 for j in range(i+1):
  if a[j] > a[j+i+1]:
   a[j],a[j+i+1]=a[j+i+1],a[j]
  else:
   break

print(sum(a))

### FIXED CODE ###

n,m=map(int,input().split())
l=[[int(x),1] for x in input().split()]
for i in range(m):
  b,c=map(int,input().split())
  l.append([c,b])

s = sorted(l, key=lambda x:x[0], reverse=True)

c=n
t=0
i=0
while c>0:
  n = s[i][1] if c>=s[i][1] else c
  t += s[i][0] * n
  c -= n
  i += 1

print(t)
def f(v):
    for i in range(4):
        if l[i] < v[i]:
            return
    else:
        return True

while True:
    N = int(raw_input())
    if N == 0: break
    data = {}
    for n in range(N):
        i, p, q, r = map(int, raw_input().split())
        data[i] = [p, q, r]
    l = map(int, raw_input().split())
    flag = False
    for i, v in data.items():
        c = 4*v[0]+9*v[1]+4*v[2]
        v.append(c)
        if f(v):

### FIXED CODE ###

def f(v):
    for i in range(4):
        if l[i] < v[i]:
            return
    else:
        return True

while True:
    N = int(raw_input())
    if N == 0: break
    data = [map(int, raw_input().split()) for n in range(N)]
    l = map(int, raw_input().split())
    flag = False
    for v in data:
        v.append(4*v[1]+9*v[2]+4*v[3])
        if f(v[1:]):
            print v[0]
            flag = True
    if not flag:
        print 'NA'
string = list(input());
if (string[2] == string[3] && string[4] == string[5]):
	print("Yes");
else:
    print("No");

### FIXED CODE ###

string = list(input());
if (string[2] == string[3]):
  if (string[4] == string[5]):
    print("Yes");
  else:
    print("No");
else:
  print("No");
# coding: utf-8

def solve(a,begin,end,queue):
  if begin>=end:
    return
  maxx = sorted(list(map(abs,a[begin:end+1])),reverse=True)[0]
  if maxx in a:
    m = a.index(maxx)
  else:
    m = a.index(-1*maxx)
    maxx = -1*maxx
  if maxx==0:
    return []
  if maxx>0:
    solve(a,begin,m-1,queue)
    for i in range(max(0,m-1),end):
      if a[i+1]>=a[i]:
        continue
      else:
        a[i+1]+=a[i]
        queue.append((i,i+1))
        if a[i+1]<a[i]:
          a[i+1]+=a[i]
          queue.append((i,i+1))
    return queue
  if maxx<0:
    solve(a,m+1,end,queue)
    for i in reversed(range(begin,min(len(a)-1,m+1))):
      if a[i]<=a[i+1]:
        continue
      else:
        a[i]+= a[i+1]
        queue.append((i+1,i))
        if a[i]>a[i+1]:
          a[i]+=a[i+1]
          queue.append((i+1,i))
    return queue

if __name__ == '__main__':
  n = int(input())
  a = list(map(int,input().split()))
  queue = solve(a,0,len(a)-1,[])
  print(len(queue))
  for i in range(len(queue)):
    print(queue[i][0]+1,queue[i][1]+1)


### FIXED CODE ###

# coding: utf-8

def solve(a,begin,end,queue):
  if begin>=end:
    return
  maxx = sorted(list(map(abs,a[begin:end+1])),reverse=True)[0]
  if maxx in a[begin:end+1]:
    m = a[begin:end+1].index(maxx)+begin
  else:
    m = a[begin:end+1].index(-1*maxx)+begin
    maxx = -1*maxx
  if maxx==0:
    return []
  if maxx>0:
    solve(a,begin,m-1,queue)
    for i in range(max(0,m-1),end):
      if a[i+1]>=a[i]:
        continue
      else:
        a[i+1]+=a[i]
        queue.append((i,i+1))
        if a[i+1]<a[i]:
          a[i+1]+=a[i]
          queue.append((i,i+1))
    return queue
  if maxx<0:
    solve(a,m+1,end,queue)
    for i in reversed(range(begin,min(len(a)-1,m+1))):
      if a[i]<=a[i+1]:
        continue
      else:
        a[i]+= a[i+1]
        queue.append((i+1,i))
        if a[i]>a[i+1]:
          a[i]+=a[i+1]
          queue.append((i+1,i))
    return queue

if __name__ == '__main__':
  n = int(input())
  a = list(map(int,input().split()))
  queue = solve(a,0,len(a)-1,[])
  print(len(queue))
  for i in range(len(queue)):
    print(queue[i][0]+1,queue[i][1]+1)
import math
import sympy
# sympy.divisors(10**9)

n = int(input())

# count = 0
# for i in range(1, n):
#     count = count + math.ceil(len(sympy.divisors(i)))
#     # print(math.ceil(len(sympy.divisors(i))))
# print(count)

count = 0
for a in range(1, n - 1):
    if n % a != 0:
        b = n // a
    else:
        b = n // a - 1
    if a <= b:
        count = (count + b)
    else:
        count = (count + b)
    # print(count)

print(count + 1)

### FIXED CODE ###

# import math
# import sympy
# sympy.divisors(10**9)

n = int(input())

# count = 0
# for i in range(1, n):
#     count = count + math.ceil(len(sympy.divisors(i)))
#     # print(math.ceil(len(sympy.divisors(i))))
# print(count)

count = 0
for a in range(1, n - 1):
    if n % a != 0:
        b = n // a
    else:
        b = n // a - 1
    if a <= b:
        count = (count + b)
    else:
        count = (count + b)
    # print(count)

print(count + 1)
import math
A, B = [int(i) for i in input().split()]
top = int(math.log2(B))+1

def cnt1(a, i):
    return (a//(2**i)) * 2**(i-1) + max(0, a%(2**i) - 2**(i-1))

ans = ''
for i in range(1, top+1):
    cntB = cnt1(B+1, i)
    cntA = cnt1(A, i)
    ans += str((cntB-cntA)%2)

ans = ans[::-1]
print(int(ans, 2))


### FIXED CODE ###

import math

def cnt1(a, i):
    return (a//(2**i)) * 2**(i-1) + max(0, a%(2**i) - 2**(i-1))

A, B = [int(i) for i in input().split()]
if B == 0:
    ans = '0'
else:
    top = int(math.log2(B))+1


    ans = ''
    for i in range(1, top+1):
        cntB = cnt1(B+1, i)
        cntA = cnt1(A, i)
        ans += str((cntB-cntA)%2)

    ans = ans[::-1]
print(int(ans, 2))
X = int(input())

L = 0
for i in range(1, X) :
    L += i
    if L >= X :


### FIXED CODE ###

X = int(input())
     
L = 0
for i in range(1, X+1) :
  L += i
  if L >= X :
    print(i)
    break
# coding: utf-8
# Your code here!
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

n, MOD = [int(i) for i in input().split()]
adj = [[] for _ in [0] * (n+1)]
dp = [[0, 0] for i in range(n+1)]
dp2 = [0] * (n+1)


def dfs1(node, pn):
    dp[node] = [1, 1]
    for i in adj[node]:
        if i == pn:
            continue
        dfs1(i, node)
        dp[node][0] = (dp[node][0] * (dp[i][0] + dp[i][1]))
        dp[node][1] = (dp[node][1] * dp[i][1])
    return



def dfs2(node, pn):
    dp2[node] = dp[node][0] % MOD

    for i in adj[node]:
        if i == pn:
            continue

        dp[node][0] = (dp[node][0] / (dp[i][0] + dp[i][1]));
        dp[node][1] = (dp[node][1] / dp[i][1]);
        dp[i][0] = (dp[i][0] * (dp[node][0] + dp[node][1]));
        dp[i][1] = (dp[i][1] * dp[node][1]);
        dfs2(i, node);
        dp[i][1] = (dp[i][1] / dp[node][1]);
        dp[i][0] = (dp[i][0] / (dp[node][0] + dp[node][1]));
        dp[node][0] = (dp[node][0] * (dp[i][0] + dp[i][1]));
        dp[node][1] = (dp[node][1] * dp[i][1]);
    return



for _ in range(n-1):
    x, y = [int(i) for i in input().split()]
    adj[x].append(y)
    adj[y].append(x)

dfs1(1, -1)
dfs2(1, -1)

for i in range(1, n+1):
    print(int(dp2[i]))


### FIXED CODE ###

# coding: utf-8
# Your code here!
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

n,MOD = [int(i) for i in input().split()]

to = [[] for _ in [0]*n]
for _ in range(n-1):
    x,y = [int(i)-1 for i in input().split()]
    to[x].append(y)
    to[y].append(x)


dp = [[0]*len(to_i) for to_i in to]
parent_index = [-9999]*n 
ans = [0]*n

def dfs(v, p):
    res = 1
    for i, vc in enumerate(to[v]):
        if vc == p:
            parent_index[v] = i
            continue
        dp[v][i] = dfs(vc, v)
        res *= dp[v][i]+1
        res %= MOD
    return res

def dfs2(v, res_p, p):
    deg = len(to[v])
    if p >= 0:
        dp[v][parent_index[v]] = res_p

    accl = [1]*(deg+1)
    accr = [1]*(deg+1)

    for i in range(1, deg+1):
        accl[i] = accl[i-1] * (dp[v][i-1] + 1) % MOD
        accr[-i-1] = accr[-i] * (dp[v][-i] + 1) % MOD

    ans[v] = accr[0]
    for i,vc in enumerate(to[v]):
        if vc == p: continue
        dfs2(vc, accl[i]*accr[i+1]%MOD, v)

dfs(0,-1)
#print(dp)
dfs2(0,0,-1)
#print(dp)
for i in ans:
    print(i)
a = input().split()
b = a
b = [int(x) for x in b]

a.remove(c)
if e == b:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

i = [int(s) for s in input().split()]
m = max(i)
i.remove(m)
a = i[0] + i[1]

if a == m:
    print("Yes")
else:
    print("No")
N, K = map(int, input().split())
A = list(map(int, input().split()))

class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)

    def sum(self, i):
        ret = 0
        while i > 0:
            ret += self.tree[i]
            i -= i & -i
        return ret

    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

bit = Bit(N)

inter = 0
intra = 0
for i in range(len(A)):
    a = A[i]
    bit.add(a, 1)
    s_a = bit.sum(a)
    intra += i + 1 - s_a
    if a == 1:
        continue
    inter += bit.sum(a - 1)

mod = 10**9 + 7

ans = (intra * K * (K + 1) // 2) % mod
ans += inter * (K - 1) * K // 2 % mod
ans %= mod
print(ans)


### FIXED CODE ###

N, K = map(int, input().split())
A = list(map(int, input().split()))
# print(N, K, A)

mod = 10**9 + 7
B = [0]*N
for i in range(N):
    ai = A[i]
    for j in range(i, N):
        aj = A[j]
        if ai > aj:
            B[i] += 1

C = [0]*N
for i in range(N):
    ai = A[i]
    for j in range(i+1):
        aj = A[j]
        if ai > aj:
            C[i] += 1

# print(B)
# print(C)
ans = 0
# for i in range(N):
#     ai = A[i]
#     for j in range(i + 1, N):
#         aj = A[j]
#         # print(i, j, ai, aj)
#         if ai > aj:
#             ans += 1

for i in range(N):
    ans += B[i]*K*(K+1)//2
    ans %= mod

for i in range(N):
    ans += C[i]*(K-1)*K//2
    ans %= mod

print(ans)
b = input()
c = input()

sa = [i for i in a]
sb = [i for i in b]
sc = [i for i in c]

turn = sa[0]

while True:

    if turn == 'a':
        if len(sa) == 0:
            print('A')
            break
        turn = sa[0]
        sa.pop(0)

    if turn == 'b':
        if len(sb) == 0:
            print('B')
            break
        turn = sb[0]
        sb.pop(0)

    if turn == 'c':
        if len(sc) == 0:
            print('C')
            break
        turn = sc[0]
        sc.pop(0)


### FIXED CODE ###

a = input()
b = input()
c = input()
sa = [a[i] for i in range(len(a))]
sb = [b[i] for i in range(len(b))]
sc = [c[i] for i in range(len(c))]
next = a[0]
while True:
    if next == 'a':
        if len(sa) == 0:
            print("A")
            exit(0)
        next = sa[0]
        sa.pop(0)
    if next == 'b':
        if len(sb) == 0:
            print("B")
            exit(0)
        next = sb[0]
        sb.pop(0)
    if next == 'c':
        if len(sc) == 0:
            print("C")
            exit(0)
        next = sc[0]
        sc.pop(0)
import sys
f = sys.stdin

rhombus = oblong = 0
for line in f:
    a, b, c = map(int, line.split(','))
    if a == b:
        rhombus += 1
    if a * a + b * b == c * c:
        oblong += 1

print(oblong)
print(rhombus)

### FIXED CODE ###

import collections
c = collections.Counter(input().split())
longest = ''
for word in c:
    if len(longest) < len(word):
        longest = word

print(c.most_common(1)[0][0], longest)
#ABC158
s = input()
print("Yes" if len(set(s))== else "No")

### FIXED CODE ###

#ABC158
s = input()
print("Yes" if len(set(s))==2 else "No")
import numpy
N = int(input())
H = list(map(int, input().split()))
Dif = numpy.array([(H[i] - H[i + 1]) for i in range(N - 1)])
Dif = numpy.append(Dif, -1)
S = list(numpy.where(Dif < 0)[0])
T = [S[j + 1] - S[j] - 1 for j in range(len(S) - 1)]
print(max(T))

### FIXED CODE ###

import numpy
N = int(input())
H = list(map(int, input().split()))
Dif = numpy.array([(H[i] - H[i + 1]) for i in range(N - 1)])
Dif = numpy.append(Dif, -1)

S = list(numpy.where(Dif < 0)[0])

if len(S) == 0:
    print(0)
else:
    if len(S) == 1:
        print(S[0])
    else:
        T = [S[j + 1] - S[j] - 1 for j in range(len(S) - 1)]
        print(max(T))
n = int(input())
a = input()
r = [None] * (n + 1)
for i in range(n, 0, -1):
    r[i] = (ord(a[2 * i - 1]) + sum(r[i * 2::i])) % 2
print(r.count(1))
print(*(i for i, x in enumerate(r) if x))


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
r = [None] * (n + 1)
for i in range(n, 0, -1):
    r[i] = (a[i - 1] + sum(r[i * 2::i])) % 2
print(r.count(1))
print(*(i for i, x in enumerate(r) if x))
S = input()
W = input()

S = int(S)
W = int(W)

if S <= W :
    print("unsafe")

elif S > W :
    print("safe")
    

### FIXED CODE ###

#入力例全てOKだけど黄色#
S,W = map(int,input().split())

if S <= W :
    print("unsafe")

else :
    print("safe")
import copy

N = int(input())
a = list(map(int, input().split()))
b = [0] * N
ans = []
count = 0
for i in reversed(range(N)):
  if i > N / 2:
    if a[i] == 1:
      b[i] = 1
      count += 1
      ans.append(int(i+1))
  elif  i == 0:
    if a[i] == 1:
      if (count % 2) == 0:
#        print("hello")
        b[i] = 1
        count += 1
        ans.append(int(i+1))
  else:
    if a[i] == 1:
      sumi = 0
      j = 2
      while True:
        sumi += b[i * j]
        j += 1
        if (i * j) > N:
          break
      if sumi % 2 == 0:
        b[i] = 1
        count += 1
        ans.append(int(i+1))
print(count)
print(' '.join(map(str, ans)))

### FIXED CODE ###

N = int(input())
a = list(map(int, input().split()))
a.insert(0,0)
b = [0] * (N + 1)
ans = []
count = 0
for i in reversed(range(1,N + 1)):
  if a[i] == 1:
    sumi = 0
    j = 2
    while True:
      if (i * j) > N:
        break
      sumi += b[i * j]
      j += 1
    if sumi % 2 == 0:
      b[i] = 1
      count += 1
      ans.append(int(i))
  else:
    sumi = 0
    j = 2
    while True:
      if (i * j) > N:
        break
      sumi += b[i * j]
      j += 1
    if sumi % 2 == 1:
      b[i] = 1
      count += 1
      ans.append(int(i))
ans.sort()
print(count)
print(' '.join(map(str, ans)))