codeparrot/codecomplex huggingface dataset:
// Problem: 5_D. Follow Traffic Rules
// Time complexity: constant
import java.io.*;
import java.util.*;

public class D {

	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;
	boolean eof;

	double f(int dist, double initSp, int a, int maxSp) {
		double distToReachMaxSpeed = 0.5 * (maxSp * maxSp - initSp * initSp)
				/ a;

		if (dist > distToReachMaxSpeed)
			return 1d * (maxSp - initSp) / a + (dist - distToReachMaxSpeed)
					/ maxSp;

		return (Math.sqrt(initSp * initSp + 2 * a * dist) - initSp) / a;
	}

	void solve() throws IOException {
		int a = nextInt();
		int maxSp = nextInt();
		int len = nextInt();
		int signX = nextInt();
		int signSp = nextInt();

		if (maxSp <= signSp) {
			out.printf("%.9f\n", f(len, 0, a, maxSp));
			return;
		}

		double distToReachSignSp = 0.5 * signSp * signSp / a;
		if (distToReachSignSp >= signX) {
			double t = Math.sqrt(2d * signX / a);
			out.printf("%.9f\n", t + f(len - signX, t * a, a, maxSp));
			return;
		}

		double distToReachMaxThenSign = 0.5
				* (maxSp * maxSp + maxSp * maxSp - signSp * signSp) / a;
		if (distToReachMaxThenSign <= signX) {
			double t = 1d * (2 * maxSp - signSp) / a
					+ (signX - distToReachMaxThenSign) / maxSp
					+ f(len - signX, signSp, a, maxSp);
			out.printf("%.9f\n", t);
			return;
		}
		
		double xSp = Math.sqrt(a * signX + signSp * signSp * 0.5);
		double xTime = (2 * xSp - signSp) / a;
		out.printf("%.9f\n", xTime + f(len - signX, signSp, a, maxSp));
	}

	void inp() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	public static void main(String[] args) throws IOException {
		new D().inp();
	}

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				eof = true;
				return null;
			}
		}
		return st.nextToken();
	}

	String nextString() {
		try {
			return br.readLine();
		} catch (IOException e) {
			eof = true;
			return null;
		}
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
}
// Problem: 5_D. Follow Traffic Rules
// Time complexity: constant
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

public class d {
	
	double a, v, l, d, w;

	private void solve() throws Exception {
		a = nextInt(); v = nextInt(); l = nextInt(); d = nextInt(); w = nextInt();
		double ans;
		if (w >= v){
			ans = fromSign(0, l);
		}
		else{
			double tToW = w / a;
			double dToW = tToW * tToW * a / 2.;
			if (dToW > d){
				double curT = Math.sqrt(d * 2. / a);
				ans = curT;
				double curV = a * curT;
				ans += fromSign(curV, l - d);
			}
			else{
				double tToMax = v / a;
				double dToMax = tToMax * tToMax * a / 2.;
				double tFromMax = (v - w) / a;
				double dFromMax = tFromMax * v - tFromMax * tFromMax * a / 2.;
				if (dToMax + dFromMax <= d){
					ans = tToMax + tFromMax + (d - dToMax - dFromMax) / v;
				}
				else{
					double lo = w, hi = v;
					for (int i = 0; i < 1000; ++i){
						double mi = (lo + hi) / 2.;
						double tTo = mi / a;
						double dTo = tTo * tTo * a / 2.;
						double tFrom = (mi - w) / a;
						double dFrom = tFrom * mi - tFrom * tFrom * a / 2.;
						if (dTo + dFrom <= d)
							lo = mi;
						else
							hi = mi;
					}
					ans = lo / a + (lo - w) / a;
				}
				ans += fromSign(w, l - d);
			}
		}
		out.printf("%.8f", ans);
	}

	private double fromSign(double curV, double d) {
		double tToMax = (v - curV) / a;
		double dToMax = tToMax * curV + tToMax * tToMax * a / 2.;
		if (dToMax <= d){
			return tToMax + (d - dToMax) / v;
		}
		else{
			double lo = 0, hi = tToMax;
			for (int i = 0; i < 1000; ++i){
				double mi = (lo + hi) / 2.;
				double curD = mi * curV + mi * mi * a / 2.;
				if (curD <= d)
					lo = mi;
				else
					hi = mi;
			}
			return lo;
		}
	}

