#include <iostream>
#include <cmath>
using namespace std;

int main() {
    int temp;
    cin >> temp >> temp;
    double lengthOfRoads = 0;
    double firstX, firstY, secondX, secondY;
    while (cin >> firstX >> firstY >> secondX >> secondY)
    {
    	lengthOfRoads += sqrt((secondX - firstX)*(secondX - firstX)+(secondY - firstY)*(secondY - firstY));
    }
    int minutes = round(3 * lengthOfRoads / 500);
    cout<< minutes / 60 << ":" << minutes % 60;
    return 0;
}