import java.io.*; public class Test { public static void main(String args[]) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); long N = Long.parseLong(br.readLine()); int antfirst = 316; int antsecond = 368; long antN = antfirst + (antsecond - antfirst)*(N-1); System.out.println(antN); } }