/*
TASK: abc
LANG:C++
*/
#include<cstdio>
#include<iostream>
#include<stack>
#include<string>
#include<math.h>
using namespace std;



class drob{
  public: 
      int c,z;
};
stack<drob> St;
int nod(int a,int b)
{
    if(b==0) return a;
    return nod(b,a%b);
}

drob norm(drob d){
    d.c/=nod(d.c,d.z);
    d.z/=nod(d.c,d.z);
}
drob sum(drob d1,drob d2){
    drob d3; 
     d3.c=d1.c*d2.z+d2.c*d1.z;
     d3.z=d1.z*d2.z;
}

bool pod_triug(char *tmp)
{
     
}

int main()
{
    drob d,res,result;
    int i,n,fl=0;
    char *tmp;
//    char **str;
    scanf("%d",&n);
//    str=(char **)malloc(sizeof(char *)*n);
    for(i=0;i<n;i++)
    {
     scanf("%s",&tmp);
     if(!pod_triug(tmp))
     {
      d.c=1;
      d.z=pow(4,strlen(tmp));
      St.push(d);
     }
    }
    //Do tozi moment v stack sa zapisani licata na triugulnicite,koito ne se povtarqt
    res=St.top();
    St.pop();
    while(!St.empty())
    {
     res=sum(res,St.top());
     St.pop();
    } 
    result=norm(res);
    printf("%d %d",result.c,result.z);
    system("PAUSE");   
    return 0;
}
