import java.io.*;
import java.util.*;

public class stars_md {
	void run() {
		int a = in.nextInt();
		int b = in.nextInt();
		int c = in.nextInt();
		int d = in.nextInt();
		int e = in.nextInt();
		int minOccupied = (c - e - a) + (Math.min(c, b + 1) - (c - d + 1));
		int maxOccupied = b - a;
		if (d != e) {
			maxOccupied -= 1;
		}
		out.println(minOccupied + " " + maxOccupied);
	}

	static Scanner in;
	static PrintWriter out;
	
	public static void main(String[] args) throws IOException {
		String fileName = stars_md.class.getSimpleName().replaceFirst("_.*", "").toLowerCase();
		String inputFileName = fileName + ".in";
		String outputFileName = fileName + ".out";
		
		Locale.setDefault(Locale.US);
		in = new Scanner(new File(inputFileName));
		out = new PrintWriter(outputFileName);
		new stars_md().run();
		in.close();
		out.close();
	}
}