	public void run() {
		try {
			solve();
		} catch (Exception e) {
			NOO(e);
		} finally {
			out.close();
		}
	}

	PrintWriter out;
	BufferedReader in;
	StringTokenizer St;

	void NOO(Exception e) {
		e.printStackTrace();
		System.exit(1);
	}

	int nextInt() {
		return Integer.parseInt(nextToken());
	}

	long nextLong() {
		return Long.parseLong(nextToken());
	}

	double nextDouble() {
		return Double.parseDouble(nextToken());
	}

	String nextToken() {
		while (!St.hasMoreTokens()) {
			try {
				String line = in.readLine();
				St = new StringTokenizer(line);
			} catch (Exception e) {
				NOO(e);
			}
		}
		return St.nextToken();
	}

	private d(String name) {
		try {
			in = new BufferedReader(new FileReader(name + ".in"));
			St = new StringTokenizer("");
			out = new PrintWriter(new FileWriter(name + ".out"));
		} catch (Exception e) {
			NOO(e);
		}
	}

	private d() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			St = new StringTokenizer("");
			out = new PrintWriter(System.out);
		} catch (Exception e) {
			NOO(e);
		}
	}

	public static void main(String[] args) {
		Locale.setDefault(Locale.US);
		new d(/*"d"*/).run();
	}

}
// Problem: 5_D. Follow Traffic Rules
// Time complexity: constant
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Stack;

public class ProblemD {
	public static void main(String[] args) throws IOException {
		BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out = new PrintWriter(System.out);

		String[] data = s.readLine().split(" ");
		double a = Double.valueOf(data[0]);
		double v = Double.valueOf(data[1]);
		
		String[] line = s.readLine().split(" ");
		double l = Double.valueOf(line[0]);
		double d = Double.valueOf(line[1]);
		double w = Double.valueOf(line[2]);

		double ans = solve(a, v, l, d, w);
		out.println(String.format("%.07f", ans));
		
		out.flush();
	}

	private static double solve(double a, double v, double l, double d, double w) {
		double maxSpeedAtD = Math.sqrt(2 * d / a) * a;
		if (v <= w || maxSpeedAtD <= w) {
			// okay. just go
			double maxSpeedAtL = Math.sqrt(2 * l / a) *  a;
			if (maxSpeedAtL <= v) {
				return Math.sqrt(2 * l / a);
			} else {
				double timeToMaxSpeed = v / a;
				double leftDist = l - 0.5 * a * timeToMaxSpeed * timeToMaxSpeed;
				return timeToMaxSpeed + leftDist / v;
			}
		}
		
		double time = 0.0d;
		double maxSpeedTime = Math.sqrt((d / a) + (w * w / (2 * a * a)));
		double maxSpeed = maxSpeedTime * a;
		if (maxSpeed <= v) {
			time = maxSpeedTime + (a * maxSpeedTime - w) / a;
		} else {
			double vtime = (2 * a * d + w * w - 2 * v * v) / (2 * a * v);
			time = v / a + vtime + (v - w) / a;
		}
		
		// after that, just go.
		double timeToV = (v - w) / a;
		double timeToVLen = timeToV * w + 0.5 * timeToV * (v - w);
		if (timeToVLen <= l - d) {
			double leftLen = l - d - timeToVLen;
			time += timeToV + leftLen / v;
		} else {
			time += (-w + Math.sqrt(w*w + a * (2 * l - 2 * d))) / a;
		}
		return time;
	}

	public static void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}
}
// Problem: 5_D. Follow Traffic Rules
// Time complexity: constant
import java.io.*;
import java.util.*;

public class Solution {
	
	private BufferedReader in;
	private PrintWriter out;
	private StringTokenizer st;

