#include<stdio.h>
int main()
{
int x,y;
scanf("%d", &x);
if(x<0){
y=-x;
}
else if(x<5){
y=2*x+1;
}
else{
y=5*x-1;
}
printf("%d", y);
return 0;
}
x=int(input("输入:"))
if x<0:
y=-x
elif x>=0and x<5:
y=2*x+1
else:
y=5*x-1
print(y)