QOJ.ac

QOJ

حد الوقت: 2 s حد الذاكرة: 256 MB مجموع النقاط: 100

#22468. Cow Pals

الإحصائيات

Bessie and all the other cows have an RFID serial number tag in their ear so FJ can mechanically tally them. Many cows have a 'cowpal' whose serial number is equal to the sum of the divisors (that are not the number itself) of their own serial number. Some cows don't have a cowpal because no cow's serial number matches their divisor sum.

Some cows have a superpal. Cows are superpals when their serial numbers make each of them a pal of the other. Cows that are superpals of themselves are shunned; do not consider them!

Given a serial number $S$ ($6 \le S \le 18,000$), find the first cow with serial number at least $S$ who has a super pal.

By way of example, consider serial number 220 whose divisors are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55, and 110. Their sum is 284. Similarly, the divisors of 284 are 1, 2, 4, 71, and 142. Their sum is 220.

Input

  • Line 1: A single integer: $S$

Output

  • Line 1: A single line with two space-separated integers that are the serial number of the first superpal whose serial number is no smaller than $S$ and the serial number of her pal.

Examples

Input 1

206

Output 1

220 284

Problem credits: Traditional, 2010

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.