using C=System.Console;class M{static void Main(){for(int i;(i=int.Parse(C.ReadLine()))>0;)C.WriteLine(15L*i/8-(45>>i%8&1));}}