#include <bits/stdc++.h>
using namespace std;
int main(){
long long n;
cin>>n;
string s=to_string(n);
long long num=0;
for(int i=0;i<s.length();i++){
num+=s[i]-'0';
}
cout<<num%12;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmludCBtYWluKCl7CiAgICBsb25nIGxvbmcgbjsKICAgIGNpbj4+bjsKICAgIHN0cmluZyBzPXRvX3N0cmluZyhuKTsKICAgIGxvbmcgbG9uZyBudW09MDsKICAgIGZvcihpbnQgaT0wO2k8cy5sZW5ndGgoKTtpKyspewogICAgICAgIG51bSs9c1tpXS0nMCc7CiAgICB9CiAgICBjb3V0PDxudW0lMTI7Cn0=