Extreme Discrete Summation

Given set S what is the value of the right hand side of the following assignment? In other words what is the value of A. ∑∑∑∑∑∑∑∑ ∑8 A= x1∈S x2∈S x3∈S x4∈S x5∈S x6∈S x7∈S x8∈S i=1 ∑8 xi − ⌊xi⌋ i=1 For example if S = {1.2, 3.6, 4.1} then the possible values for variable xi is 1.2, 3.6 or 4.1. The same is true for variables xi, x2, x3, x4, x5, x6, x7, x8. Here ⌊x⌋ means the nearest smaller integer value of x (floor function). For example ⌊1.8⌋ = 1, ⌊2.0⌋ = 2, ⌊−2.3⌋ = −3 Input The input file contains 100 sets of inputs. The description of each set is given below: The input for each set is contained in a single line. This line starts with an integer N (0 < N < 101) which denotes how many numbers are in the set S. This integer is followed by N non-negative floating- point numbers in the same line. To make things easy with floating-point numbers and to avoid precision problems these numbers have only a single digit after the decimal point. Also the values of any of these numbers are not greater than 1000. Input is terminated by line containing a single zero. Output For each set of input produce one line of output. This line contains an integer which denotes the value of A. Sample Input 1 11.4 4 537.0 365.1 870.2 841.7 2 216.5 4.8 0 Sample Output 3 101672 1196 (⌊ ⌋ )