Advertisement
PlotnikovPhilipp

Untitled

Oct 23rd, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.60 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. bookWidth, borderWidth, firstId, lastId = [int(i) for i in input().split()]
  3. if lastId > firstId:
  4.     if lastId - firstId == 1:
  5.         print(borderWidth * (lastId - firstId + 1) + bookWidth * (lastId - firstId - 1))
  6.     else:
  7.         print(borderWidth * (lastId - firstId + 2) + bookWidth * (lastId - firstId - 1))
  8. elif lastId < firstId:
  9.     if firstId - lastId == 1:
  10.         print(bookWidth * (firstId - lastId + 1) + borderWidth * (firstId - lastId + 1))
  11.     else:
  12.         print(bookWidth * (firstId - lastId + 1) + borderWidth * (firstId - lastId + 2))
  13. else:
  14.     print(bookWidth)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement