#include using namespace std; int main(void) { string s = ".1234567891011121314151617"; int d; cin >> d; cout << s[d] << endl; return 0; }