Buggy python submission (verdict: Time Limit Exceeded):
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007
flush = sys.stdin.flush()

def solve():
    n = I()
    l = 0
    r = 17
    while r-l > 1:
        m = (l+r) >> 1
        M = 10**m
        print("?",M)
        flush
        ans = (n < M and str(n) < str(M)) or (n > M and str(n) > str(M))
        print(ans)
        if ans:
            l = m
        else:
            r = m
    k = l
    A = 0
    for i in range(k+1)[::-1]:
        l = max(0,i-k+1)
        r = 10
        while r-l > 1:
            m = (l+r) >> 1
            M = (A+m*10**i)*10
            print("?",M)
            flush
            ans = (n < M and str(n) < str(M)) or (n > M and str(n) > str(M))
            print(ans)
            if ans:
                r = m
            else:
                l = m
        A += l*10**i
    if A < 10**9:
        if A == 10000000:
            M = 10**9
            print("?",M)
            flush
            ans = (n < M and str(n) < str(M)) or (n > M and str(n) > str(M))
            print(ans)
            if not ans:
                print("!",A+1)
                return
        else:
            print("!",A+1)
            return
    for i in range(10):
        M = 10**i
        print("?",M)
        flush
        ans = (n < M and str(n) < str(M)) or (n > M and str(n) > str(M))
        print(ans)
        if not ans:
            print("!",10**i)
            return
    return

#Solve
if __name__ == "__main__":
    solve()


Fixed submission:
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007
flush = sys.stdin.flush()

def solve():
    l = 0
    r = 17
    while r-l > 1:
        m = (l+r) >> 1
        M = 10**m
        print("?",M)
        flush
        ans = input()
        if ans == "Y":
            l = m
        else:
            r = m
    k = l
    A = 0
    for i in range(k+1)[::-1]:
        l = max(0,i-k+1)
        r = 10
        while r-l > 1:
            m = (l+r) >> 1
            M = (A+m*10**i)*10
            print("?",M)
            flush
            ans = input()
            if ans == "Y":
                r = m
            else:
                l = m
        A += l*10**i
    if A < 10**9:
        if A == 10000000:
            M = 10**9
            print("?",M)
            flush
            ans = input()
            if ans == "N":
                print("!",A+1)
                return
        else:
            print("!",A+1)
            return
    l = -1
    r = 9
    while r-l > 1:
        m = (l+r) >> 1
        M = 10**m+1
        print("?",M)
        flush
        ans = input()
        if ans == "Y":
            r = m
        else:
            l = m
    print("!",10**r)
    return
    return

#Solve
if __name__ == "__main__":
    solve()