	void solve() throws IOException {
		double a = nextDouble();
		double v = nextDouble();
		double l = nextDouble();
		double d = nextDouble();
		double w = nextDouble();
		if (w > v) {
			w = v;
		}
		double ans1 = 0.;
		double v1;
		{
			double l_ = 0., r_ = 1e+9;
			for (int it = 0; it < 100; ++it) {
				double mid = (l_ + r_) / 2.;
				double V = a * mid;
				double t1 = (V + w) / 2. / a;
				double t2 = mid - t1;
				t1 = Math.min(t1, v / a);
				t2 = Math.min(t2, (v - w) / a);
				if (V < w) {
					t1 = mid;
					t2 = 0.;
				}
				double dist = t1 * t1 * a / 2. + t2 * (w + t2 * a / 2.) + v * (mid - t1 - t2);
				if (dist < d) {
					l_ = mid;
				} else {
					r_ = mid;
				}
			}
			ans1 = (l_ + r_) / 2.;
			v1 = Math.min(ans1 * a, w);
		}
		double ans2 = 0.;
		{
			double tSp = (v - v1)  / a;
			double l_ = 0., r_ = 1e+9;
			for (int it = 0; it < 100; ++it) {
				double mid = (l_ + r_) / 2.;
				double dist = Math.min(tSp, mid) * (v1 + Math.min(tSp, mid) * a / 2.);
				dist += (mid - Math.min(tSp, mid)) * v;
				if (dist < l - d) {
					l_ = mid;
				} else {
					r_ = mid;
				}
			}
			ans2 = (l_ + r_) / 2.;
		}
		out.println(ans1 + ans2);
	}

	Solution() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		
		eat("");
		
		solve();
		
		in.close();
		out.close();
	}
	
	private void eat(String str) {
		st = new StringTokenizer(str);
	}
	
	String next() throws IOException {
		while (!st.hasMoreTokens()) {
			String line = in.readLine();
			if (line == null) {
				return null;
			}
			eat(line);
		}
		return st.nextToken();
	}
	
	int nextInt() throws IOException {
		return Integer.parseInt(next());
	}
	
	long nextLong() throws IOException {
		return Long.parseLong(next());
	}
	
	double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	public static void main(String[] args) throws IOException {
		new Solution();
	}
}
// Problem: 5_D. Follow Traffic Rules
// Time complexity: constant
import java.util.*;
import java.io.*;

public class Main {
    
    static final double EPS = 1E-6;
    double a, v, l, d, w, u;
    
    public void run() {
        a = cin.nextDouble();
        v = cin.nextDouble();
        l = cin.nextDouble();
        d = cin.nextDouble();
        w = cin.nextDouble();
        w = Math.min(w, v);
        double s1 = v * v / (2 * a);
        double s2 = w * w / (2 * a);
        double s3 = s1 - s2;
        
        double cost = 0;
        if (d < s2) {
            cost += Math.sqrt(2 * d / a);
            w = cost * a;
        } else if (d < s1 + s3) {
            u = Math.sqrt(d / a + w * w / (2 * a * a)) * a;
            cost = u / a + (u - w) / a;
        } else {
            cost += v / a;
            cost += (v - w) / a;
            cost += (d - s3 - s1) / v;
        }
        d = l - d;
        s3 = (v * v - w * w) / (2 * a);
        if (d < s3) {
            cost += (-w + Math.sqrt(w * w + 2 * a * d)) / a;
        } else {
            cost += (v - w) / a;
            cost += (d - s3) / v;
        }
        out.println(cost);
    }

    public static void main(String[] args) throws IOException {
        Main sloved = new Main();
        sloved.run();
        sloved.out.close();
    }

    Scanner cin = new Scanner(System.in);
    PrintWriter out = new PrintWriter(System.out);
}
// Problem: 5_D. Follow Traffic Rules
// Time complexity: constant
import java.util.*;
import static java.lang.Math.*;

public final class FollowTrafficRules {
    private static double[] acce(double i, double a, double v) {
        double[] r = new double[2];
        r[0] = (v - i)/a;
        r[1] = 1d/2d * a * pow(r[0], 2) + i * r[0];
        return r;
    }

    private static double solve(double i, double a, double l) {
        double e = sqrt(pow(i, 2) + 2d * a * l);
        e = a > 0 ? e : -1d * e;
        return (e - i)/a;
    }

    private static double time(double i, double a, double v, double l) {
        double[] r = acce(i, a, v);
        if (r[1] >= l) return solve(i, a, l);
        return r[0] + (l - r[1])/v;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double a = sc.nextDouble();
        double v = sc.nextDouble();
        double l = sc.nextDouble();
        double d = sc.nextDouble();
        double w = sc.nextDouble();

        double t = 0d;
        if (v <= w) t = time(0, a, v, l);
        else {
            double[] r = acce(0, a, w);
            if (r[1] >= d) t = time(0, a, v, l);
            else {
                t += r[0];
                t += 2d * time(w, a, v, (d - r[1])/2d);
                t += time(w, a, v, l - d);
            }
        }

        System.out.println(t);
    }
}
// Problem: 5_D. Follow Traffic Rules
// Time complexity: constant
import java.io.*;
import java.util.*;

public class D implements Runnable {
	public static void main(String[] args) {
		new Thread(new D()).start();
	}

	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;
	boolean eof;

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				eof = true;
				return "0";
			}
		}
		return st.nextToken();
	}

	public void run() {
		try {
			br = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			solve();
			out.flush();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	int nextInt() {
		return Integer.parseInt(nextToken());
	}

	long nextLong() {
		return Long.parseLong(nextToken());
	}

	double nextDouble() {
		return Double.parseDouble(nextToken());
	}

	static final double EPS = 1e-9;

	static double qEq(double a, double b, double c) {
		double d = b * b - 4 * a * c;
		if (d < -EPS) {
			return Double.NaN;
		}
		return Math.max((-b + Math.sqrt(d)) / (2 * a), (-b - Math.sqrt(d))
				/ (2 * a));
	}

	static int compare(double a, double b) {
		return Math.abs(a - b) < EPS ? 0 : Double.compare(a, b);
	}

	void solve() {
		double a = nextDouble();
		double v = nextDouble();
		double l = nextDouble();
		double d = nextDouble();
		double w = nextDouble();
		if (compare(w, v) >= 0) {
			double t1 = v / a;
			double d1 = a * t1 * t1 * .5;
			if (compare(d1, l) >= 0) {
				out.println(Math.sqrt(2 * l / a));
			} else {
				out.println(t1 + (l - d1) / v);
			}
			return;
		}
		double t1 = w / a;
		double d1 = a * t1 * t1 * .5;
		if (compare(d1, d) >= 0) {
			double t2 = v / a;
			double d2 = a * t2 * t2 * .5;
			if (compare(d2, l) >= 0) {
				out.println(Math.sqrt(2 * l / a));
			} else {
				out.println(t2 + (l - d2) / v);
			}
			return;
		}
		double left = d - d1;
		double timeToV = (v - w) / a;
		double distToV = a * timeToV * timeToV * .5 + w * timeToV;
		// System.err.println(t1 + " " + left + " " + timeToV + " " + distToV
		// + " " + d1);
		if (compare(distToV, left * .5) >= 0) {
			double t2 = qEq(a * .5, w, -left * .5);
			// System.err.println(t2 + " " + (a * t2 * t2 * .5 + w * t2));
			t2 += t1 + t2;
			if (compare(distToV, l - d) >= 0) {
				out.println(t2 + qEq(a * .5, w, d - l));
			} else {
				out.println(t2 + timeToV + (l - d - distToV) / v);
			}
			return;
		}
		double t2 = t1 + 2 * timeToV + (left - 2 * distToV) / v;
		if (compare(distToV, l - d) >= 0) {
			out.println(t2 + qEq(a * .5, w, d - l));
		} else {
			out.println(t2 + timeToV + (l - d - distToV) / v);
		}
	}
}
// Problem: 5_D. Follow Traffic Rules
// Time complexity: constant
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;
import java.math.BigInteger;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Scanner;

public class Main implements Runnable {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		new Thread(new Main()).start();
	}

	public void run() {
		Locale.setDefault(Locale.US);
		try {
			run1();
		} catch (IOException e) {
			throw new RuntimeException();
		}
	}

	int nextInt(StreamTokenizer st) throws IOException {
		st.nextToken();
		return (int) st.nval;
	}

	double nextDouble(StreamTokenizer st) throws IOException {
		st.nextToken();
		return st.nval;
	}

	String nextLine(StreamTokenizer st) throws IOException {
		st.nextToken();
		return st.sval;
	}

	Map<String, BigInteger> map = new HashMap<String, BigInteger>();

	public void run1() throws IOException {
		Locale.setDefault(Locale.US);
		// long time = -System.currentTimeMillis();
		 Scanner sc = new Scanner(new InputStreamReader(System.in));
		// BufferedReader br = new BufferedReader(new
		// InputStreamReader(System.in));
//		Scanner sc = new Scanner(new File("input.txt"));
		// BufferedReader br = new BufferedReader(new FileReader("input.txt"));
		// PrintStream ps = System.out;// new PrintStream(new
		// File("output.txt"));
		// gopa(br, ps);
		double a = sc.nextDouble();
		double vmax = sc.nextDouble();
		double l2 = sc.nextDouble();
		double l1 = sc.nextDouble();
		l2 -= l1;
		double boundv = sc.nextDouble();
		if (boundv >= vmax || boundv * boundv / a / 2 > l1) {
			System.out.print(get(0, a, vmax, l1 + l2));
			System.exit(0);
		}
		double tmplen = vmax * vmax / a / 2 + (vmax + boundv) / 2
				* (vmax - boundv) / a;
		if (tmplen < l1) {
			System.out.print(get(boundv, a, vmax, l2) + vmax
					/ a + (vmax - boundv) / a + (l1 - tmplen) / vmax);
			System.exit(0);
		}
		double v = Math.sqrt(l1 * a + boundv * boundv / 2);
		System.out.print(get(boundv, a, vmax, l2) + v / a
				+ (v - boundv) / a);
	}

	double get(double v0, double a, double vmax, double l) {
		double tmplen = (vmax + v0) / 2 * (vmax - v0) / a;
		// System.out.println(tmplen);
		if (l >= tmplen) {
			return (vmax - v0) / a + (l - tmplen) / vmax;
		}
		return (-v0 + Math.sqrt(v0 * v0 + 2 * a * l)) / a;
	}
}
// Problem: 5_D. Follow Traffic Rules
// Time complexity: constant
import java.util.Scanner;


