Problem:
Skyland

Somewhere in the sky, KM kingdom built n floating islands by their highly developed technology.
The islands are numbered from 1 to n.

The king of the country, Kita_masa, can choose any non-negative real number as the altitude for each island, as long as the sum of the altitudes is greater than or equals to H.
For floating the island i to the altitude h_i, it costs b_i h_i.
Besides, it costs |h_i - h_j|c_{i,j} for each pair of islands i and j since there are communications between these islands.

Recently, energy prices are rising, so the king, Kita_masa, wants to minimize the sum of the costs.
The king ordered you, a court programmer, to write a program that finds the altitudes of the floating islands that minimize the cost.

Input

The input contains several test cases.
Each test case starts with a line containing two integers n (1 \leq n \leq 100) and H (0\leq H \leq 1,000), separated by a single space.
The next line contains n integers b_1, b_2,..., b_n (0\leq b_i \leq 1,000).
Each of the next n lines contains n integers c_{i,j} (0 \leq c_{i,j} \leq 1,000).
You may assume c_{i, i} = 0 and c_{i, j} = c_{j, i}.

The last test case is followed by a line containing two zeros.

Output

For each test case, print its case number.
Then print a line containing a space-separated list of the altitudes of the islands that minimizes the sum of the costs.
If there are several possible solutions, print any of them.
Your answer will be accepted if the altitude of each island is non-negative, sum of the altitudes is greater than (1-10^{-9})H, and the cost calculated from your answer has an absolute or relative error less than 10^{-9} from the optimal solution.

Follow the format of the sample output.

Sample Input

2 1
1 3
0 1
1 0
3 3
1 2 4
0 2 0
2 0 1
0 1 0
0 0

Output for the Sample Input

Case 1:
0.75 0.25
Case 2:
1.5 1.5 0.0

Solution in C++ (judge verdict: Wrong Answer)

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <queue>
using namespace std;
int b[110],c[110][110],sum[110],sumb;
double ans[110];
int r[110];
int n;
int use[110];
int main()
{
    int m,ii=0;
    while (scanf("%d%d",&n,&m)==2)
    {
        ii++;
        if (n==0&&m==0) break;
        sumb=0;
        for (int i=0;i<n;i++)
        {
            scanf("%d",&b[i]);
            sumb+=b[i];
        }
        int totb=sumb;
        for (int i=0;i<n;i++)
        {
            sum[i]=0;
            for (int j=0;j<n;j++)
            {
                scanf("%d",&c[i][j]);
                sum[i]+=c[i][j];
            }
        }
        for (int i=0;i<n;i++)
        {
            ans[i]=m*1.0/n;
            use[i]=1;
        }
        int tot=n;
        while (true)
        {
            if (tot==1) break;
            bool ok=false;
            for (int i=0;i<n;i++)
            {
                if (use[i])
                {
                    int tsum=0;
                    for (int j=0;j<n;j++)
                        if (use[j]) tsum+=c[i][j];
                        else tsum-=c[i][j];
                    if (sumb-b[i]*tot+2*tsum*(tot-1)<0)
                    {
                        ok=true;
                        use[i]=0;
                        tot--;
                        sumb-=b[i];
                        break;
                    }
                }
                else
                {
                    int tsum=0;
                    for (int j=0;j<n;j++)
                        if (use[j]) tsum-=c[i][j];
                        else tsum+=c[i][j];
                    if (-sumb+b[i]*tot+2*tsum*tot<0)
                    {
                        ok=true;
                        use[i]=1;
                        tot++;
                        sumb+=b[i];
                        break;
                    }
                }
            }
            if (!ok) break;
        }
        for (int i=0;i<n;i++)
            if (!use[i]) ans[i]=0.0;
            else ans[i]=m*1.0/tot;
//        for (int i=0;i<n;i++)
//            r[i]=i;
//        sort(r,r+n,cmp);
//        double anss;
//        int id=0;
//        for (int i=0;i<n;i++)
//        {
//            for (int j=0;j<=i;j++)
//                ans[r[j]]=m*1.0/(i+1);
//            for (int j=i+1;j<n;j++)
//                ans[r[j]]=0.0;
//            double tmp=0.0;
//            for (int i=0;i<n;i++)
//                tmp+=b[i]*ans[i];
//            for (int i=0;i<n;i++)
//                for (int j=i+1;j<n;j++)
//                    tmp+=fabs(ans[i]-ans[j])*c[i][j];
//            if (i==0||anss>tmp)
//            {
//                anss=tmp;
//                id=i;
//            }
//        }
        printf("Case %d:\n",ii);
//        for (int i=0;i<=id;i++) ans[r[i]]=m*1.0/(id+1);
//        for (int i=id+1;i<n;i++)
//            ans[r[i]]=0.0;
        printf("%.10f",ans[0]);
        for (int i=1;i<n;i++)
            printf(" %.10f",ans[i]);
        puts("");
    }
    return 0;
}