Bingo

# -*- coding: utf-8 -*-
"""
Created on Tue Nov 28 11:02:29 2017

@author: vmahout
"""

import math

def Bingo( Nombre, decimale ) :

    Resu = 0
    
    if (Nombre <= 50) :
        if (decimale <10) :
            if (round(Nombre) == Nombre) :
                if (round(decimale) == decimale) :
                    lelog = math.log(Nombre)
                    declog = (lelog*10**(decimale-1) - math.trunc(lelog*10**(decimale-1)))
                    declog = math.trunc(declog*10)
                    if (declog == decimale) :
                        Resu = 1
                    else :
                        Resu = -1
                    
                    
    return(Resu)

N  = int(input('Nombre N :'))
d  = int(input('Nombre d :'))


Test = Bingo(N,d)

if (Test == 1):
    print('Gagné')
else:
    print('Perdu')