#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5 + 4 ;
const int MOD =1e9 + 7 ;
int main()
{
cin.tie(0);cin.sync_with_stdio(0);
cout.tie(0);cout.sync_with_stdio(0);
int t = 1;
cin >> t;
bool pr =0 ;
while(t--)
{
string s;
int x ,y ;
cin >> x >> y;
getline(cin, s);
double ans =0 ;
while (getline(cin, s)){
if (s.empty()) break;
stringstream ss(s);
ll x1 , x2 , y1 , y2 ;
ss >> x1 >> y1 >> x2 >> y2;
ans += sqrt( ((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)));
}
if(pr) cout << "n" ;
pr= 1 ;
ans *= 2 ;
ans /= 1000 ;
ans /= 20 ;
double minutes = ans - (ll)floor(ans) ;
ans = (ll)floor(ans) ;
minutes *= 60 ;
minutes = round(minutes ) ;
if (isgreaterequal( minutes , 60 ) )ans++ , minutes= 0 ;
cout << ans << ":" ;
cout << setfill('0') << setw(2) << minutes << 'n';
}
return 0;
}