x=int(input("escolha o numero: "))
y=int(input("numero de dias apos: "))
z=x+(y%7)-7
if(x>=0) and (x<=6) and (x==6) and (z==6):
	print("Hoje eh sabado e o dia futuro eh sabado")
elif(x==5) and (z==6)and (x>=0) and (x<=6):
	print("Hoje eh sexta e o dia futuro eh sabado")
elif(x==4) and (z==6)and (x>=0) and (x<=6):
	print("Hoje eh quinta e o dia futuro eh sabado")
elif(x==3) and (z==6)and (x>=0) and (x<=6):
	print("Hoje eh quarta e o dia futuro eh sabado")
elif(x==2) and (z==6)and (x>=0) and (x<=6):
	print("Hoje eh terca e o dia futuro eh sabado")
elif(x==1) and (z==6)and (x>=0) and (x<=6):
	print("Hoje eh segunda e o dia futuro eh sabado")
elif(x==0) and (z==6)and (x>=0) and (x<=6):
	print("Hoje eh domingo e o dia futuro eh sabado")
		

elif(x==6) and (z==5)and (x>=0) and (x<=6):
	print("Hoje eh sabado e o dia futuro eh sexta")
elif(x==5) and (z==5)and (x>=0) and (x<=6):
	print("Hoje eh sexta e o dia futuro eh sexta")
elif(x==4) and (z==5)and (x>=0) and (x<=6):
	print("Hoje eh quinta e o dia futuro eh sexta")
elif(x==3) and (z==5)and (x>=0) and (x<=6):
	print("Hoje eh quarta e o dia futuro eh sexta")
elif(x==2) and (z==5)and (x>=0) and (x<=6):
	print("Hoje eh terca e o dia futuro eh sexta")
elif(x==1) and (z==5)and (x>=0) and (x<=6):
	print("Hoje eh segunda e o dia futuro eh sexta")
elif(x==0) and (z==5)and (x>=0) and (x<=6):
	print("Hoje eh domingo e o dia futuro eh sexta")
		
elif(x==6) and (z==4)and (x>=0) and (x<=6):
	print("Hoje eh sabado e o dia futuro eh quinta")
elif(x==5) and (z==4)and (x>=0) and (x<=6):
	print("Hoje eh sexta e o dia futuro eh quinta")
elif(x==4) and (z==4)and (x>=0) and (x<=6):
	print("Hoje eh quinta e o dia futuro eh quinta")
elif(x==3) and (z==4)and (x>=0) and (x<=6):
	print("Hoje eh quarta e o dia futuro eh quinta")
elif(x==2) and (z==4)and (x>=0) and (x<=6):
	print("Hoje eh terca e o dia futuro eh quinta")
elif(x==1) and (z==4)and (x>=0) and (x<=6):
	print("Hoje eh segunda e o dia futuro eh quinta")
elif(x==0) and (z==4)and (x>=0) and (x<=6):
	print("Hoje eh domingo e o dia futuro eh quinta")
		
elif(x==6) and (z==3)and (x>=0) and (x<=6):
	print("Hoje eh sabado e o dia futuro eh quarta")
elif(x==5) and (z==3)and (x>=0) and (x<=6):
	print("Hoje eh sexta e o dia futuro eh quarta")
elif(x==4) and (z==3)and (x>=0) and (x<=6):
	print("Hoje eh quinta e o dia futuro eh quarta")
elif(x==3) and (z==3)and (x>=0) and (x<=6):
	print("Hoje eh quarta e o dia futuro eh quarta")
elif(x==2) and (z==3)and (x>=0) and (x<=6):
	print("Hoje eh terca e o dia futuro eh quarta")
elif(x==1) and (z==3)and (x>=0) and (x<=6):
	print("Hoje eh segunda e o dia futuro eh quarta")
elif(x==0) and (z==3)and (x>=0) and (x<=6):
	print("Hoje eh domingo e o dia futuro eh quarta")
		
		
elif(x==6) and (z==2)and (x>=0) and (x<=6):
	print("Hoje eh sabado e o dia futuro eh terca")
elif(x==5) and (z==2)and (x>=0) and (x<=6):
	print("Hoje eh sexta e o dia futuro eh terca")
elif(x==4) and (z==2)and (x>=0) and (x<=6):
	print("Hoje eh quinta e o dia futuro eh terca")
elif(x==3) and (z==2)and (x>=0) and (x<=6):
	print("Hoje eh quarta e o dia futuro eh terca")
elif(x==2) and (z==2)and (x>=0) and (x<=6):
	print("Hoje eh terca e o dia futuro eh terca")
elif(x==1) and (z==2)and (x>=0) and (x<=6):
	print("Hoje eh segunda e o dia futuro eh terca")
elif(x==0) and (z==2)and (x>=0) and (x<=6):
	print("Hoje eh domingo e o dia futuro eh terca")
		
elif(x==6) and (z==1)and (x>=0) and (x<=6):
	print("Hoje eh sabado e o dia futuro eh segunda")
elif(x==5) and (z==1)and (x>=0) and (x<=6):
	print("Hoje eh sexta e o dia futuro eh segunda")
elif(x==4) and (z==1)and (x>=0) and (x<=6):
	print("Hoje eh quinta e o dia futuro eh segunda")
elif(x==3) and (z==1)and (x>=0) and (x<=6):
	print("Hoje eh quarta e o dia futuro eh segunda")
elif(x==2) and (z==1)and (x>=0) and (x<=6):
	print("Hoje eh terca e o dia futuro eh segunda")
elif(x==1) and (z==1)and (x>=0) and (x<=6):
	print("Hoje eh segunda e o dia futuro eh segunda")
elif(x==0) and (z==1)and (x>=0) and (x<=6):
	print("Hoje eh domingo e o dia futuro eh segunda")
		
		
elif(x==6) and (z==0)and (x>=0) and (x<=6):
	print("Hoje eh sabado e o dia futuro eh domingo")
elif(x==5) and (z==0)and (x>=0) and (x<=6):
	print("Hoje eh sexta e o dia futuro eh domingo")
elif(x==4) and (z==0)and (x>=0) and (x<=6):
	print("Hoje eh quinta e o dia futuro eh domingo")
elif(x==3) and (z==0)and (x>=0) and (x<=6):
	print("Hoje eh quarta e o dia futuro eh domingo")
elif(x==2) and (z==0)and (x>=0) and (x<=6):
	print("Hoje eh terca e o dia futuro eh domingo")
elif(x==1) and (z==0)and (x>=0) and (x<=6):
	print("Hoje eh segunda e o dia futuro eh domingo")
elif(x==0) and (z==0)and (x>=0) and (x<=6):
	print("Hoje eh domingo e o dia futuro eh domingo")
else:
	print("A entrada", x, "eh invalida")