Zhautykov Olympiad 2020 Azerbaijan National Team Selection Contest Revisited
That day finally came! With ultimate joy and happiness! Today, Mr.Mammadov has a wedding and, of course, his all friends, including Barish, Murad, Ziya, Rafael,Huseyn,Mahammad, and Mahmud, are drinking to his honor! But there is special condition: they want it to be a number-theoric cheering, so they count numbers starting from one, and when the number is divisible by 3 or 5, they drink and say “Salut!”, skipping that number. This is how they will count and drink:1, 2, Salut!, 4, Salut!, Salut!, 7, 8, Salut!,Salut!, 11, Salut!,... Mr.Mammadov saw his friends like this and remembered good old days, when he was the absolute god of competitive programming (now he is a legend). Recalling these days, he wanted to know what would be the N’th number his friends will say.For example, the 3’rd number is 4, and the 5’th number is 8 (as the sequence is like (1, 2, 4, 7 , 8, ...) ). Now he is busy with taking cliché wedding pictures, so you need to solve this problem for him.
The number N (1 ≤ N ≤
1012 ) is given in the first and the last line.
The N’th number said during the drinking phase.