#include int main() { int d,h,m; scanf("%d %d %d",&d,&h,&m); int output = d*24*60+h*60+m; printf("%d",output); return 0; }