#include <iostream>
#include <math.h>
using namespace std;
int main(){
int start, n1, n2, n3;
while(cin >> start >> n1 >> n2 >> n3){
if(start == 0 && n1 == 0 && n2 == 0 && n3 == 0){
break;
}
int degree = 0;
}
return 0;
}