#include<bits/stdc++.h>
using namespace std;
int main(){
double a,b,c,e,f,g,k=0;
cin>>a>>b>>c>>e>>f>>g;
if(a<60){
k++;
}
if(b<60){
k++;
}
if(c<60){
k++;
}
if(k<2){
cout<<"PASS"<<endl;
}
else{
cout<<"FAIL"<<endl;
}
if((a*e+b*f+c*g)/(e+f+g)>=60){
cout<<"PASS"<<endl;
}
else{
cout<<"FAIL"<<endl;
}
}