#include <cstdio>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
typedef pair <int,int> type;
vector <type> array;
bool cmp(type a,type b)
{
return a.first < b.first;
}
void calc(int n)
{
int exp, q;
if(n%2==0)
{
exp = 0;
while (n%2==0)
{
n /= 2;
exp++;
}
array.push_back(make_pair(2,exp));
}
q = sqrt(n)+1;
for(int i = 3; i < q&&n!=1; i+=2)
{
if (n%i==0)
{
exp = 0;
while (n%i==0)
{
n /= i;
exp++;
}
q = sqrt(n)+1;
array.push_back(make_pair(i,exp));
}
}
if(n!=1)
{
array.push_back(make_pair(n,1));
}
}
int main()
{
int i, j, a, ans, tmp;
for(i = 0; i < 10; i++)
{
scanf("%d",&a);
calc(a);
}
sort(array.begin(),array.end(),cmp);
ans = 1;
for(i = 0; i < array.size(); i++)
{
j = i;
tmp = 1;
while(j<array.size()&&array[j].first==array[i].first)
{
tmp += array[j++].second;
}
i = j-1;
ans *= tmp;
}
printf("%d\n",ans%10);
return 0;
}
I2luY2x1ZGUgPGNzdGRpbz4KI2luY2x1ZGUgPHZlY3Rvcj4KI2luY2x1ZGUgPGNtYXRoPgojaW5jbHVkZSA8YWxnb3JpdGhtPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCnR5cGVkZWYgcGFpciA8aW50LGludD4gdHlwZTsKCnZlY3RvciA8dHlwZT4gYXJyYXk7Cgpib29sIGNtcCh0eXBlIGEsdHlwZSBiKQp7CglyZXR1cm4gYS5maXJzdCA8IGIuZmlyc3Q7Cn0KCnZvaWQgY2FsYyhpbnQgbikKewoJaW50IGV4cCwgcTsKCglpZihuJTI9PTApCgl7CgkJZXhwID0gMDsKCQl3aGlsZSAobiUyPT0wKQoJCXsKCQkJbiAvPSAyOwogICAgICAgICAgICBleHArKzsKCQl9CgkJYXJyYXkucHVzaF9iYWNrKG1ha2VfcGFpcigyLGV4cCkpOwoJfQoJcSA9IHNxcnQobikrMTsKCWZvcihpbnQgaSA9IDM7IGkgPCBxJiZuIT0xOyBpKz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