Building Blocks

No attempts yetTime limit1sMemory limit1024 MB

Statement

Ignas has three kinds of building blocks. Blocks of each kind have a different color and a different height. Luckily for Ignas, he has an unlimited supply of each kind.

Ignas wants to use these blocks to build a tower exactly NN centimeters tall. However, he wants the tower to be a single color, so he may use blocks of only one kind.

It may be impossible to build a tower of exactly NN centimeters from a single kind of block. For example, if a block is 33 cm tall, he can build towers of 33 cm, 66 cm, or 99 cm, but not towers of 77 cm or 1010 cm.

Ignas wants to choose the kind of block that lets him build a tower whose height is as close to NN as possible. The tower must contain at least one block (a tower of height 00 is not allowed). Help Ignas pick the most suitable blocks.

Input

The first line contains the desired tower height NN (in centimeters). The second line contains three distinct integers aa, bb, and cc: the heights (in centimeters) of the three kinds of blocks.

Output

Print two integers: the height of the block Ignas should choose, and the height of the tower (closest to NN) that he can build from it.

  • If a single kind of block can build two towers equally close to NN, choose the shorter tower (the smaller multiple).
  • If several kinds of block achieve the same minimal distance to NN, choose the block with the smaller height.

Constraints

  • 1N10001 \le N \le 1000
  • 1a<b<c1001 \le a < b < c \le 100