#include <cstdio>
#include <ctime>
using namespace std;

int main(){
	clock_t c1 = clock();
	int s = 0, n;
	while(scanf("%d", &n), n){
		s += n;
		for(int i = 0; i < n; ++i){
			scanf("%*d%*d%*d");
		}
	}
	
	clock_t c2 = c1 + CLOCKS_PER_SEC * (s / 100000.0);
	while(clock() < c2);
}