#include <iostream>
using namespace std;
int n,m;
long long k;
bool p[10][10];
int cnt, f[100001];
int main() {
cin>>n>>m>>k;
if (k==1) {cout<<n; return 0;}
if (k==2) {cout<<m; return 0;}
p[n][m]=1;
while(1) {
int a=n, b=m;
n=b; m=a*b%10;
f[cnt++]=m;
if (p[n][m]) break;
else p[n][m]=1;
}
cout<<f[(k-3)%cnt];
return 0;
}
求助,只WA#7,思路感觉没错