Question: I am using the following code to check the MPMediaLibrary authorizations:

```
func handlePermissions() {
    let permissionStatus = MPMediaLibrary.authorizationStatus()
    switch (permissionStatus) {
    case MPMediaLibraryAuthorizationStatus.authorized:
        print("permission status is authorized")
    case MPMediaLibraryAuthorizationStatus.notDetermined:
        print("permission status is not determined")
        MPMediaLibrary.requestAuthorization(MPMediaLibraryAuthorizationStatus -> permissionStatus)
    case MPMediaLibraryAuthorizationStatus.denied:
        print("permission status is denied")
    case MPMediaLibraryAuthorizationStatus.restricted:
        print("permission status is restricted")
    }
 }

```

Ultimately, I am trying to prompt the user for their authorization (upon launch) prior to calling a query...via the case MPMediaLibraryAuthorizationStatus.notDetermined:. The code above produces the error: Expected type after '->'. When the requestAuthorization() line is commented out, the app crashes upon launch (access has not been authorized) and the authorization prompt view is shown after the launch screen disappears.

I've seen some examples of how to perform requestAuthorization() in Objective C but nothing in Swift. I don't understand:

```
 MPMediaLibrary.requestAuthorization( handler: (MPMediaLibraryAuthorizationStatus) -> Void )

```

What is the proper way to request authorization for access to the MPMediaLibrary in Swift 3?

Answer: 
```
totalPrice = Math.ceil(totalItems / 3 * 2);

```

for every 3 items you pay a price of 2. If you grab 1-2 extra, you pay full price for them.
```
totalPrice = (totalItems/3)*2+ totalItems%3

```

this should work assuming totalItems is saved as an integer.

Assuming the number of items is N, it can be written as:

> 
> N = 3\*M + L
> 
> 
> (L < 3)
> 
> 
> 

M is the result of integer division, -mathematically the floor of the division-

L is the remainder of integer division.

the price is:

> 
> P = 2\*M + L
> 
> 
>