#include using namespace std; int main() { int x; while(scanf("%d",&x),x) { printf("%d\n",x*x+2*x-5); } }