// created by Whiplash99
import java.io.*;
import java.util.*;
class C
{
{
int i,j,N;
N
=Integer.
parseInt(br.
readLine().
trim()); char arr[][]=new char[3][N];
int dp[][][]=new int[3][N][2];
for(i=0;i<3;i++)
arr[i]=br.readLine().trim().toCharArray();
for(i=0;i<3;i++)
{
if(arr[i][N-1]=='R')
dp[i][N-1][1]=1;
else
dp[i][N-1][0]=1;
}
/*
j: column number.
i: row number.
k: starting from this cell with parity k.
dp[i][j][k] = number of chains starting from cell (i,j) with parity k.
*/
for(j=N-2;j>=0;j--)
{
for(i=0;i<3;i++)
{
if(arr[i][j]=='R')
{
dp[i][j][0]=dp[(i+1)%3][j+1][1]+dp[(i+2)%3][j+1][1];
dp[i][j][1]=dp[(i+1)%3][j+1][0]+dp[(i+2)%3][j+1][0];
}
else
{
dp[i][j][0]=dp[(i+1)%3][j+1][0]+dp[(i+2)%3][j+1][0];
dp[i][j][1]=dp[(i+1)%3][j+1][1]+dp[(i+2)%3][j+1][1];
}
}
}
System.
out.
println(dp
[0][0][0]+dp
[1][0][0]+dp
[2][0][0]); }
}
Ly8gY3JlYXRlZCBieSBXaGlwbGFzaDk5CmltcG9ydCBqYXZhLmlvLio7CmltcG9ydCBqYXZhLnV0aWwuKjsKY2xhc3MgQwp7CiAgICBwdWJsaWMgc3RhdGljIHZvaWQgbWFpbihTdHJpbmdbXSBhcmdzKSB0aHJvd3MgSU9FeGNlcHRpb24KICAgIHsKICAgICAgICBCdWZmZXJlZFJlYWRlciBicj1uZXcgQnVmZmVyZWRSZWFkZXIobmV3IElucHV0U3RyZWFtUmVhZGVyKFN5c3RlbS5pbikpOwoKICAgICAgICBpbnQgaSxqLE47CgogICAgICAgIE49SW50ZWdlci5wYXJzZUludChici5yZWFkTGluZSgpLnRyaW0oKSk7CiAgICAgICAgY2hhciBhcnJbXVtdPW5ldyBjaGFyWzNdW05dOwogICAgICAgIGludCBkcFtdW11bXT1uZXcgaW50WzNdW05dWzJdOwoKICAgICAgICBmb3IoaT0wO2k8MztpKyspCiAgICAgICAgICAgIGFycltpXT1ici5yZWFkTGluZSgpLnRyaW0oKS50b0NoYXJBcnJheSgpOwogICAgICAgIGZvcihpPTA7aTwzO2krKykKICAgICAgICB7CiAgICAgICAgICAgIGlmKGFycltpXVtOLTFdPT0nUicpCiAgICAgICAgICAgICAgICBkcFtpXVtOLTFdWzFdPTE7CiAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgIGRwW2ldW04tMV1bMF09MTsKICAgICAgICB9CgogICAgICAgIAogICAgICAgIC8qCiAgICAgICAgICAgIGo6IGNvbHVtbiBudW1iZXIuCiAgICAgICAgICAgIGk6IHJvdyBudW1iZXIuCiAgICAgICAgICAgIGs6IHN0YXJ0aW5nIGZyb20gdGhpcyBjZWxsIHdpdGggcGFyaXR5IGsuCiAgICAgICAgICAgIAogICAgICAgICAgICBkcFtpXVtqXVtrXSA9IG51bWJlciBvZiBjaGFpbnMgc3RhcnRpbmcgZnJvbSBjZWxsIChpLGopIHdpdGggcGFyaXR5IGsuCiAgICAgICAgICovCiAgICAgICAgZm9yKGo9Ti0yO2o+PTA7ai0tKQogICAgICAgIHsKICAgICAgICAgICAgZm9yKGk9MDtpPDM7aSsrKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpZihhcnJbaV1bal09PSdSJykKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBkcFtpXVtqXVswXT1kcFsoaSsxKSUzXVtqKzFdWzFdK2RwWyhpKzIpJTNdW2orMV1bMV07CiAgICAgICAgICAgICAgICAgICAgZHBbaV1bal1bMV09ZHBbKGkrMSklM11baisxXVswXStkcFsoaSsyKSUzXVtqKzFdWzBdOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGRwW2ldW2pdWzBdPWRwWyhpKzEpJTNdW2orMV1bMF0rZHBbKGkrMiklM11baisxXVswXTsKICAgICAgICAgICAgICAgICAgICBkcFtpXVtqXVsxXT1kcFsoaSsxKSUzXVtqKzFdWzFdK2RwWyhpKzIpJTNdW2orMV1bMV07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKGRwWzBdWzBdWzBdK2RwWzFdWzBdWzBdK2RwWzJdWzBdWzBdKTsKICAgIH0KfQ==