#include using namespace std; int main(){ int a,b,t; cin>>a>>b; t=3600*a+b*60; int pa,pb; pa=t%(3600*12); pb=(t%3600)*12; int df=(pa-pb+3600*12)%(3600*12); cout<