#include <bits/stdc++.h>

#define int long long
using namespace std;
const int mod = 10;
const int MAX=1e6+10;
const int INF=0x3f3f3f3f;

int fastPow(int a,int n){
    int base=a;
    int res=1;
    while(n){
        if(n&1){
            res=(base*res)%4;
        }
        base=(base*base)%4;
        n=n>>1;
    }
    return res;
}
int a2[10]={0,2,4,8,6};
int a3[10]={0,3,9,7,1};
int a7[10]={0,7,9,3,1};
int a8[10]={0,8,4,2,6};
void solve() {
    int a,b,c;
    cin>>a>>b>>c;
    a=a%10;
    if(a==0||a==1||a==5||a==6){
        cout<<a;
        return;
    }
    if(a==2||a==3||a==7||a==8){
        int yu=fastPow(b,c);
        if(yu==0)yu=4;
        if(a==2){
            cout<<a2[yu];
        }
        if(a==3){
            cout<<a3[yu];
        }
        if(a==7){
            cout<<a7[yu];
        }
        if(a==8){
            cout<<a8[yu];
        }

    }
    if(a==4||a==9){
        if(a==4){
            if(b%2==0){
                cout<<6;
            }else{
                cout<<4;
            }
        }
        if(a==9){
            if(b%2==0){
                cout<<1;
            }else{
                cout<<9;
            }
        }
    }


}

signed main() {
    //ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int _ = 1;
    //cin >> _;
    while (_--) {
        solve();
    }
    return 0;
}
#include <bits/stdc++.h>
using namespace std;

int main() {
  unsigned long a,b,c,n,l,m,result;
  cin >> a >> b >> c ;

  n = ((a*(a + 1)/2%998244353))%998244353;


  l = ((b*(b + 1)/2%998244353))%998244353;

  m = ((c*(c + 1)/2%998244353))%998244353;

  result = ((n*l%998244353)*m)%998244353;
 
  cout << result << endl;
}