#include <iostream>
using namespace std;

int main() {
	// your code goes here
	int x;
	cin>> x;
	switch(x){
		case -9999 ... 4:
			cout <<(x*x-3*x+4);
			break;
		default:
		cout <<(x+7);
	}

	return 0;
}