A - Subscribers 解説 /

実行時間制限: 2 sec / メモリ制限: 1024 MB

配点 : 100

問題文

私たちは、新聞の購読に関する調査を行いました。 具体的には、調査の対象者 N 人に対し、それぞれ次の 2 つの質問を行いました。

  • 質問 1: あなたは新聞 X を購読しているか?
  • 質問 2: あなたは新聞 Y を購読しているか?

その結果、質問 1 に対して「はい」と回答した人の数は A 人、質問 2 に対して「はい」と回答した人の数は B 人でした。

このとき、調査の対象者のうち新聞 X, Y の両方を購読している人の数は最大で何人であり、また最小で何人であると考えられるでしょうか?

この問いに答えるプログラムを書いてください。

制約

  • 1 \leq N \leq 100
  • 0 \leq A \leq N
  • 0 \leq B \leq N
  • 入力される値はすべて整数である。

入力

入力は以下の形式で標準入力から与えられる。

N A B

出力

両方の新聞を購読している人の数として考えられる最大の人数と最小の人数をこの順に、空白で区切って出力せよ。


入力例 1

10 3 5

出力例 1

3 0

この例では、調査の対象者 10 人のうち 3 人が新聞 X を購読していると回答し、5 人が新聞 Y を購読していると回答しています。

このとき、両方の新聞を購読している人の数は最大で 3 人、最小で 0 人です。


入力例 2

10 7 5

出力例 2

5 2

この例では、調査の対象者 10 人のうち 7 人が新聞 X を購読していると回答し、5 人が新聞 Y を購読していると回答しています。

このとき、両方の新聞を購読している人の数は最大で 5 人、最小で 2 人です。


入力例 3

100 100 100

出力例 3

100 100

Score : 100 points

Problem Statement

We conducted a survey on newspaper subscriptions. More specifically, we asked each of the N respondents the following two questions:

  • Question 1: Are you subscribing to Newspaper X?
  • Question 2: Are you subscribing to Newspaper Y?

As the result, A respondents answered "yes" to Question 1, and B respondents answered "yes" to Question 2.

What are the maximum possible number and the minimum possible number of respondents subscribing to both newspapers X and Y?

Write a program to answer this question.

Constraints

  • 1 \leq N \leq 100
  • 0 \leq A \leq N
  • 0 \leq B \leq N
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

N A B

Output

Print the maximum possible number and the minimum possible number of respondents subscribing to both newspapers, in this order, with a space in between.


Sample Input 1

10 3 5

Sample Output 1

3 0

In this sample, out of the 10 respondents, 3 answered they are subscribing to Newspaper X, and 5 answered they are subscribing to Newspaper Y.

Here, the number of respondents subscribing to both newspapers is at most 3 and at least 0.


Sample Input 2

10 7 5

Sample Output 2

5 2

In this sample, out of the 10 respondents, 7 answered they are subscribing to Newspaper X, and 5 answered they are subscribing to Newspaper Y.

Here, the number of respondents subscribing to both newspapers is at most 5 and at least 2.


Sample Input 3

100 100 100

Sample Output 3

100 100