Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- bookWidth, borderWidth, firstId, lastId = [int(i) for i in input().split()]
- if lastId > firstId:
- if lastId - firstId == 1:
- print(borderWidth * (lastId - firstId + 1) + bookWidth * (lastId - firstId - 1))
- else:
- print(borderWidth * (lastId - firstId + 2) + bookWidth * (lastId - firstId - 1))
- elif lastId < firstId:
- if firstId - lastId == 1:
- print(bookWidth * (firstId - lastId + 1) + borderWidth * (firstId - lastId + 1))
- else:
- print(bookWidth * (firstId - lastId + 1) + borderWidth * (firstId - lastId + 2))
- else:
- print(bookWidth)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement