#include <bits/stdc++.h>
using namespace std;

const int TRIALS = 100;
const int SIDES = 6;

int main() {
	srand((unsigned) time(NULL));
	int sum = 0;
	for(int i = 0; i < TRIALS; i++) {
		int trials = 1;
		int tot = 0;
		int random = 0;
		cout << "\nRun " << trials << ": " << endl;
		while(random != 1) {
			tot++;
			random = 1 + (rand() % SIDES);
			cout << random << " ";
			if(random % 2 == 0) {
				trials++;
				tot = 0;
				cout << "\nRun " << trials << ": " << endl;
			}
			if(random == 1) {
				sum += tot;
				cout << "\nRunning average: " << (double)sum/(i+1);
				break;
			}
			
		}
	}
	cout << "\nAverage: " << (double) sum/TRIALS << endl;
}