import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int x;
int y;
Scanner in=new Scanner(System.in);
x=in.nextInt();
if(x<-2) {
y=7-2x;
System.out.println(y);
}
if(x>=-2&x<3) {
y=5-Math.abs(3x+2);
System.out.println(y);
}
if(x>=3) {
y=3*x+4;
System.out.println(y);
}
}
}