The first line of input contains a single integer N, ( 1N100) which is the number of datasets that follow.
Each dataset consists of twelve lines. Each line will contain the closing balance of his bank account for a particular month. Each number will be positive and displayed to the penny. No dollar sign will be included.
//qscqesze
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
#include <map>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
#define maxn 200001
#define mod 10007
#define eps 1e-9
//const int inf=0x7fffffff; //无限大
const int inf=0x3f3f3f3f;
/*
*/
//**************************************************************************************
inline ll read()
{
int x=0,f=1;char ch=getchar();
while(ch<‘0‘||ch>‘9‘){if(ch==‘-‘)f=-1;ch=getchar();}
while(ch>=‘0‘&&ch<=‘9‘){x=x*10+ch-‘0‘;ch=getchar();}
return x*f;
}
int buf[10];
inline void write(int i) {
int p = 0;if(i == 0) p++;
else while(i) {buf[p++] = i % 10;i /= 10;}
for(int j = p-1; j >=0; j--) putchar(‘0‘ + buf[j]);
printf("\n");
}
int main()
{
int t=read();
for(int cas=1;cas<=t;cas++)
{
double sum=0;
double x=0;
for(int i=0;i<12;i++)
{
cin>>x;
sum+=x;
}
sum/=12;
int a=(int)(sum/1000);
sum-=a*1000;
if(a>0)
printf("%d $%d,%.2f\n",cas,a,sum);
else
printf("%d $%.2f\n",cas,sum);
}
}