#include <iostream>
using namespace std;
int main() {
// your code goes here
int y, x;
cin>> x;
if (x<5) y=(x*x)-3*x+4;
else y=x+7;
cout <<y;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CgkvLyB5b3VyIGNvZGUgZ29lcyBoZXJlCglpbnQgeSwgeDsKCWNpbj4+IHg7CglpZiAoeDw1KSB5PSh4KngpLTMqeCs0OwoJZWxzZSB5PXgrNzsKCWNvdXQgPDx5OwoJcmV0dXJuIDA7Cn0=