public class D
{

    public static void main(String[] args)
    {
        new D();
    }
    
    D()
    {
        Scanner in = new Scanner(System.in);
        double a = in.nextDouble();
        double v = in.nextDouble();
        double l = in.nextDouble();
        double d = in.nextDouble();
        double w = in.nextDouble();
        
        if (w>v) w=v;
        
        double dx=(v*v-w*w)/(2*a);
        double d0=(w*w)/(2*a);
        
        double t=0;
        if (d0>d) // doesn't make it to speed w before reaching d
        {
            if (d0>=l) // never gets to speed w
            {
                t=Math.sqrt(2*a*l)/a;
            }
            else
            {
                t=w/a;
                if (d0+dx>=l) // never gets to speed v
                {
                    t+=(-w+Math.sqrt(w*w+2*a*(l-d0)))/a;
                }
                else // makes it to speed v
                {
                    t+=(v-w)/a;
                    t+=(l-(d0+dx))/v;
                }
            }
        }
        else // makes it to speed w before reachig d
        {
            t=w/a; // get up to speed w 
            
            // get time after reaching d
            if (d+dx>l) // never makes it back to v after reaching d
            {
                t+=(-w+Math.sqrt(w*w+2*a*(l-d)))/a;
            }
            else // makes it to speed v after reaching d
            {
                t+=(v-w)/a;
                t+=(l-(d+dx))/v;
            }
            
            // handle getting to d
            if (d0+2*dx>d) // can't get to v before reaching d
            {
                double half=(d-d0)/2;
                t+=2*(-w+Math.sqrt(w*w+2*a*half))/a;
            }
            else // can get to v before reaching d
            {
                t+=2*(v-w)/a;
                t+=(d-2*dx-d0)/v;
            }
        }
        
        System.out.printf("%.12f%n", t+1e-11);
    }

}
// Problem: 5_D. Follow Traffic Rules
// Time complexity: constant
import java.io.*;
import java.util.*;

public class trafficerules {
 	
 	public static void main(String[] args) throws Exception {
 		if ("Satayev".equals(System.getProperty("user.name"))) {
			long start = System.nanoTime();
			new trafficerules().solve(new FileInputStream("input"));
			System.err.printf("Time elapsed: %d ms.\n", (System.nanoTime()-start)/1000000);
		}
		else
			new trafficerules().solve(System.in);
 	}

