#include int main(void){ int n; scanf("%d",&n); printf("%d\n",n%1111104); return 0; }