import java.io.*; import java.util.*; public class Polynoom1{ public static void main(String[] arg) throws IOException{ BufferedReader lugeja=new BufferedReader(new FileReader("poly1.txt")); String rida=lugeja.readLine(); StringTokenizer stk=new StringTokenizer(rida, "x+-", true); int a=Integer.parseInt(stk.nextToken()); stk.nextToken(); String tehe=stk.nextToken(); int b=Integer.parseInt(stk.nextToken()); int x=Integer.parseInt(lugeja.readLine()); if(tehe.equals("+")){ System.out.println(a*x+b); } if(tehe.equals("-")){ System.out.println(a*x-b); } } }