 	void solve(InputStream is) throws Exception {
		Scanner in = new Scanner(is);
		
		double a = in.nextDouble(), maxv = in.nextDouble(), s = in.nextDouble(), d = in.nextDouble(), w = in.nextDouble();
		
		if (maxv < w)
			w = maxv;
		
		double t = 0;
		
		// v = at
		// s = att/2
		double t1 = w / a;
		double s1 = a*t1*t1/2;
		double v1 = w;
		if ( s1 < d ) {
			v1 = w;
			
			if (v1 >= maxv)
				t1 += (d-s1)/v1;
			else {
				double tt = (maxv - v1)/a;
				double ss = v1*tt+a*tt*tt/2;
				ss *= 2;
				if (s1 + ss < d)
					t1 += tt*2 + (d-s1-ss)/maxv;
				else {
					ss = (d-s1)/2;
					// ss = v1*t + a*t*t/2;
					double A = a/2;
					double B = v1;
					double C = -ss;
					double D = B*B - 4 * A * C;
					tt = (-B + Math.sqrt(D))/2/A;
					t1 += tt*2;
				}
			}
			
			s1 = d;
		}
		if (s1 > d) {
			s1 = d;
			t1 = Math.sqrt(2*s1/a);
			v1 = a * t1;
		}
		
		t += t1;
		
		double t2 = (maxv - v1) / a;
		double s2 = v1*t2 + a*t2*t2/2;
		double v2 = maxv;
		if (s1 + s2 < s) {
			v2 = maxv;
			t2 += (s-s1-s2)/v2;
		}
		if (s1 + s2 > s) {
			s -= s1;
			// v = v1 + a*t
			// s = v1*t + a*t*t/2
			double A = a/2;
			double B = v1;
			double C = -s;
			double D = B*B - 4*A*C;
			
			t2 = (-B + Math.sqrt(D))/2/A;
		}
		
		t += t2;
		
		System.out.println(t);
 	}

}
// Problem: 313_A. Ilya and Bank Account
// Time complexity: constant
import java.util.*;
import java.io.*;

public class A {

    public static void main(String[] args) {
    	Scanner s = new Scanner(System.in);
    	long n = s.nextLong();
    	if(n >= 0)
    		System.out.println(n);
    	else {
    		String str = ("" + n).substring(1);
    		if(str.length() == 1)
    			System.out.println("-" + str);
    		else {
    			long one = Long.parseLong(str.substring(0, str.length()-1));
    			long two = Long.parseLong(str.substring(0, str.length()-2) + str.substring(str.length()-1));
    			if(one > two)
    				System.out.println((two!=0?"-":"") + two);
    			else
    				System.out.println((one!=0?"-":"") + one);
    		}
    	}
    }
}
// Problem: 313_A. Ilya and Bank Account
// Time complexity: constant
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main implements Runnable {

    PrintWriter out;
    Scanner in;

    public static void main(String[] args) throws IOException {
        new Thread(new Main()).start();
    }

    public void run() {
        try {
            out = new PrintWriter(new BufferedOutputStream(System.out));
            in = new Scanner(System.in);
            solve();
            out.close();
        } catch (IOException e) {
            throw new IllegalStateException(e);
        }
    }

    public void solve() throws IOException {
        int n = in.nextInt();
        if (n >= 0) {
            out.println(n);
        } else {
            String s = String.valueOf(n);
            int l = s.length();
            String s1 = s.substring(0, l - 2);
            if (s.charAt(l - 1) > s.charAt(l - 2)) {
                s1 += s.charAt(l - 2);
            } else {
                s1 += s.charAt(l - 1);
            }
            out.println(Integer.parseInt(s1));
        }
    }
}
// Problem: 313_A. Ilya and Bank Account
// Time complexity: constant
import java.util.*;
import java.math.*;

public class Main {
  
  public static void main(String[] args) throws Exception {
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int res = n;
    String str = Integer.toString(n);
    res = Math.max(res, Integer.parseInt(str.substring(0, str.length() - 1)));
    res = Math.max(res, Integer.parseInt(str.substring(0, str.length() - 2) + str.substring(str.length() - 1)));
    System.out.println(res);
  }
}
// Problem: 313_A. Ilya and Bank Account
// Time complexity: constant
import java.util.Scanner;

    public class Main2 {
        public static void main(String args[]){
        	Scanner input = new Scanner(System.in);
        	String st = input.nextLine();
        	System.out.println(bank(st));
        }
        
        public static int bank(String st){
        	StringBuilder sb = new StringBuilder(st);
        	int st1 = Integer.parseInt(sb.substring(0,st.length()-2)+sb.substring(st.length()-1,st.length()));
        	int st2 = Integer.parseInt(sb.substring(0,st.length()-1));
        	int st3 = Integer.parseInt(st);
        	return Math.max(st3,Math.max(st1, st2));
        }
    }